Chromium Code Reviews| Index: LayoutTests/resources-tests/should-become-equal-test.html |
| diff --git a/LayoutTests/resources-tests/should-become-equal-test.html b/LayoutTests/resources-tests/should-become-equal-test.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..829ea10ceeb1894441ea3ee08289728d2ad026a1 |
| --- /dev/null |
| +++ b/LayoutTests/resources-tests/should-become-equal-test.html |
| @@ -0,0 +1,48 @@ |
| +<html> |
|
yosin_UTC9
2016/09/01 01:49:06
Could you use w3c test harness to test |shouldBeco
|
| +<body onload="runTest()"> |
| +<script src="../resources/js-test.js"></script> |
| +<div id="testElement" contenteditable></div> |
| +<script> |
| +jsTestIsAsync = true; |
| + |
| +description("This test verifies whether shouldBecomeEqual asynchronously " |
| + + "checks condition when testing expression returns the expected value.<br>" |
| + + "Otherwise, there will be no difference between:<br><br>" |
| + + "shouldBecomeEqual(internals.hasSpellingMarker(welllcome), false)<br> " |
| + + "shouldBecomeEqual(internals.hasSpellingMarker(welcome), false)<br>"); |
| + |
| +function runTest() |
| +{ |
| + if (!window.internals) |
| + return; |
| + |
| + internals.settings.setAsynchronousSpellCheckingEnabled(true); |
| + internals.settings.setUnifiedTextCheckerEnabled(true); |
| + |
| + var testElement = document.getElementById("testElement"); |
| + testElement.focus(); |
| + document.execCommand("InsertText", false, "wellcome "); |
| + // Because async path of spellchecing is turned on it's unlikely to have |
| + // spelling markers at this point so that first call of hasSpellingMarker() |
| + // will probably return false and shouldBecomeEqual shouldn't report it as PASS. |
| + shouldBecomeEqual("internals.hasSpellingMarker(document, 0, 8)", "false", function() { |
|
please use gerrit instead
2015/02/17 16:28:48
You probably should not be testing shouldBecomeEqu
|
| + testFailed("wellcome will have marker"); |
| + finishJSTest(); |
| + }); |
| + |
| + // We assume that the test passes if the test is not finished which means that |
| + // shouldBecomeEqual's completion handler was not called. |
| + setTimeout(function() { fallback(10); }, 0); |
| + function fallback(nretry) |
| + { |
| + if (nretry) |
| + return setTimeout(function() { fallback(nretry - 1); }, 0); |
| + else { |
| + testPassed(""); |
| + finishJSTest(); |
| + } |
| + } |
| +} |
| +</script> |
| +</body> |
| +</html> |