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

Unified Diff: LayoutTests/editing/spelling/spellcheck-paste-disabled.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/spellcheck-paste-disabled.html
diff --git a/LayoutTests/editing/spelling/spellcheck-paste-disabled.html b/LayoutTests/editing/spelling/spellcheck-paste-disabled.html
index 89feb8ff76298c3632b077e06b72604d1fc16133..6e85901b185aa547df7b04e55b33769f7f800473 100644
--- a/LayoutTests/editing/spelling/spellcheck-paste-disabled.html
+++ b/LayoutTests/editing/spelling/spellcheck-paste-disabled.html
@@ -16,6 +16,8 @@ description('Test if WebKit does not spellcheck text when pasting text to an ele
jsTestIsAsync = true;
+internals.settings.setAsynchronousSpellCheckingEnabled(true);
+
// Insert a misspelled word to initialize a spellchecker.
var srcNode = document.getElementById('src');
srcNode.focus();
@@ -27,33 +29,15 @@ document.execCommand("InsertText", false, 'p');
document.execCommand("InsertText", false, 'p');
document.execCommand("InsertText", false, 'l');
document.execCommand("InsertText", false, 'e');
-shouldBeTrue('internals.hasSpellingMarker(document, 0, 2)');
+shouldBecomeEqual('internals.hasSpellingMarker(document, 0, 2)', 'true', function(){});
window.getSelection().selectAllChildren(srcNode);
document.execCommand('Copy');
-internals.settings.setAsynchronousSpellCheckingEnabled(true);
-
var dstNode = document.getElementById('dst');
dstNode.focus();
document.execCommand('Paste');
+shouldBecomeDifferent('internals.hasSpellingMarker(document, 0, 2)', 'true', finishJSTest);
-var retryCount = 10;
-var sleepPeriod = 1;
-function verifyMarker() {
- dstNode.focus();
- var hasMarker = internals.hasSpellingMarker(document, 0, 2);
- if (!hasMarker && --retryCount > 0) {
- sleepPeriod *= 2;
- window.setTimeout(verifyMarker, sleepPeriod);
- return;
- }
- if (hasMarker)
- testFailed('The destination node should not have a marker.');
- else
- testPassed('The destination node does not have any markers.');
- finishJSTest();
-}
-window.setTimeout(verifyMarker, sleepPeriod);
</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>

Powered by Google App Engine
This is Rietveld 408576698