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

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: 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..957576cd14243bbedb3c243cd8bac1490f21bf93 100644
--- a/LayoutTests/editing/spelling/grammar-edit-word.html
+++ b/LayoutTests/editing/spelling/grammar-edit-word.html
@@ -7,19 +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.');
+
+jsTestIsAsync = true;
+
+if (window.internals) {
+ internals.settings.setUnifiedTextCheckerEnabled(true);
+ internals.settings.setAsynchronousSpellCheckingEnabled(true);
+}
+
+function editAndCheckSentence()
+{
+ // Delete the end of this sentence until it becomes "You ha".
+ for (var i = 0; i < 12; ++i)
+ testRunner.execCommand("DeleteBackward");
+
+ shouldBecomeEqual('internals.hasGrammarMarker(document, 4, 2)', 'false', finishJSTest);
+}
-internals.settings.setUnifiedTextCheckerEnabled(true);
var target = document.getElementById('src');
target.focus();
+document.execCommand("InsertText", false, "You has the right.");
-evalAndLog('document.execCommand("InsertText", false, "You has the right.")');
-shouldBeTrue('internals.hasGrammarMarker(document, 4, 3)');
-
-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)');
+if (window.internals)
+ shouldBecomeEqual('internals.hasGrammarMarker(document, 4, 3)', 'true', editAndCheckSentence);
internals.settings.setUnifiedTextCheckerEnabled(false);
groby-ooo-7-16 2013/10/24 16:47:49 Is that actually needed? I don't think there's a p
grzegorz 2013/10/25 09:41:08 Done.
</script>

Powered by Google App Engine
This is Rietveld 408576698