Fix Layout Test pointer-lock/locked-element-removed-from-dom.html flakiness.
authorscheib@chromium.org <scheib@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jul 2012 20:48:40 +0000 (20:48 +0000)
committerscheib@chromium.org <scheib@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jul 2012 20:48:40 +0000 (20:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=91373

Reviewed by Adrienne Walker.

pointer-lock-test-harness corrected to no longer silently allow too many
asynchronous doNextStep calls in a test. The locked-element-removed-from-dom test
generated too many events and incorrectly exited the test early.

* platform/chromium/TestExpectations:
    Re-enabled locked-element-removed-from-dom test.html
* pointer-lock/locked-element-removed-from-dom.html:
    Absorb extra doNextStep.
* pointer-lock/resources/pointer-lock-test-harness.js:
(doNextStep.setTimeout):
    Fail tests that call doNextStep too many times.

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

LayoutTests/ChangeLog
LayoutTests/platform/chromium/TestExpectations
LayoutTests/pointer-lock/locked-element-removed-from-dom.html
LayoutTests/pointer-lock/resources/pointer-lock-test-harness.js

index 8fb8623..53a6010 100644 (file)
@@ -1,3 +1,22 @@
+2012-07-16  Vincent Scheib  <scheib@chromium.org>
+
+        Fix Layout Test pointer-lock/locked-element-removed-from-dom.html flakiness.
+        https://bugs.webkit.org/show_bug.cgi?id=91373
+
+        Reviewed by Adrienne Walker.
+
+        pointer-lock-test-harness corrected to no longer silently allow too many
+        asynchronous doNextStep calls in a test. The locked-element-removed-from-dom test
+        generated too many events and incorrectly exited the test early.
+
+        * platform/chromium/TestExpectations:
+            Re-enabled locked-element-removed-from-dom test.html
+        * pointer-lock/locked-element-removed-from-dom.html:
+            Absorb extra doNextStep.
+        * pointer-lock/resources/pointer-lock-test-harness.js:
+        (doNextStep.setTimeout):
+            Fail tests that call doNextStep too many times.
+
 2012-07-16  Florin Malita  <fmalita@chromium.org>
 
         SVGAnimationElement::currentValuesForValuesAnimation crash
index 0201519..55b21ab 100644 (file)
@@ -3728,9 +3728,6 @@ BUGWK90900 MAC : tables/mozilla_expected_failures/other/empty_cells.html = PASS
 BUGWK90980 LINUX MAC DEBUG : fast/forms/textarea/textarea-state-restore.html = PASS TIMEOUT
 BUGWK90980 WIN : fast/forms/textarea/textarea-state-restore.html = PASS TIMEOUT
 
-// Flaky since creation in 122626
-BUGWK91373 WIN : pointer-lock/locked-element-removed-from-dom.html = PASS TEXT
-
 // Started crashing after 122286
 BUGWK91133 WIN : storage/indexeddb/constants.html = PASS CRASH
 
index d71b8ce..8fda65f 100644 (file)
@@ -42,6 +42,9 @@
             shouldBe("targetDiv1.parentElement.parentElement", "null");
             // doNextStep called by event handler.
         },
+        function () {
+            // Absorb an extra doNextStep() from previous event handlers.
+        },
     ];
     doNextStep();
 </script>
index 48a1be5..6368420 100644 (file)
@@ -12,10 +12,15 @@ function doNextStep()
     if (typeof(currentStep) == "undefined")
         currentStep = 0;
 
-    if (currentStep < todo.length)
-        setTimeout(function () { todo[currentStep++](); }, 0);
-    else if (currentStep++ == todo.length)
-        setTimeout(function () { finishJSTest(); }, 0);
+    setTimeout(function () {
+        var thisStep = currentStep++;
+        if (thisStep < todo.length)
+            todo[thisStep]();
+        else if (thisStep == todo.length)
+            setTimeout(function () { finishJSTest(); }, 0); // Deferred so that excessive doNextStep calls will be observed.
+        else
+            testFailed("doNextStep called too many times.");
+    }, 0);
 }
 
 function doNextStepWithUserGesture()