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) | 6 function verifySpellTest(nretry) |
7 { | 7 { |
8 var node = destination; | 8 var node = window.destination; |
9 if (destination.childNodes.length > 0) | 9 if (window.destination.childNodes.length > 0) |
10 node = 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); }, 0); | 12 window.setTimeout(function() { verifySpellTest(nretry - 1); }, 0); |
13 return; | 13 return; |
14 } | 14 } |
15 testFunctionCallback(node); | 15 testFunctionCallback(node); |
16 finishJSTest() | 16 finishJSTest() |
17 } | 17 } |
18 | 18 |
19 function initSpellTest(testElementId, testText, testFunction) | 19 function initSpellTest(testElementId, testText, testFunction) |
20 { | 20 { |
21 if (!window.internals || !window.testRunner) { | 21 if (!window.internals || !window.testRunner) { |
22 log("FAIL Incomplete test environment"); | 22 log("FAIL Incomplete test environment"); |
23 return; | 23 return; |
24 } | 24 } |
25 testFunctionCallback = testFunction; | 25 testFunctionCallback = testFunction; |
26 jsTestIsAsync = true; | 26 jsTestIsAsync = true; |
27 internals.settings.setAsynchronousSpellCheckingEnabled(true); | 27 internals.settings.setAsynchronousSpellCheckingEnabled(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); | 30 internals.settings.setUnifiedTextCheckerEnabled(true); |
31 internals.settings.setEditingBehavior("win"); | 31 internals.settings.setEditingBehavior("win"); |
32 var destination = document.getElementById(testElementId); | 32 window.destination = document.getElementById(testElementId); |
33 destination.focus(); | 33 window.destination.focus(); |
34 document.execCommand("InsertText", false, testText); | 34 document.execCommand("InsertText", false, testText); |
35 window.setTimeout(function() { verifySpellTest(10); }, 0); | 35 window.setTimeout(function() { verifySpellTest(10); }, 0); |
36 } | 36 } |
OLD | NEW |