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

Unified Diff: LayoutTests/editing/spelling/grammar-markers-hidpi.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-markers-hidpi.html
diff --git a/LayoutTests/editing/spelling/grammar-markers-hidpi.html b/LayoutTests/editing/spelling/grammar-markers-hidpi.html
index 1b27e4d5f7378d0e9db5a60b0e800abc574306c0..43da74bcd995c1e5d3b0e34699c867732f29cd1c 100644
--- a/LayoutTests/editing/spelling/grammar-markers-hidpi.html
+++ b/LayoutTests/editing/spelling/grammar-markers-hidpi.html
@@ -15,26 +15,19 @@ jsTestIsAsync = true;
if (window.internals)
internals.settings.setAsynchronousSpellCheckingEnabled(true);
-var retryCount = 10;
-var sleepPeriod = 1;
-var ungrammaticalPhrase = 'has';
-var hasMarker;
-function verifyMarker() {
- hasMarker = internals.hasGrammarMarker(document, target.innerHTML.indexOf(ungrammaticalPhrase), ungrammaticalPhrase.length);
- if (!hasMarker && --retryCount > 0) {
- sleepPeriod *= 2;
- window.setTimeout(verifyMarker, sleepPeriod);
- return;
- }
-
- shouldBeTrue('hasMarker');
- finishJSTest();
-};
+function verifyGrammarMarker(destination, ungrammaticalPhrase)
+{
+ if (internals.hasGrammarMarker(document, destination.innerHTML.indexOf(ungrammaticalPhrase), ungrammaticalPhrase.length)) {
+ testPassed("ungrammatical phrase '" + ungrammaticalPhrase + "' on '" + destination.innerHTML + "'");
+ return true;
+ } else
+ return false;
+}
if (window.testRunner) {
testRunner.dumpAsText(true);
testRunner.setBackingScaleFactor(2, function () {
- verifyMarker();
+ shouldBecomeEqual('verifyGrammarMarker(target, "has")', 'true', finishJSTest);
});
}

Powered by Google App Engine
This is Rietveld 408576698