Chromium Code Reviews| Index: LayoutTests/editing/spelling/spelling-huge-text.html |
| diff --git a/LayoutTests/editing/spelling/spelling-huge-text.html b/LayoutTests/editing/spelling/spelling-huge-text.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4e91b39d87c9b9648a8efb2bf8d24b74ed9de9f0 |
| --- /dev/null |
| +++ b/LayoutTests/editing/spelling/spelling-huge-text.html |
| @@ -0,0 +1,62 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<script src="../../fast/js/resources/js-test-pre.js"></script> |
| +</head> |
| +<body onload="test();"> |
| +<div id="console"></div> |
| +<div id="editable" contenteditable></div> |
| + |
| +<script> |
| +description("With the asynchronous spell checking text to check if divided into chunks. " + |
| +"This makes sure some huge text is entirely checked and it does not freeze the page. " + |
| +"To test manaully trigger spell checking of the editable (e.g. by copy+paste) with unified " + |
| +"and asynchronous spell checking on. The last misspelled word should be marked."); |
| + |
| +var testEditable = null; |
| + |
| +function test() |
| +{ |
| + testEditable = document.getElementById("editable"); |
| + var loopCount = 150; |
| + var longText = "good good good good good good good good good good good good good. " + |
| + "good good good good good good good good good good good good good. " + |
| + "good good good good good good good good good good good good good. " + |
| + "good good good good good good good good good good good good good."; |
| + testEditable.focus(); |
| + for (var i = 0; i < loopCount; ++i) |
| + testEditable.innerText += longText; |
| + testEditable.innerText += " zz." |
| + |
| + if (!window.internals) { |
| + log("Test manually. See the description for steps"); |
| + return; |
| + } |
| + |
| + internals.settings.setUnifiedTextCheckerEnabled(true); |
| + internals.settings.setAsynchronousSpellCheckingEnabled(true); |
| + |
| + function waitForMarkersToAppear(node, nretry) |
| + { |
| + if (nretry && !internals.markerCountForNode(node, "spelling")) { |
| + window.setTimeout(function() { waitForMarkersToAppear(node, nretry - 1); }, 1000); |
|
tony
2013/08/13 22:06:15
Tests should finish quickly. We shouldn't be wait
|
| + } else { |
| + shouldBe('internals.markerCountForNode(testEditable.childNodes[0], "spelling")', '1'); |
| + if (window.testRunner) |
| + testRunner.notifyDone(); |
| + } |
| + } |
| + |
| + if (window.testRunner) { |
| + testRunner.dumpAsText(); |
| + testRunner.waitUntilDone(); |
| + } |
| + |
| + internals.setContinuousSpellCheckingEnabled(false); |
| + internals.setContinuousSpellCheckingEnabled(true); |
| + waitForMarkersToAppear(testEditable.childNodes[0], 10); |
| +} |
| +</script> |
| +<script src="../../fast/js/resources/js-test-post.js"></script> |
| +</body> |
| +</html> |