| 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 testRunner.setMockSpellCheckerEnabled(true); |
| 26 testFunctionCallback = testFunction; | 27 testFunctionCallback = testFunction; |
| 27 jsTestIsAsync = true; | 28 jsTestIsAsync = true; |
| 28 internals.settings.setSmartInsertDeleteEnabled(true); | 29 internals.settings.setSmartInsertDeleteEnabled(true); |
| 29 internals.settings.setSelectTrailingWhitespaceEnabled(false); | 30 internals.settings.setSelectTrailingWhitespaceEnabled(false); |
| 30 internals.settings.setEditingBehavior("win"); | 31 internals.settings.setEditingBehavior("win"); |
| 31 window.destination = document.getElementById(testElementId); | 32 window.destination = document.getElementById(testElementId); |
| 32 window.destination.focus(); | 33 window.destination.focus(); |
| 33 document.execCommand("InsertText", false, testText); | 34 document.execCommand("InsertText", false, testText); |
| 34 window.setTimeout(function() { verifySpellTest(10, opt_doNotFinishTest); },
0); | 35 window.setTimeout(function() { verifySpellTest(10, opt_doNotFinishTest); },
0); |
| 35 } | 36 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 step(); | 79 step(); |
| 79 step_timeout(() => { | 80 step_timeout(() => { |
| 80 test.step(() => assertion()); | 81 test.step(() => assertion()); |
| 81 runNextStep(test, steps, assertions); | 82 runNextStep(test, steps, assertions); |
| 82 }, 50); | 83 }, 50); |
| 83 } | 84 } |
| 84 | 85 |
| 85 function runSpellingTest(steps, assertions, opt_title) | 86 function runSpellingTest(steps, assertions, opt_title) |
| 86 { | 87 { |
| 87 var t = async_test(opt_title); | 88 var t = async_test(opt_title); |
| 88 if (!window.internals) { | 89 if (!window.internals || !window.testRunner) { |
| 89 t.step(() => assert_unreached('internals is required for this test')); | 90 t.step(() => assert_unreached('Incomplete test environment')); |
| 90 t.done(); | 91 t.done(); |
| 91 return; | 92 return; |
| 92 } | 93 } |
| 93 | 94 |
| 95 testRunner.setMockSpellCheckerEnabled(true); |
| 94 runNextStep(t, steps, assertions); | 96 runNextStep(t, steps, assertions); |
| 95 } | 97 } |
| OLD | NEW |