WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-127099-20140116130044.patch (text/plain), 16.04 KB, created by
Grzegorz Czajkowski
on 2014-01-16 04:00:47 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Grzegorz Czajkowski
Created:
2014-01-16 04:00:47 PST
Size:
16.04 KB
patch
obsolete
>Subversion Revision: 162122 >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index c2ea5fe5576cf2072b8542f441ff8cf22c0d92d7..c9daac5c35f3c72759aea621b9bcfc15bffcd89d 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,24 @@ >+2014-01-16 Grzegorz Czajkowski <g.czajkowski@samsung.com> >+ >+ Allow grammar checking tests to be able to run asynchronously >+ https://bugs.webkit.org/show_bug.cgi?id=127099 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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 were 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: >+ > 2014-01-15 Mihnea Ovidenie <mihnea@adobe.com> > > [CSS Regions] Enable accelerated compositing for fixed elements in named flows >diff --git a/LayoutTests/editing/spelling/grammar-edit-word-expected.txt b/LayoutTests/editing/spelling/grammar-edit-word-expected.txt >index 38359fa989db1743a8182348b91542d97ccb071f..f7fce8e43dd697e941d3c478311744fdcbeed081 100644 >--- a/LayoutTests/editing/spelling/grammar-edit-word-expected.txt >+++ b/LayoutTests/editing/spelling/grammar-edit-word-expected.txt >@@ -1,10 +1,10 @@ >-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. >+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 "has". This test succeeds when "ha" does not have grammar markers. > > On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". > > > document.execCommand("InsertText", false, "You has the right.") >-PASS internals.hasGrammarMarker(4, 3) is true >+PASS internals.hasGrammarMarker(4, 3) became true > Delete the end of this sentence until it becomes "You ha". > testRunner.execCommand("DeleteBackward") > testRunner.execCommand("DeleteBackward") >@@ -18,7 +18,7 @@ testRunner.execCommand("DeleteBackward") > testRunner.execCommand("DeleteBackward") > testRunner.execCommand("DeleteBackward") > testRunner.execCommand("DeleteBackward") >-PASS internals.hasGrammarMarker(4, 2) is false >+PASS internals.hasGrammarMarker(4, 2) became false > PASS successfullyParsed is true > > TEST COMPLETE >diff --git a/LayoutTests/editing/spelling/grammar-edit-word.html b/LayoutTests/editing/spelling/grammar-edit-word.html >index 27424c5275264a08144d8e6cb762fd584fc44f71..ebfe276a101b63bf3e43a4258aa9896398e7a1f1 100644 >--- a/LayoutTests/editing/spelling/grammar-edit-word.html >+++ b/LayoutTests/editing/spelling/grammar-edit-word.html >@@ -1,27 +1,38 @@ > <!DOCTYPE html> > <html> > <head> >-<script src="../../resources/js-test-pre.js"></script> > <title>Editing a grammatically-incorrect word</title> > </head> > <body> >+<script src="../../resources/js-test-pre.js"></script> > <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, press 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 editSentenceAndCheckMarker() >+{ >+ debug('Delete the end of this sentence until it becomes "You ha".'); >+ for (var i = 0; i < 12; ++i) >+ evalAndLog('testRunner.execCommand("DeleteBackward")'); >+ >+ shouldBecomeEqual('internals.hasGrammarMarker(4, 2)', 'false', finishJSTest); >+} > >-internals.settings.setUnifiedTextCheckerEnabled(true); > var target = document.getElementById('src'); > target.focus(); >- > evalAndLog('document.execCommand("InsertText", false, "You has the right.")'); >-shouldBeTrue('internals.hasGrammarMarker(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(4, 2)'); > >-internals.settings.setUnifiedTextCheckerEnabled(false); >+if (window.internals) >+ shouldBecomeEqual('internals.hasGrammarMarker(4, 3)', 'true', editSentenceAndCheckMarker); > </script> > <script src="../../resources/js-test-post.js"></script> > </body> >diff --git a/LayoutTests/editing/spelling/grammar-expected.txt b/LayoutTests/editing/spelling/grammar-expected.txt >index 909577603aa5eba1c59f7aa02ce0d622b330f20d..45ac72175fd6ea4cb8cb66fa86a58bb6c3854d71 100644 >--- a/LayoutTests/editing/spelling/grammar-expected.txt >+++ b/LayoutTests/editing/spelling/grammar-expected.txt >@@ -1,3 +1,10 @@ >-You should see the text 'I have a issue'. 'a' should have a grammar suggestion marking. >-PASS >+This tests whether the grammatically-incorrect phrase 'I have a issue' has grammar marker on 'a'. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS internals.hasGrammarMarker(7, 1) became true >+PASS successfullyParsed is true >+ >+TEST COMPLETE > >diff --git a/LayoutTests/editing/spelling/grammar-markers.html b/LayoutTests/editing/spelling/grammar-markers.html >index 7ca999fb0f97703d4b57a3e4e3b0fe63541d9752..ab30cc82e155a9e058df603d3b1c5a60390b8a46 100644 >--- a/LayoutTests/editing/spelling/grammar-markers.html >+++ b/LayoutTests/editing/spelling/grammar-markers.html >@@ -1,9 +1,7 @@ > <!DOCTYPE html> > <html> >-<head> >-<script src="../../resources/js-test-pre.js"></script> >-</head> > <body> >+<script src="../../resources/js-test-pre.js"></script> > <div id="source" contenteditable="true" spellcheck="false">You has the right.</div> > <div id="target" contenteditable="true" spellcheck="true"></div> > >diff --git a/LayoutTests/editing/spelling/grammar.html b/LayoutTests/editing/spelling/grammar.html >index 953499becdf8ed087430ffa0c428002f90219d95..f583b6b2985b9cb1d24d1f14cac70016ea38fa51 100644 >--- a/LayoutTests/editing/spelling/grammar.html >+++ b/LayoutTests/editing/spelling/grammar.html >@@ -11,24 +11,15 @@ > <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script> > > <script> >-function log(msg) { >- document.getElementById("console").innerHTML += (msg + "\n"); >-} >- > function editingTest() { >- if (window.testRunner) >- testRunner.dumpAsText(); >- > document.getElementById("root").focus(); >- > document.execCommand("InsertText", false, "I have a issue."); > >- if (window.testRunner) { >- if (internals.hasGrammarMarker(7, 1)) >- log("PASS"); >- else >- log("FAIL"); >- document.getElementById("root").style.display = "none"; >+ if (window.internals) { >+ shouldBecomeEqual('internals.hasGrammarMarker(7, 1)', 'true', function() { >+ document.getElementById("root").style.display = "none"; >+ finishJSTest(); >+ }); > } > } > >@@ -37,13 +28,22 @@ function editingTest() { > <title>Editing Test</title> > </head> > <body> >-<div>You should see the text 'I have a issue'. 'a' should have a grammar suggestion marking.</div> >-<div contenteditable id="root" class="editing"> >-</div> >-<pre id="console"></pre> >+<script src="../../resources/js-test-pre.js"></script> >+<div contenteditable id="root" class="editing"></div> > <script> >+description("This tests whether the grammatically-incorrect phrase " >+ + "'I have a issue' has grammar marker on 'a'."); >+ >+jsTestIsAsync = true; >+ >+if (window.internals) { >+ internals.settings.setUnifiedTextCheckerEnabled(true); >+ internals.settings.setAsynchronousSpellCheckingEnabled(true); >+} >+ > editingTest(); > </script> > >+<script src="../../resources/js-test-post.js"></script> > </body> > </html> >diff --git a/LayoutTests/editing/spelling/markers-expected.txt b/LayoutTests/editing/spelling/markers-expected.txt >index 69cf180ea8379ff7f6fcc6fb52f50701bf00c2a0..c1bc16ae0f4f3a0f5609a52a680a184aed53f87d 100644 >--- a/LayoutTests/editing/spelling/markers-expected.txt >+++ b/LayoutTests/editing/spelling/markers-expected.txt >@@ -1,16 +1,30 @@ >-Grammar Error Only >-PASS internals.markerCountForNode(e.firstChild, "spelling") is 0 >-PASS internals.markerCountForNode(e.firstChild, "grammar") is 1 >+Tests spelling and grammar markers for misspellings. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+Checking grammar issue on 'I have a issue.' >+PASS internals.markerRangeForNode(element.firstChild, nextMisspellingData.marker, 0) became different from null > PASS range.toString() is "a" >-Spelling Error Only >-PASS internals.markerCountForNode(e.firstChild, "spelling") is 1 >+ >+Checking spelling issue on 'zz.' >+PASS internals.markerRangeForNode(element.firstChild, nextMisspellingData.marker, 0) became different from null > PASS range.toString() is "zz" >-PASS internals.markerCountForNode(e.firstChild, "grammar") is 0 >-Grammar and Spelling Error >-PASS internals.markerCountForNode(e.firstChild, "spelling") is 1 >+ >+Checking spelling issue on 'orange,zz,apple.' >+PASS internals.markerRangeForNode(element.firstChild, nextMisspellingData.marker, 0) became different from null > PASS range.toString() is "zz" >-PASS internals.markerCountForNode(e.firstChild, "grammar") is 1 >+ >+Checking grammar issue on 'orange,zz,apple.' >+PASS internals.markerRangeForNode(element.firstChild, nextMisspellingData.marker, 0) became different from null > PASS range.toString() is "orange,zz,apple." >+ >+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 >+ > PASS successfullyParsed is true > > TEST COMPLETE >diff --git a/LayoutTests/editing/spelling/markers.html b/LayoutTests/editing/spelling/markers.html >index 6c6082c2c4d92bb5718aa1a04453d7bc7d2c083a..0a77d6f1fee0a26e5c3673df84dd04d6942d5050 100644 >--- a/LayoutTests/editing/spelling/markers.html >+++ b/LayoutTests/editing/spelling/markers.html >@@ -9,23 +9,26 @@ > } > </style> > <script src="../editing.js" language="JavaScript" type="text/JavaScript" ></script> >-<script src="../../resources/js-test-pre.js"></script> > </head> > <body> >-<pre id="description"></pre> >-<pre id="console"></pre> >-<div id="container"> >-</div> >+<script src="../../resources/js-test-pre.js"></script> >+ >+<div id="container"></div> > > <script> >-if (window.testRunner) >- testRunner.dumpAsText(); >+description("Tests spelling and grammar markers for misspellings."); >+ >+jsTestIsAsync = true; >+ >+if (window.internals) { >+ internals.settings.setUnifiedTextCheckerEnabled(true); >+ internals.settings.setAsynchronousSpellCheckingEnabled(true); >+} > >-function createEditableElement(id, parent) { >+function createEditableElement(parent) { > var e = document.createElement('div'); > e.setAttribute("contentEditable", "true"); > e.className = 'editing'; >- e.id = id; > > parent.appendChild(e); > return e; >@@ -33,50 +36,88 @@ function createEditableElement(id, parent) { > > function typeText(elem, text) { > elem.focus(); >- for (var i = 0; i < text.length; ++i) { >+ for (var i = 0; i < text.length; ++i) > typeCharacterCommand(text[i]); >- } > } > > var container = document.getElementById('container'); >-var range; > >-debug("Grammar Error Only"); >-var id = 'id1' >-var e = createEditableElement(id, container); >-typeText(e, 'I have a issue.'); >-if (window.internals) { >- shouldBe('internals.markerCountForNode(e.firstChild, "spelling")', '0'); >- shouldBe('internals.markerCountForNode(e.firstChild, "grammar")', '1'); >- range = internals.markerRangeForNode(e.firstChild, "grammar", 0); >- shouldBe("range.toString()", '"a"'); >-} >+var elementWithGrammarIssue = createEditableElement(container); >+typeText(elementWithGrammarIssue, 'I have a issue.'); > >-debug("Spelling Error Only"); >-var id = 'id2' >-var e = createEditableElement(id, container); >-typeText(e, 'zz.'); >-if (window.internals) { >- shouldBe('internals.markerCountForNode(e.firstChild, "spelling")', '1'); >- range = internals.markerRangeForNode(e.firstChild, "spelling", 0); >- shouldBe('range.toString()', '"zz"'); >- shouldBe('internals.markerCountForNode(e.firstChild, "grammar")', '0'); >+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("Checking " + nextMisspellingData.marker + " issue on '" + element.firstChild.nodeValue + "'"); >+ >+ shouldBecomeDifferent('internals.markerRangeForNode(element.firstChild, nextMisspellingData.marker, 0)', "null", function() { >+ range = internals.markerRangeForNode(element.firstChild, nextMisspellingData.marker, 0); >+ shouldBeEqualToString('range.toString()', nextMisspellingData.issue); >+ debug(""); >+ verifyDesiredMarkers(element, misspellings); >+ }); > } > >-debug("Grammar and Spelling Error"); >-var id = 'id3' >-var e = createEditableElement(id, container); >-typeText(e, 'orange,zz,apple.'); >-if (window.internals) { >- shouldBe('internals.markerCountForNode(e.firstChild, "spelling")', '1'); >- range = internals.markerRangeForNode(e.firstChild, "spelling", 0); >- shouldBe('range.toString()', '"zz"'); >- shouldBe('internals.markerCountForNode(e.firstChild, "grammar")', '1'); >- range = internals.markerRangeForNode(e.firstChild, "grammar", 0); >- shouldBe('range.toString()', '"orange,zz,apple."'); >+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("Checking " + oppositeMarker + " issue on '" + element.firstChild.nodeValue + "'"); >+ >+ shouldBecomeEqual('internals.markerCountForNode(element.firstChild, oppositeMarker)', '0', function() { >+ debug(""); >+ done(); >+ }); > } > >-var successfullyParsed = true; >+function done() >+{ >+ var next = tests.shift(); >+ if (next) >+ return window.setTimeout(next, 0); >+ >+ finishJSTest(); >+} >+done(); > </script> > <script src="../../resources/js-test-post.js"></script> > </body>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 127099
:
221362
|
221365
|
221448