shouldBecomeEqual() behaves as shouldBe() if the testing expression returns the expec...
authorg.czajkowski@samsung.com <g.czajkowski@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Dec 2014 08:26:49 +0000 (08:26 +0000)
committerg.czajkowski@samsung.com <g.czajkowski@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Dec 2014 08:26:49 +0000 (08:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=133939

Reviewed by Darin Adler.

First call of eval(expression) inside shouldBecomeEqual was always
made synchronously. If the testing expression returns the same value
as expected one then shouldBecomeEqual() will immediately report PASS,
for example,

shouldBecomeEqual(internals.hasSpellingMarker("wellcome"), false);

in consequence, assuming asynchronous path of spellchecking, spelling markers
may appear after a while.

The bug was caused by checking a condition at the beginning of shouldBecomeEqual(),
before calling a timer. As a result, queued asynchronous events doesn't effect
this checking.

* TestExpectations:
This fix reveals new bugs in execDeleteCommand() behaviour, two tests need
to marked as failure now.

* resources/js-test-pre.js:
(.condition):
(shouldBecomeEqual):
(shouldBecomeDifferent):
* resources/js-test.js:
(.condition):
(shouldBecomeEqual):
(shouldBecomeDifferent):
Always check a condition on timer.

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

LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/resources/js-test-pre.js
LayoutTests/resources/js-test.js

index 54bda6e..055903b 100644 (file)
@@ -1,3 +1,38 @@
+2014-12-23  Grzegorz Czajkowski  <g.czajkowski@samsung.com>
+
+        shouldBecomeEqual() behaves as shouldBe() if the testing expression returns the expected value
+        https://bugs.webkit.org/show_bug.cgi?id=133939
+
+        Reviewed by Darin Adler.
+
+        First call of eval(expression) inside shouldBecomeEqual was always
+        made synchronously. If the testing expression returns the same value
+        as expected one then shouldBecomeEqual() will immediately report PASS,
+        for example,
+
+        shouldBecomeEqual(internals.hasSpellingMarker("wellcome"), false);
+
+        in consequence, assuming asynchronous path of spellchecking, spelling markers
+        may appear after a while.
+
+        The bug was caused by checking a condition at the beginning of shouldBecomeEqual(),
+        before calling a timer. As a result, queued asynchronous events doesn't effect
+        this checking.
+
+        * TestExpectations:
+        This fix reveals new bugs in execDeleteCommand() behaviour, two tests need
+        to marked as failure now.
+
+        * resources/js-test-pre.js:
+        (.condition):
+        (shouldBecomeEqual):
+        (shouldBecomeDifferent):
+        * resources/js-test.js:
+        (.condition):
+        (shouldBecomeEqual):
+        (shouldBecomeDifferent):
+        Always check a condition on timer.
+
 2014-12-22  Alexey Proskuryakov  <ap@apple.com>
 
         platform/mac-wk2/tiled-drawing/scrolling/frames/frameset-frame-scrollability.html is flaky
index 2cd9dcd..9f72b97 100644 (file)
@@ -10,6 +10,9 @@ webkit.org/b/116293 media/video-seek-after-end.html [ Pass Failure ]
 
 webkit.org/b/116473 editing/selection/user-drag-element-and-user-select-none.html [ Failure ]
 
+webkit.org/b/139862 editing/spelling/editing-multiple-words-with-markers.html [ Timeout ]
+webkit.org/b/139862 editing/spelling/grammar-edit-word.html [ Timeout ]
+
 # media/W3C/video/networkState/networkState_during_progress.html is flaky
 webkit.org/b/76280 media/W3C/video/networkState/networkState_during_progress.html [ Pass Failure ]
 
index e5812cb..2e3d15b 100644 (file)
@@ -289,7 +289,7 @@ function shouldBecomeEqual(_a, _b, completionHandler)
   if (typeof _a != "string" || typeof _b != "string")
     debug("WARN: shouldBecomeEqual() expects string arguments");
 
-  var condition = function() {
+  function condition() {
     var exception;
     var _av;
     try {
@@ -305,8 +305,8 @@ function shouldBecomeEqual(_a, _b, completionHandler)
       return true;
     }
     return false;
-  };
-  _waitForCondition(condition, completionHandler);
+  }
+  setTimeout(_waitForCondition, 0, condition, completionHandler);
 }
 
 function shouldBecomeEqualToString(value, reference, completionHandler)
@@ -401,7 +401,7 @@ function shouldBecomeDifferent(_a, _b, completionHandler)
   if (typeof _a != "string" || typeof _b != "string")
     debug("WARN: shouldBecomeDifferent() expects string arguments");
 
-  var condition = function() {
+  function condition() {
     var exception;
     var _av;
     try {
@@ -417,8 +417,8 @@ function shouldBecomeDifferent(_a, _b, completionHandler)
       return true;
     }
     return false;
-  };
-  _waitForCondition(condition, completionHandler);
+  }
+  setTimeout(_waitForCondition, 0, condition, completionHandler);
 }
 
 function shouldBeTrue(_a) { shouldBe(_a, "true"); }
index d967611..bb82ed6 100644 (file)
@@ -256,7 +256,7 @@ function shouldBecomeEqual(_a, _b, completionHandler)
   if (typeof _a != "string" || typeof _b != "string")
     debug("WARN: shouldBecomeEqual() expects string arguments");
 
-  var condition = function() {
+  function condition() {
     var exception;
     var _av;
     try {
@@ -272,8 +272,8 @@ function shouldBecomeEqual(_a, _b, completionHandler)
       return true;
     }
     return false;
-  };
-  _waitForCondition(condition, completionHandler);
+  }
+  setTimeout(_waitForCondition, 0, condition, completionHandler);
 }
 
 function shouldBecomeEqualToString(value, reference, completionHandler)
@@ -368,7 +368,7 @@ function shouldBecomeDifferent(_a, _b, completionHandler)
   if (typeof _a != "string" || typeof _b != "string")
     debug("WARN: shouldBecomeDifferent() expects string arguments");
 
-  var condition = function() {
+  function condition() {
     var exception;
     var _av;
     try {
@@ -384,8 +384,8 @@ function shouldBecomeDifferent(_a, _b, completionHandler)
       return true;
     }
     return false;
-  };
-  _waitForCondition(condition, completionHandler);
+  }
+  setTimeout(_waitForCondition, 0, condition, completionHandler);
 }
 
 function shouldBeTrue(a, quiet) { shouldBe(a, "true", quiet); }