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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/spelling/spelling-huge-text.html

Issue 2455883003: Convert editing/spelling/spelling-huge-text.html with spellcheck_test (Closed)
Patch Set: Optimize spellcheck_test's handleCharacterData Created 4 years, 1 month 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 <script src="../../resources/testharness.js"></script>
3 <head> 3 <script src="../../resources/testharnessreport.js"></script>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../assert_selection.js"></script>
5 </head> 5 <script src="spellcheck_test.js"></script>
6 <body onload="test();">
7 <div id="console"></div>
8 <div id="editable" contenteditable></div>
9 6
10 <script> 7 <script>
11 description("Text to check is divided into chunks to make sure checking some hug e text " + 8 const longText = 'Good good good good good good good good good good good good go od. '.repeat(600);
12 "does not freeze the page/UI. With the asynchronous spell checker the whole text is checked. " + 9 spellcheck_test(
13 "To test manaully trigger spell checking of the editable (e.g. by copy+paste) wi th unified " + 10 `<div contenteditable>zz zz zz. ${longText}zz zz zz.</div>`,
14 "and asynchronous checker on. There should be 6 misspellings marked."); 11 document => document.querySelector('div').focus(),
15 12 `<div contenteditable>#zz# #zz# #zz#. ${longText}#zz# #zz# #zz#.</div>`,
16 jsTestIsAsync = true; 13 'Spellchecking long text does not freeze the page.');
17 if (window.testRunner)
18 testRunner.setMockSpellCheckerEnabled(true);
19
20 var testEditable = null;
21
22 function test()
23 {
24 testEditable = document.getElementById("editable");
25 var loopCount = 150;
26 var longText = "Good good good good good good good good good good good good good. " +
27 "Good good good good good good good good good good good good good. " +
28 "Good good good good good good good good good good good good good. " +
29 "Good good good good good good good good good good good good good.";
30
31 var testLongText = "";
32 for (var i = 0; i < loopCount; ++i)
33 testLongText += longText;
34
35 testLongText = "zz zz zz. " + testLongText + " zz zz zz.";
36 testEditable.innerText = testLongText;
37
38 if (!window.internals) {
39 log("Test manually. See the description for steps");
40 return;
41 }
42
43 internals.setSpellCheckingEnabled(false);
44 testEditable.focus();
45 internals.setSpellCheckingEnabled(true);
46 shouldBecomeEqual('internals.markerCountForNode(testEditable.childNodes[0], "spelling")', '6', function() {
47 testEditable.removeChild(testEditable.childNodes[0]);
48 finishJSTest();
49 }, 5000 /* huge text needs more time to be spell checked */);
50 }
51 </script> 14 </script>
52 </body>
53 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698