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

Side by Side Diff: LayoutTests/editing/spelling/spellcheck-paste-continuous-disabled.html

Issue 23534071: Use shouldBecomeEqual in asynchronous spellchecking tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Apply Tony's review and use asynchronous spellchecking in two tests Created 7 years, 3 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
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../fast/js/resources/js-test-pre.js"></script> 4 <script src="../../fast/js/resources/js-test-pre.js"></script>
5 <script src="resources/js-test-selection-shared.js"></script> 5 <script src="resources/js-test-selection-shared.js"></script>
6 </head> 6 </head>
7 <body> 7 <body>
8 <div> 8 <div>
9 <div id="src" contenteditable="true" spellcheck="true"></div> 9 <div id="src" contenteditable="true" spellcheck="true"></div>
10 </div> 10 </div>
11 <script language="javascript"> 11 <script language="javascript">
12 description('Test if WebKit does not spellcheck text when pasting text and conti nuous spellcheck is turned off. ' + 12 description('Test if WebKit does not spellcheck text when pasting text and conti nuous spellcheck is turned off. ' +
13 'To test manually, disable continuous spellcheck, copy the text "zz apple" and paste it to the textarea. ' + 13 'To test manually, disable continuous spellcheck, copy the text "zz apple" and paste it to the textarea. ' +
14 'When "zz" is not marked as misspelled, this test succeeds.'); 14 'When "zz" is not marked as misspelled, this test succeeds.');
15 15
16 jsTestIsAsync = true; 16 jsTestIsAsync = true;
17 17
18 internals.settings.setAsynchronousSpellCheckingEnabled(true);
19
18 // Insert a misspelled word to initialize a spellchecker. 20 // Insert a misspelled word to initialize a spellchecker.
19 var srcNode = document.getElementById('src'); 21 var srcNode = document.getElementById('src');
20 srcNode.focus(); 22 srcNode.focus();
21 document.execCommand("InsertText", false, 'z'); 23 document.execCommand("InsertText", false, 'z');
22 document.execCommand("InsertText", false, 'z'); 24 document.execCommand("InsertText", false, 'z');
23 document.execCommand("InsertText", false, ' '); 25 document.execCommand("InsertText", false, ' ');
24 document.execCommand("InsertText", false, 'a'); 26 document.execCommand("InsertText", false, 'a');
25 document.execCommand("InsertText", false, 'p'); 27 document.execCommand("InsertText", false, 'p');
26 document.execCommand("InsertText", false, 'p'); 28 document.execCommand("InsertText", false, 'p');
27 document.execCommand("InsertText", false, 'l'); 29 document.execCommand("InsertText", false, 'l');
28 document.execCommand("InsertText", false, 'e'); 30 document.execCommand("InsertText", false, 'e');
29 shouldBeTrue('internals.hasSpellingMarker(document, 0, 2)'); 31 shouldBecomeEqual('internals.hasSpellingMarker(document, 0, 2)', 'true', functio n() {});
30 window.getSelection().selectAllChildren(srcNode); 32 window.getSelection().selectAllChildren(srcNode);
31 document.execCommand('Copy'); 33 document.execCommand('Copy');
32 34
33 internals.settings.setAsynchronousSpellCheckingEnabled(true);
34 internals.setContinuousSpellCheckingEnabled(false); 35 internals.setContinuousSpellCheckingEnabled(false);
35 36
36 document.execCommand('Paste'); 37 document.execCommand('Paste');
38 shouldBecomeDifferent('internals.hasSpellingMarker(document, 0, 2)', 'true', fin ishJSTest);
37 39
38 var retryCount = 10;
39 var sleepPeriod = 1;
40 function verifyMarker() {
41 srcNode.focus();
42 var hasMarker = internals.hasSpellingMarker(document, 0, 2);
43 if (!hasMarker && --retryCount > 0) {
44 sleepPeriod *= 2;
45 window.setTimeout(verifyMarker, sleepPeriod);
46 return;
47 }
48 if (hasMarker)
49 testFailed('The destination node should not have a marker.');
50 else
51 testPassed('The destination node does not have any markers.');
52 finishJSTest();
53 }
54 window.setTimeout(verifyMarker, sleepPeriod);
55 </script> 40 </script>
56 <script src="../../fast/js/resources/js-test-post.js"></script> 41 <script src="../../fast/js/resources/js-test-post.js"></script>
57 </body> 42 </body>
58 </html> 43 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698