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

Unified Diff: LayoutTests/editing/spelling/grammar-edit-word.html

Issue 39733005: Use asynchronous spellcheck path in layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Apply groby's suggestions Created 7 years, 2 months 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: LayoutTests/editing/spelling/grammar-edit-word.html
diff --git a/LayoutTests/editing/spelling/grammar-edit-word.html b/LayoutTests/editing/spelling/grammar-edit-word.html
index eabc97775a83e452b2928ef954c2c8733643c7f9..90a3531708aeda9a3aff4549899f711d834d979a 100644
--- a/LayoutTests/editing/spelling/grammar-edit-word.html
+++ b/LayoutTests/editing/spelling/grammar-edit-word.html
@@ -7,21 +7,33 @@
<body>
<div id="src" contenteditable="true" spellcheck="true"></div><br/>
<script language="javascript">
-description('Test if WebKit removes grammar markers when we edit a grammatically-incorrect word. To test manually, type a grammatically-incorrect sentence "You has the right." and type a backspace key to delete the last character of "has". This test succeeds when "ha" does not have grammar markers.');
+description('Test if WebKit removes grammar markers when we edit a grammatically-incorrect word. '
+ + 'To test manually, type a grammatically-incorrect sentence "You has the right." and type '
+ + 'a backspace key to delete the last character of "has". '
+ + 'This test succeeds when "ha" does not have grammar markers.');
-internals.settings.setUnifiedTextCheckerEnabled(true);
-var target = document.getElementById('src');
-target.focus();
+jsTestIsAsync = true;
+
+if (window.internals) {
+ internals.settings.setUnifiedTextCheckerEnabled(true);
+ internals.settings.setAsynchronousSpellCheckingEnabled(true);
+}
-evalAndLog('document.execCommand("InsertText", false, "You has the right.")');
-shouldBeTrue('internals.hasGrammarMarker(document, 4, 3)');
+function editAndCheckSentence()
+{
+ // Delete the end of this sentence until it becomes "You ha".
+ for (var i = 0; i < 12; ++i)
+ testRunner.execCommand("DeleteBackward");
-debug('Delete the end of this sentence until it becomes "You ha".');
-for (var i = 0; i < 12; ++i)
- evalAndLog('testRunner.execCommand("DeleteBackward")');
-shouldBeFalse('internals.hasGrammarMarker(document, 4, 2)');
+ shouldBecomeEqual('internals.hasGrammarMarker(document, 4, 2)', 'false', finishJSTest);
+}
+
+var target = document.getElementById('src');
+target.focus();
+document.execCommand("InsertText", false, "You has the right.");
-internals.settings.setUnifiedTextCheckerEnabled(false);
+if (window.internals)
+ shouldBecomeEqual('internals.hasGrammarMarker(document, 4, 3)', 'true', editAndCheckSentence);
</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
« no previous file with comments | « LayoutTests/editing/spelling/grammar.html ('k') | LayoutTests/editing/spelling/grammar-edit-word-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698