Bug 950565 - Fix for intermittent browser_webconsole_bug_782653_CSS_links_in_Style_Editor.js | Test timed out. a=test-only
authorMihai Sucan <mihai.sucan@gmail.com>
Thu, 16 Jan 2014 23:33:02 +0200
changeset 167957 a7728f3c65e0d34a6896a1f0d6a6c00a93707f07
parent 167956 496971f341284757e087f6e27b6343914743e1e5
child 167958 9e922dfba7172a60f31ae4de5eabea5766e495a0
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstest-only
bugs950565
milestone27.0
Bug 950565 - Fix for intermittent browser_webconsole_bug_782653_CSS_links_in_Style_Editor.js | Test timed out. a=test-only
browser/devtools/webconsole/test/browser_webconsole_bug_782653_CSS_links_in_Style_Editor.js
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_782653_CSS_links_in_Style_Editor.js
+++ b/browser/devtools/webconsole/test/browser_webconsole_bug_782653_CSS_links_in_Style_Editor.js
@@ -102,54 +102,41 @@ function onStyleEditorReady(aPanel)
       });
     });
   }, win);
 }
 
 function checkStyleEditorForSheetAndLine(aHref, aLine, aCallback)
 {
   let foundEditor = null;
-  waitForSuccess({
-    name: "style editor for stylesheet",
-    validatorFn: function()
-    {
-      for (let editor of StyleEditorUI.editors) {
-        if (editor.styleSheet.href == aHref) {
-          foundEditor = editor;
-          return true;
-        }
-      }
-      return false;
-    },
-    successFn: function()
-    {
-      performLineCheck(foundEditor, aLine, aCallback);
-    },
-    failureFn: finishTest,
-  });
+  for (let editor of StyleEditorUI.editors) {
+    if (editor.styleSheet.href == aHref) {
+      foundEditor = editor;
+      break;
+    }
+  }
+
+  ok(foundEditor, "found style editor for " + aHref);
+  performLineCheck(foundEditor, aLine, aCallback);
 }
 
 function performLineCheck(aEditor, aLine, aCallback)
 {
   function checkForCorrectState()
   {
     is(aEditor.sourceEditor.getCursor().line, aLine,
        "correct line is selected");
     is(StyleEditorUI.selectedStyleSheetIndex, aEditor.styleSheet.styleSheetIndex,
        "correct stylesheet is selected in the editor");
 
     aCallback && executeSoon(aCallback);
   }
 
-  waitForSuccess({
-    name: "source editor load",
-    validatorFn: function()
-    {
-      return aEditor.sourceEditor;
-    },
-    successFn: checkForCorrectState,
-    failureFn: function() {
-      info("selectedStyleSheetIndex " + StyleEditorUI.selectedStyleSheetIndex
-           + " expected " + aEditor.styleSheet.styleSheetIndex);
-      finishTest();
-    },
+  info("wait for source editor to load");
+
+  // Get out of the styleeditor-selected event loop.
+  executeSoon(() => {
+    aEditor.getSourceEditor().then(() => {
+      // Get out of the editor's source-editor-load event loop.
+      executeSoon(checkForCorrectState);
+    });
   });
 }