OLD | NEW |
1 function log(msg) | 1 function log(msg) |
2 { | 2 { |
3 document.getElementById("console").innerHTML += (msg + "\n"); | 3 document.getElementById("console").innerHTML += (msg + "\n"); |
4 } | 4 } |
5 | 5 |
6 function verifySpellTest(nretry, opt_doNotFinishTest) | 6 function verifySpellTest(nretry, opt_doNotFinishTest) |
7 { | 7 { |
8 var node = window.destination; | 8 var node = window.destination; |
9 if (window.destination.childNodes.length > 0) | 9 if (window.destination.childNodes.length > 0) |
10 node = window.destination.childNodes[0]; | 10 node = window.destination.childNodes[0]; |
11 if (nretry && !internals.markerCountForNode(node, "spelling")) { | 11 if (nretry && !internals.markerCountForNode(node, "spelling")) { |
12 window.setTimeout(function() { verifySpellTest(nretry - 1, opt_doNotFini
shTest); }, 0); | 12 window.setTimeout(function() { verifySpellTest(nretry - 1, opt_doNotFini
shTest); }, 0); |
13 return; | 13 return; |
14 } | 14 } |
15 testFunctionCallback(node); | 15 testFunctionCallback(node); |
16 if (!opt_doNotFinishTest) | 16 if (!opt_doNotFinishTest) |
17 finishJSTest(); | 17 finishJSTest(); |
18 } | 18 } |
19 | 19 |
20 function initSpellTest(testElementId, testText, testFunction, opt_doNotFinishTes
t) | 20 function initSpellTest(testElementId, testText, testFunction, opt_doNotFinishTes
t) |
21 { | 21 { |
22 if (!window.internals || !window.testRunner) { | 22 if (!window.internals || !window.testRunner) { |
23 log("FAIL Incomplete test environment"); | 23 log("FAIL Incomplete test environment"); |
24 return; | 24 return; |
25 } | 25 } |
26 testFunctionCallback = testFunction; | 26 testFunctionCallback = testFunction; |
27 jsTestIsAsync = true; | 27 jsTestIsAsync = true; |
28 internals.settings.setSmartInsertDeleteEnabled(true); | 28 internals.settings.setSmartInsertDeleteEnabled(true); |
29 internals.settings.setSelectTrailingWhitespaceEnabled(false); | 29 internals.settings.setSelectTrailingWhitespaceEnabled(false); |
30 internals.settings.setUnifiedTextCheckerEnabled(true); | |
31 internals.settings.setEditingBehavior("win"); | 30 internals.settings.setEditingBehavior("win"); |
32 window.destination = document.getElementById(testElementId); | 31 window.destination = document.getElementById(testElementId); |
33 window.destination.focus(); | 32 window.destination.focus(); |
34 document.execCommand("InsertText", false, testText); | 33 document.execCommand("InsertText", false, testText); |
35 window.setTimeout(function() { verifySpellTest(10, opt_doNotFinishTest); },
0); | 34 window.setTimeout(function() { verifySpellTest(10, opt_doNotFinishTest); },
0); |
36 } | 35 } |
37 | 36 |
38 function findFirstTextNode(node) | 37 function findFirstTextNode(node) |
39 { | 38 { |
40 function iterToFindFirstTextNode(node) | 39 function iterToFindFirstTextNode(node) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 84 |
86 function runSpellingTest(steps, assertions, opt_title) | 85 function runSpellingTest(steps, assertions, opt_title) |
87 { | 86 { |
88 var t = async_test(opt_title); | 87 var t = async_test(opt_title); |
89 if (!window.internals) { | 88 if (!window.internals) { |
90 t.step(() => assert_unreached('internals is required for this test')); | 89 t.step(() => assert_unreached('internals is required for this test')); |
91 t.done(); | 90 t.done(); |
92 return; | 91 return; |
93 } | 92 } |
94 | 93 |
95 internals.settings.setUnifiedTextCheckerEnabled(true); | |
96 runNextStep(t, steps, assertions); | 94 runNextStep(t, steps, assertions); |
97 } | 95 } |
OLD | NEW |