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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/editing/spelling/spelling-huge-text.html
diff --git a/third_party/WebKit/LayoutTests/editing/spelling/spelling-huge-text.html b/third_party/WebKit/LayoutTests/editing/spelling/spelling-huge-text.html
index 6ac7c3dd758049939bafe1370b5e6e007ed34e4d..bba7a6a0f2a0d599d7b01bfe58532699d84fe6fb 100644
--- a/third_party/WebKit/LayoutTests/editing/spelling/spelling-huge-text.html
+++ b/third_party/WebKit/LayoutTests/editing/spelling/spelling-huge-text.html
@@ -1,53 +1,14 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src="../../resources/js-test.js"></script>
-</head>
-<body onload="test();">
-<div id="console"></div>
-<div id="editable" contenteditable></div>
+<!doctype html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../assert_selection.js"></script>
+<script src="spellcheck_test.js"></script>
<script>
-description("Text to check is divided into chunks to make sure checking some huge text " +
-"does not freeze the page/UI. With the asynchronous spell checker the whole text is checked. " +
-"To test manaully trigger spell checking of the editable (e.g. by copy+paste) with unified " +
-"and asynchronous checker on. There should be 6 misspellings marked.");
-
-jsTestIsAsync = true;
-if (window.testRunner)
- testRunner.setMockSpellCheckerEnabled(true);
-
-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.";
-
- var testLongText = "";
- for (var i = 0; i < loopCount; ++i)
- testLongText += longText;
-
- testLongText = "zz zz zz. " + testLongText + " zz zz zz.";
- testEditable.innerText = testLongText;
-
- if (!window.internals) {
- log("Test manually. See the description for steps");
- return;
- }
-
- internals.setSpellCheckingEnabled(false);
- testEditable.focus();
- internals.setSpellCheckingEnabled(true);
- shouldBecomeEqual('internals.markerCountForNode(testEditable.childNodes[0], "spelling")', '6', function() {
- testEditable.removeChild(testEditable.childNodes[0]);
- finishJSTest();
- }, 5000 /* huge text needs more time to be spell checked */);
-}
+const longText = 'Good good good good good good good good good good good good good. '.repeat(600);
+spellcheck_test(
+ `<div contenteditable>zz zz zz. ${longText}zz zz zz.</div>`,
+ document => document.querySelector('div').focus(),
+ `<div contenteditable>#zz# #zz# #zz#. ${longText}#zz# #zz# #zz#.</div>`,
+ 'Spellchecking long text does not freeze the page.');
</script>
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698