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

Unified Diff: LayoutTests/editing/spelling/grammar-paste.html

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/grammar-paste.html
diff --git a/LayoutTests/editing/spelling/grammar-paste.html b/LayoutTests/editing/spelling/grammar-paste.html
index a47260f80962aa595e3caadf428d1828283d6821..30d2886e33c4b4191e8bb5286deb86bff40d6053 100644
--- a/LayoutTests/editing/spelling/grammar-paste.html
+++ b/LayoutTests/editing/spelling/grammar-paste.html
@@ -92,9 +92,14 @@ function verifyMarker(node, expectedMarked)
return false;
}
+ var nodeContent = node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement ? node.value : node.innerHTML;
+ testPassed(node.tagName + " ungrammatical phrase '" + expectedMarked + "' on '" + nodeContent + "'");
+
return true;
}
+var destination = null;
+var expectedMarked = null;
function pasteAndVerify(source, dest, expectedMarked)
{
sel.selectAllChildren(source);
@@ -108,27 +113,11 @@ function pasteAndVerify(source, dest, expectedMarked)
}
document.execCommand("Paste");
- var nretry = 10;
- var nsleep = 4;
- 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 for '" + source.innerHTML + "'");
- done();
- return;
- }
-
- nsleep *= 2;
- window.setTimeout(trial, nsleep);
- };
- trial();
+ if (window.internals) {
+ destination = dest;
+ ungrammaticalPhrase = expectedMarked;
+ shouldBecomeEqual('verifyMarker(destination, ungrammaticalPhrase)', 'true', done);
+ }
};
if (window.internals)

Powered by Google App Engine
This is Rietveld 408576698