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

Unified Diff: LayoutTests/editing/spelling/script-tests/spellcheck-paste.js

Issue 23534071: Use shouldBecomeEqual in asynchronous spellchecking tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Apply Tony's review and use asynchronous spellchecking in two tests Created 7 years, 3 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/script-tests/spellcheck-paste.js
diff --git a/LayoutTests/editing/spelling/script-tests/spellcheck-paste.js b/LayoutTests/editing/spelling/script-tests/spellcheck-paste.js
index 01954331a53985c0fef5451a8fcc38e1122dccf3..4d1c74e328bbb4758de3642022b46f543f2fde8e 100644
--- a/LayoutTests/editing/spelling/script-tests/spellcheck-paste.js
+++ b/LayoutTests/editing/spelling/script-tests/spellcheck-paste.js
@@ -53,9 +53,17 @@ function verifyMarker(node, expectedMarked)
var ok = true;
for (var i = 0; ok && i < expectedMarked.length; ++i)
ok = internals.hasSpellingMarker(document, expectedMarked[i][0], expectedMarked[i][1]);
+
+ if (ok) {
+ var nodeContent = node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement ? node.value : node.innerHTML;
+ testPassed(node.tagName + " has a marker on '" + nodeContent + "'");
+ }
+
return ok;
}
+var destination = null;
+var misspelledLocations = null;
function pasteAndVerify(source, dest, expectedMarked)
{
sel.selectAllChildren(source);
@@ -69,27 +77,11 @@ function pasteAndVerify(source, dest, expectedMarked)
}
document.execCommand("Paste");
- var nretry = 10;
- var nsleep = 1;
- function trial() {
- var verified = verifyMarker(dest, expectedMarked);
- if (verified) {
- testPassed(dest.tagName + " has a marker on '" + source.innerHTML + "'");
- done();
- return;
- }
-
- nretry--;
- if (0 == nretry) {
- testFailed(dest.tagName + " should have a marker on '" + source.innerHTML + "'");
- done();
- return;
- }
-
- nsleep *= 2;
- window.setTimeout(trial, nsleep);
- };
- trial();
+ if (window.internals) {
+ destination = dest;
+ misspelledLocations = expectedMarked;
+ shouldBecomeEqual('verifyMarker(destination, misspelledLocations)', 'true', done);
+ }
};
if (window.internals)

Powered by Google App Engine
This is Rietveld 408576698