<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[162194] trunk/LayoutTests</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/162194">162194</a></dd>
<dt>Author</dt> <dd>g.czajkowski@samsung.com</dd>
<dt>Date</dt> <dd>2014-01-17 01:18:58 -0800 (Fri, 17 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Allow grammar checking tests to be able to run asynchronously
https://bugs.webkit.org/show_bug.cgi?id=127099

Reviewed by Ryosuke Niwa.

Some grammar checking tests have already used asynchronous text checking path.
Due to WebKit tends to use asynchronous spell checking, this patch adapts grammar
checking tests that used synchronous path to be able to run asynchronously.

Additionally, the tests description was fixed.

* editing/spelling/grammar-edit-word-expected.txt:
* editing/spelling/grammar-edit-word.html:
* editing/spelling/grammar-expected.txt:
* editing/spelling/grammar-markers.html:
* editing/spelling/grammar.html:
* editing/spelling/markers-expected.txt:
* editing/spelling/markers.html:

* platform/mac-wk2/TestExpectations:
Marking markers.html as failing for mac-wk2 due to bug 125690.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestseditingspellinggrammareditwordexpectedtxt">trunk/LayoutTests/editing/spelling/grammar-edit-word-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingspellinggrammareditwordhtml">trunk/LayoutTests/editing/spelling/grammar-edit-word.html</a></li>
<li><a href="#trunkLayoutTestseditingspellinggrammarexpectedtxt">trunk/LayoutTests/editing/spelling/grammar-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingspellinggrammarmarkershtml">trunk/LayoutTests/editing/spelling/grammar-markers.html</a></li>
<li><a href="#trunkLayoutTestseditingspellinggrammarhtml">trunk/LayoutTests/editing/spelling/grammar.html</a></li>
<li><a href="#trunkLayoutTestseditingspellingmarkersexpectedtxt">trunk/LayoutTests/editing/spelling/markers-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingspellingmarkershtml">trunk/LayoutTests/editing/spelling/markers.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2TestExpectations">trunk/LayoutTests/platform/mac-wk2/TestExpectations</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (162193 => 162194)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-01-17 09:15:19 UTC (rev 162193)
+++ trunk/LayoutTests/ChangeLog        2014-01-17 09:18:58 UTC (rev 162194)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2014-01-17  Grzegorz Czajkowski  &lt;g.czajkowski@samsung.com&gt;
+
+        Allow grammar checking tests to be able to run asynchronously
+        https://bugs.webkit.org/show_bug.cgi?id=127099
+
+        Reviewed by Ryosuke Niwa.
+
+        Some grammar checking tests have already used asynchronous text checking path.
+        Due to WebKit tends to use asynchronous spell checking, this patch adapts grammar
+        checking tests that used synchronous path to be able to run asynchronously.
+
+        Additionally, the tests description was fixed.
+
+        * editing/spelling/grammar-edit-word-expected.txt:
+        * editing/spelling/grammar-edit-word.html:
+        * editing/spelling/grammar-expected.txt:
+        * editing/spelling/grammar-markers.html:
+        * editing/spelling/grammar.html:
+        * editing/spelling/markers-expected.txt:
+        * editing/spelling/markers.html:
+
+        * platform/mac-wk2/TestExpectations:
+        Marking markers.html as failing for mac-wk2 due to bug 125690.
+
</ins><span class="cx"> 2014-01-16  Jer Noble  &lt;jer.noble@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r162145): media/video-controls-visible-audio-only.html fails
</span></span></pre></div>
<a id="trunkLayoutTestseditingspellinggrammareditwordexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/spelling/grammar-edit-word-expected.txt (162193 => 162194)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/spelling/grammar-edit-word-expected.txt        2014-01-17 09:15:19 UTC (rev 162193)
+++ trunk/LayoutTests/editing/spelling/grammar-edit-word-expected.txt        2014-01-17 09:18:58 UTC (rev 162194)
</span><span class="lines">@@ -1,10 +1,10 @@
</span><del>-Test if WebKit removes grammar markers when we edit a grammatically-incorrect word. To test manually, type a grammatically-incorrect sentence &quot;You has the right.&quot; and type a backspace key to delete the last character of &quot;has&quot;. This test succeeds when &quot;ha&quot; does not have grammar markers.
</del><ins>+Test if WebKit removes grammar markers when we edit a grammatically-incorrect word. To test manually, press backspace key to delete the last character of &quot;has&quot;. This test succeeds when &quot;ha&quot; does not have grammar markers.
</ins><span class="cx"> 
</span><span class="cx"> On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> document.execCommand(&quot;InsertText&quot;, false, &quot;You has the right.&quot;)
</span><del>-PASS internals.hasGrammarMarker(4, 3) is true
</del><ins>+PASS internals.hasGrammarMarker(4, 3) became true
</ins><span class="cx"> Delete the end of this sentence until it becomes &quot;You ha&quot;.
</span><span class="cx"> testRunner.execCommand(&quot;DeleteBackward&quot;)
</span><span class="cx"> testRunner.execCommand(&quot;DeleteBackward&quot;)
</span><span class="lines">@@ -18,7 +18,7 @@
</span><span class="cx"> testRunner.execCommand(&quot;DeleteBackward&quot;)
</span><span class="cx"> testRunner.execCommand(&quot;DeleteBackward&quot;)
</span><span class="cx"> testRunner.execCommand(&quot;DeleteBackward&quot;)
</span><del>-PASS internals.hasGrammarMarker(4, 2) is false
</del><ins>+PASS internals.hasGrammarMarker(4, 2) became false
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestseditingspellinggrammareditwordhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/spelling/grammar-edit-word.html (162193 => 162194)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/spelling/grammar-edit-word.html        2014-01-17 09:15:19 UTC (rev 162193)
+++ trunk/LayoutTests/editing/spelling/grammar-edit-word.html        2014-01-17 09:18:58 UTC (rev 162194)
</span><span class="lines">@@ -1,27 +1,38 @@
</span><span class="cx"> &lt;!DOCTYPE html&gt;
</span><span class="cx"> &lt;html&gt;
</span><span class="cx"> &lt;head&gt;
</span><del>-&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
</del><span class="cx"> &lt;title&gt;Editing a grammatically-incorrect word&lt;/title&gt; 
</span><span class="cx"> &lt;/head&gt; 
</span><span class="cx"> &lt;body&gt;
</span><ins>+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx"> &lt;div id=&quot;src&quot; contenteditable=&quot;true&quot; spellcheck=&quot;true&quot;&gt;&lt;/div&gt;&lt;br/&gt;
</span><span class="cx"> &lt;script language=&quot;javascript&quot;&gt;
</span><del>-description('Test if WebKit removes grammar markers when we edit a grammatically-incorrect word. To test manually, type a grammatically-incorrect sentence &quot;You has the right.&quot; and type a backspace key to delete the last character of &quot;has&quot;. This test succeeds when &quot;ha&quot; does not have grammar markers.');
</del><ins>+description('Test if WebKit removes grammar markers when we edit a grammatically-incorrect word. '
+    + 'To test manually, press backspace key to delete the last character of &quot;has&quot;. '
+    + 'This test succeeds when &quot;ha&quot; does not have grammar markers.');
</ins><span class="cx"> 
</span><del>-internals.settings.setUnifiedTextCheckerEnabled(true);
</del><ins>+jsTestIsAsync = true;
+
+if (window.internals) {
+    internals.settings.setUnifiedTextCheckerEnabled(true);
+    internals.settings.setAsynchronousSpellCheckingEnabled(true);
+}
+
+function editSentenceAndCheckMarker()
+{
+    debug('Delete the end of this sentence until it becomes &quot;You ha&quot;.');
+    for (var i = 0; i &lt; 12; ++i)
+        evalAndLog('testRunner.execCommand(&quot;DeleteBackward&quot;)');
+
+    shouldBecomeEqual('internals.hasGrammarMarker(4, 2)', 'false', finishJSTest);
+}
+
</ins><span class="cx"> var target = document.getElementById('src');
</span><span class="cx"> target.focus();
</span><del>-
</del><span class="cx"> evalAndLog('document.execCommand(&quot;InsertText&quot;, false, &quot;You has the right.&quot;)');
</span><del>-shouldBeTrue('internals.hasGrammarMarker(4, 3)');
</del><span class="cx"> 
</span><del>-debug('Delete the end of this sentence until it becomes &quot;You ha&quot;.');
-for (var i = 0; i &lt; 12; ++i)
-    evalAndLog('testRunner.execCommand(&quot;DeleteBackward&quot;)');
-shouldBeFalse('internals.hasGrammarMarker(4, 2)');
-
-internals.settings.setUnifiedTextCheckerEnabled(false);
</del><ins>+if (window.internals)
+    shouldBecomeEqual('internals.hasGrammarMarker(4, 3)', 'true', editSentenceAndCheckMarker);
</ins><span class="cx"> &lt;/script&gt;
</span><span class="cx"> &lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</span><span class="cx"> &lt;/body&gt;
</span></span></pre></div>
<a id="trunkLayoutTestseditingspellinggrammarexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/spelling/grammar-expected.txt (162193 => 162194)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/spelling/grammar-expected.txt        2014-01-17 09:15:19 UTC (rev 162193)
+++ trunk/LayoutTests/editing/spelling/grammar-expected.txt        2014-01-17 09:18:58 UTC (rev 162194)
</span><span class="lines">@@ -1,3 +1,10 @@
</span><del>-You should see the text 'I have a issue'. 'a' should have a grammar suggestion marking.
-PASS
</del><ins>+This tests whether the grammatically-incorrect phrase 'I have a issue' has grammar marker on 'a'.
</ins><span class="cx"> 
</span><ins>+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS internals.hasGrammarMarker(7, 1) became true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestseditingspellinggrammarmarkershtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/spelling/grammar-markers.html (162193 => 162194)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/spelling/grammar-markers.html        2014-01-17 09:15:19 UTC (rev 162193)
+++ trunk/LayoutTests/editing/spelling/grammar-markers.html        2014-01-17 09:18:58 UTC (rev 162194)
</span><span class="lines">@@ -1,9 +1,7 @@
</span><span class="cx"> &lt;!DOCTYPE html&gt;
</span><span class="cx"> &lt;html&gt;
</span><del>-&lt;head&gt;
-&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
-&lt;/head&gt;
</del><span class="cx"> &lt;body&gt;
</span><ins>+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx"> &lt;div id=&quot;source&quot; contenteditable=&quot;true&quot; spellcheck=&quot;false&quot;&gt;You has the right.&lt;/div&gt;
</span><span class="cx"> &lt;div id=&quot;target&quot; contenteditable=&quot;true&quot; spellcheck=&quot;true&quot;&gt;&lt;/div&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestseditingspellinggrammarhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/spelling/grammar.html (162193 => 162194)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/spelling/grammar.html        2014-01-17 09:15:19 UTC (rev 162193)
+++ trunk/LayoutTests/editing/spelling/grammar.html        2014-01-17 09:18:58 UTC (rev 162194)
</span><span class="lines">@@ -11,24 +11,15 @@
</span><span class="cx"> &lt;script src=../editing.js language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot; &gt;&lt;/script&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;script&gt;
</span><del>-function log(msg) {
-    document.getElementById(&quot;console&quot;).innerHTML += (msg + &quot;\n&quot;);
-}
-
</del><span class="cx"> function editingTest() {
</span><del>-    if (window.testRunner)
-        testRunner.dumpAsText();
-
</del><span class="cx">     document.getElementById(&quot;root&quot;).focus();
</span><del>-    
</del><span class="cx">     document.execCommand(&quot;InsertText&quot;, false, &quot;I have a issue.&quot;);
</span><span class="cx"> 
</span><del>-    if (window.testRunner) {
-        if (internals.hasGrammarMarker(7, 1))
-            log(&quot;PASS&quot;);
-        else
-            log(&quot;FAIL&quot;);
-        document.getElementById(&quot;root&quot;).style.display = &quot;none&quot;;
</del><ins>+    if (window.internals) {
+        shouldBecomeEqual('internals.hasGrammarMarker(7, 1)', 'true', function() {
+            document.getElementById(&quot;root&quot;).style.display = &quot;none&quot;;
+            finishJSTest();
+        });
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -37,13 +28,22 @@
</span><span class="cx"> &lt;title&gt;Editing Test&lt;/title&gt; 
</span><span class="cx"> &lt;/head&gt; 
</span><span class="cx"> &lt;body&gt;
</span><del>-&lt;div&gt;You should see the text 'I have a issue'. 'a' should have a grammar suggestion marking.&lt;/div&gt;
-&lt;div contenteditable id=&quot;root&quot; class=&quot;editing&quot;&gt;
-&lt;/div&gt;
-&lt;pre id=&quot;console&quot;&gt;&lt;/pre&gt;
</del><ins>+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;div contenteditable id=&quot;root&quot; class=&quot;editing&quot;&gt;&lt;/div&gt;
</ins><span class="cx"> &lt;script&gt;
</span><ins>+description(&quot;This tests whether the grammatically-incorrect phrase &quot;
+    + &quot;'I have a issue' has grammar marker on 'a'.&quot;);
+
+jsTestIsAsync = true;
+
+if (window.internals) {
+    internals.settings.setUnifiedTextCheckerEnabled(true);
+    internals.settings.setAsynchronousSpellCheckingEnabled(true);
+}
+
</ins><span class="cx"> editingTest();
</span><span class="cx"> &lt;/script&gt;
</span><span class="cx"> 
</span><ins>+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx"> &lt;/body&gt;
</span><span class="cx"> &lt;/html&gt;
</span></span></pre></div>
<a id="trunkLayoutTestseditingspellingmarkersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/spelling/markers-expected.txt (162193 => 162194)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/spelling/markers-expected.txt        2014-01-17 09:15:19 UTC (rev 162193)
+++ trunk/LayoutTests/editing/spelling/markers-expected.txt        2014-01-17 09:18:58 UTC (rev 162194)
</span><span class="lines">@@ -1,16 +1,30 @@
</span><del>-Grammar Error Only
-PASS internals.markerCountForNode(e.firstChild, &quot;spelling&quot;) is 0
-PASS internals.markerCountForNode(e.firstChild, &quot;grammar&quot;) is 1
</del><ins>+Tests spelling and grammar markers for misspellings.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Checking grammar issue on 'I have a issue.'
+PASS internals.markerRangeForNode(element.firstChild, nextMisspellingData.marker, 0) became different from null
</ins><span class="cx"> PASS range.toString() is &quot;a&quot;
</span><del>-Spelling Error Only
-PASS internals.markerCountForNode(e.firstChild, &quot;spelling&quot;) is 1
</del><ins>+
+Checking spelling issue on 'zz.'
+PASS internals.markerRangeForNode(element.firstChild, nextMisspellingData.marker, 0) became different from null
</ins><span class="cx"> PASS range.toString() is &quot;zz&quot;
</span><del>-PASS internals.markerCountForNode(e.firstChild, &quot;grammar&quot;) is 0
-Grammar and Spelling Error
-PASS internals.markerCountForNode(e.firstChild, &quot;spelling&quot;) is 1
</del><ins>+
+Checking spelling issue on 'orange,zz,apple.'
+PASS internals.markerRangeForNode(element.firstChild, nextMisspellingData.marker, 0) became different from null
</ins><span class="cx"> PASS range.toString() is &quot;zz&quot;
</span><del>-PASS internals.markerCountForNode(e.firstChild, &quot;grammar&quot;) is 1
</del><ins>+
+Checking grammar issue on 'orange,zz,apple.'
+PASS internals.markerRangeForNode(element.firstChild, nextMisspellingData.marker, 0) became different from null
</ins><span class="cx"> PASS range.toString() is &quot;orange,zz,apple.&quot;
</span><ins>+
+Checking spelling issue on 'I have a issue.'
+PASS internals.markerCountForNode(element.firstChild, oppositeMarker) became 0
+
+Checking grammar issue on 'zz.'
+PASS internals.markerCountForNode(element.firstChild, oppositeMarker) became 0
+
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestseditingspellingmarkershtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/spelling/markers.html (162193 => 162194)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/spelling/markers.html        2014-01-17 09:15:19 UTC (rev 162193)
+++ trunk/LayoutTests/editing/spelling/markers.html        2014-01-17 09:18:58 UTC (rev 162194)
</span><span class="lines">@@ -9,23 +9,26 @@
</span><span class="cx"> }
</span><span class="cx"> &lt;/style&gt;
</span><span class="cx"> &lt;script src=&quot;../editing.js&quot; language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot; &gt;&lt;/script&gt;
</span><del>-&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
</del><span class="cx"> &lt;/head&gt;
</span><span class="cx"> &lt;body&gt;
</span><del>-&lt;pre id=&quot;description&quot;&gt;&lt;/pre&gt;
-&lt;pre id=&quot;console&quot;&gt;&lt;/pre&gt;
-&lt;div id=&quot;container&quot;&gt;
-&lt;/div&gt;
</del><ins>+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx"> 
</span><ins>+&lt;div id=&quot;container&quot;&gt;&lt;/div&gt;
+
</ins><span class="cx"> &lt;script&gt;
</span><del>-if (window.testRunner)
-    testRunner.dumpAsText();
</del><ins>+description(&quot;Tests spelling and grammar markers for misspellings.&quot;);
</ins><span class="cx"> 
</span><del>-function createEditableElement(id, parent) {
</del><ins>+jsTestIsAsync = true;
+
+if (window.internals) {
+    internals.settings.setUnifiedTextCheckerEnabled(true);
+    internals.settings.setAsynchronousSpellCheckingEnabled(true);
+}
+
+function createEditableElement(parent) {
</ins><span class="cx">     var e = document.createElement('div');
</span><span class="cx">     e.setAttribute(&quot;contentEditable&quot;, &quot;true&quot;);
</span><span class="cx">     e.className = 'editing';
</span><del>-    e.id = id;
</del><span class="cx"> 
</span><span class="cx">     parent.appendChild(e);
</span><span class="cx">     return e;
</span><span class="lines">@@ -33,50 +36,88 @@
</span><span class="cx"> 
</span><span class="cx"> function typeText(elem, text) {
</span><span class="cx">     elem.focus();
</span><del>-    for (var i = 0; i &lt; text.length; ++i) {
</del><ins>+    for (var i = 0; i &lt; text.length; ++i)
</ins><span class="cx">         typeCharacterCommand(text[i]);
</span><del>-    }
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> var container = document.getElementById('container');
</span><del>-var range;
</del><span class="cx"> 
</span><del>-debug(&quot;Grammar Error Only&quot;);
-var id = 'id1'
-var e = createEditableElement(id, container);
-typeText(e, 'I have a issue.');
-if (window.internals) {
-    shouldBe('internals.markerCountForNode(e.firstChild, &quot;spelling&quot;)', '0');
-    shouldBe('internals.markerCountForNode(e.firstChild, &quot;grammar&quot;)', '1');
-    range = internals.markerRangeForNode(e.firstChild, &quot;grammar&quot;, 0);
-    shouldBe(&quot;range.toString()&quot;, '&quot;a&quot;');
</del><ins>+var elementWithGrammarIssue = createEditableElement(container);
+typeText(elementWithGrammarIssue, 'I have a issue.');
+
+var elementWithSpellingIssue  = createEditableElement(container);
+typeText(elementWithSpellingIssue, 'zz.');
+
+var elementWithGrammarAndSpellingIssue = createEditableElement(container);
+typeText(elementWithGrammarAndSpellingIssue, 'orange,zz,apple.');
+
+var misspellings = [
+    { marker:'grammar',  issue:'a' },
+    { marker:'spelling', issue:'zz' },
+    { marker:'grammar',  issue:'orange,zz,apple.' }
+];
+
+var tests = [
+    function() { verifyDesiredMarkers(elementWithGrammarIssue, misspellings.slice(0, 1)) },
+    function() { verifyDesiredMarkers(elementWithSpellingIssue, misspellings.slice(1, 2)) },
+    function() { verifyDesiredMarkers(elementWithGrammarAndSpellingIssue, misspellings.slice(1, 3)) },
+
+    // Those expect to have only one kind of markers either spelling or grammar.
+    function() { verifyUnexpectedMarkers(elementWithGrammarIssue, misspellings.slice(0, 1)) },
+    function() { verifyUnexpectedMarkers(elementWithSpellingIssue, misspellings.slice(1, 2)) },
+];
+
+var element;
+var nextMisspellingData;
+
+function verifyDesiredMarkers(e, misspellings)
+{
+    if (!window.internals)
+        return done();
+
+    element = e;
+    nextMisspellingData = misspellings.shift();
+    if (!nextMisspellingData)
+        return done();
+
+    debug(&quot;Checking &quot; + nextMisspellingData.marker + &quot; issue on '&quot; + element.firstChild.nodeValue + &quot;'&quot;);
+
+    shouldBecomeDifferent('internals.markerRangeForNode(element.firstChild, nextMisspellingData.marker, 0)', &quot;null&quot;, function() {
+        range = internals.markerRangeForNode(element.firstChild, nextMisspellingData.marker, 0);
+        shouldBeEqualToString('range.toString()', nextMisspellingData.issue);
+        debug(&quot;&quot;);
+        verifyDesiredMarkers(element, misspellings);
+    });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-debug(&quot;Spelling Error Only&quot;);
-var id = 'id2'
-var e = createEditableElement(id, container);
-typeText(e, 'zz.');
-if (window.internals) {
-    shouldBe('internals.markerCountForNode(e.firstChild, &quot;spelling&quot;)', '1');
-    range = internals.markerRangeForNode(e.firstChild, &quot;spelling&quot;, 0);
-    shouldBe('range.toString()', '&quot;zz&quot;');
-    shouldBe('internals.markerCountForNode(e.firstChild, &quot;grammar&quot;)', '0');
</del><ins>+var oppositeMarker;
+function verifyUnexpectedMarkers(e, misspellings)
+{
+    element = e;
+    nextMisspellingData = misspellings.shift();
+
+    if (nextMisspellingData.marker == 'grammar')
+        oppositeMarker = 'spelling';
+    else if (nextMisspellingData.marker == 'spelling')
+        oppositeMarker = 'grammar';
+
+    debug(&quot;Checking &quot; + oppositeMarker + &quot; issue on '&quot; + element.firstChild.nodeValue + &quot;'&quot;);
+
+    shouldBecomeEqual('internals.markerCountForNode(element.firstChild, oppositeMarker)', '0', function() {
+        debug(&quot;&quot;);
+        done();
+    });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-debug(&quot;Grammar and Spelling Error&quot;);
-var id = 'id3'
-var e = createEditableElement(id, container);
-typeText(e, 'orange,zz,apple.');
-if (window.internals) {
-    shouldBe('internals.markerCountForNode(e.firstChild, &quot;spelling&quot;)', '1');
-    range = internals.markerRangeForNode(e.firstChild, &quot;spelling&quot;, 0);
-    shouldBe('range.toString()', '&quot;zz&quot;');
-    shouldBe('internals.markerCountForNode(e.firstChild, &quot;grammar&quot;)', '1');
-    range = internals.markerRangeForNode(e.firstChild, &quot;grammar&quot;, 0);
-    shouldBe('range.toString()', '&quot;orange,zz,apple.&quot;');
</del><ins>+function done()
+{
+    var next = tests.shift();
+    if (next)
+        return window.setTimeout(next, 0);
+
+    finishJSTest();
</ins><span class="cx"> }
</span><del>-
-var successfullyParsed = true;
</del><ins>+done();
</ins><span class="cx"> &lt;/script&gt;
</span><span class="cx"> &lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</span><span class="cx"> &lt;/body&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (162193 => 162194)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/TestExpectations        2014-01-17 09:15:19 UTC (rev 162193)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations        2014-01-17 09:18:58 UTC (rev 162194)
</span><span class="lines">@@ -134,6 +134,7 @@
</span><span class="cx"> webkit.org/b/105616 editing/spelling/spelling-with-whitespace-selection.html
</span><span class="cx"> webkit.org/b/105616 editing/spelling/spellcheck-input-search-crash.html
</span><span class="cx"> webkit.org/b/105616 editing/spelling/grammar.html
</span><ins>+webkit.org/b/105616 editing/spelling/markers.html
</ins><span class="cx"> webkit.org/b/105616 platform/mac/editing/spelling/removing-underline-after-accepting-autocorrection-using-punctuation.html [ Failure ]
</span><span class="cx"> webkit.org/b/105616 platform/mac/editing/spelling/click-autocorrected-word.html
</span><span class="cx"> webkit.org/b/105616 platform/mac/editing/spelling/move-cursor-to-beginning-of-autocorrected-word.html
</span></span></pre>
</div>
</div>

</body>
</html>