Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: LayoutTests/resources-tests/should-become-equal-test.html

Issue 906193003: shouldBecomeEqual() behaves as shouldBe() if the testing expression returns the expected value Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add regression test Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <html>
yosin_UTC9 2016/09/01 01:49:06 Could you use w3c test harness to test |shouldBeco
2 <body onload="runTest()">
3 <script src="../resources/js-test.js"></script>
4 <div id="testElement" contenteditable></div>
5 <script>
6 jsTestIsAsync = true;
7
8 description("This test verifies whether shouldBecomeEqual asynchronously "
9 + "checks condition when testing expression returns the expected value.<br>"
10 + "Otherwise, there will be no difference between:<br><br>"
11 + "shouldBecomeEqual(internals.hasSpellingMarker(welllcome), false)<br> "
12 + "shouldBecomeEqual(internals.hasSpellingMarker(welcome), false)<br>");
13
14 function runTest()
15 {
16 if (!window.internals)
17 return;
18
19 internals.settings.setAsynchronousSpellCheckingEnabled(true);
20 internals.settings.setUnifiedTextCheckerEnabled(true);
21
22 var testElement = document.getElementById("testElement");
23 testElement.focus();
24 document.execCommand("InsertText", false, "wellcome ");
25 // Because async path of spellchecing is turned on it's unlikely to have
26 // spelling markers at this point so that first call of hasSpellingMarker()
27 // will probably return false and shouldBecomeEqual shouldn't report it as P ASS.
28 shouldBecomeEqual("internals.hasSpellingMarker(document, 0, 8)", "false", fu nction() {
please use gerrit instead 2015/02/17 16:28:48 You probably should not be testing shouldBecomeEqu
29 testFailed("wellcome will have marker");
30 finishJSTest();
31 });
32
33 // We assume that the test passes if the test is not finished which means th at
34 // shouldBecomeEqual's completion handler was not called.
35 setTimeout(function() { fallback(10); }, 0);
36 function fallback(nretry)
37 {
38 if (nretry)
39 return setTimeout(function() { fallback(nretry - 1); }, 0);
40 else {
41 testPassed("");
42 finishJSTest();
43 }
44 }
45 }
46 </script>
47 </body>
48 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698