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> |