2011-03-05 Andrey Kosyakov <caseq@chromium.org>
authorcaseq@chromium.org <caseq@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Mar 2011 18:03:18 +0000 (18:03 +0000)
committercaseq@chromium.org <caseq@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Mar 2011 18:03:18 +0000 (18:03 +0000)
        Unreviewed. Another shot at fixing flakiness of extension-events.html.

        * inspector/extensions/extensions-events.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@80426 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/inspector/extensions/extensions-events.html

index 8d64959..635b275 100644 (file)
@@ -1,3 +1,9 @@
+2011-03-05  Andrey Kosyakov  <caseq@chromium.org>
+
+        Unreviewed. Another shot at fixing flakiness of extension-events.html.
+
+        * inspector/extensions/extensions-events.html:
+
 2011-03-05  Pavel Feldman  <pfeldman@chromium.org>
 
         Not reviewed: chromium rebaseline, flaky test fix.
index 1aa3f69..86c50e3 100755 (executable)
@@ -33,27 +33,30 @@ function extension_testOnResourceFinished(nextTest)
 
 function extension_testPageLoadEvents(nextTest)
 {
-    var callbackCount = 0;
-    var onLoadArgument;
-
-    webInspector.inspectedWindow.onDOMContentLoaded.addListener(function(time) {
-        output("onDOMContentLoaded fired: " + typeof time);
-    });
+    var queuedOutput = [];
 
     // Logging on onLoaded is tricky due to race conditions with output("Page reloaded") in page initialization code.
-    // So only log when we're sure both onLoaded fired and reload is done.
-    function reloadCallback()
+    // So only log when we're sure all handlers are called and reload is done.
+    function queueOutputAndContinue(message)
     {
-        if (++callbackCount < 2)
+        queuedOutput.push(message);
+        if (queuedOutput.length != 3)
             return;
-        output("onLoaded fired: " + typeof onLoadArgument);
-        nextTest();
+        for (i = 0; i < queuedOutput.length; ++i) {
+            if (queuedOutput[i])
+                output(queuedOutput[i]);
+        }
+       nextTest();
     }
+
+    webInspector.inspectedWindow.onDOMContentLoaded.addListener(function(time) {
+        queueOutputAndContinue("onDOMContentLoaded fired: " + typeof time);
+    });
+
     webInspector.inspectedWindow.onLoaded.addListener(function(time) {
-        onLoadArgument = time;
-        reloadCallback();
+        queueOutputAndContinue("onLoaded fired: " + typeof time);
     });
-    dispatchOnFrontend({ command: "reload" }, reloadCallback);
+    dispatchOnFrontend({ command: "reload" }, queueOutputAndContinue);
 }
 
 </script>