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

Unified Diff: third_party/WebKit/LayoutTests/editing/spelling/spellcheck-editable-on-focus.html

Issue 1781273009: Space out issuing of spellcheck requests to speed up layout test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: undo test-triggering change Created 4 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/spelling/spellcheck-editable-on-focus-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/editing/spelling/spellcheck-editable-on-focus.html
diff --git a/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-editable-on-focus.html b/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-editable-on-focus.html
index d49f42c37a1e2be8ca9b8b617dee69fe7fac67c0..c871e5b589495eb91e877acc99da376158ce5d6e 100644
--- a/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-editable-on-focus.html
+++ b/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-editable-on-focus.html
@@ -5,7 +5,7 @@
<script src="resources/util.js"></script>
<script src="../../resources/js-test.js"></script>
</head>
-<body onload="test();">
+<body>
<div id="container">
<div id="test_editable" contentEditable>zz zz zz.</div>
<textarea id="test_textarea">zz zz zz.</textarea>
@@ -18,27 +18,27 @@ description("Spell checking should be triggered on focus of an editable. "
jsTestIsAsync = true;
-var testEditable = document.getElementById('test_editable');
-var testTextArea = document.getElementById('test_textarea');
-var testTextField = document.getElementById('test_textfield');
+function findFirstTextNodeOf(id) {
+ return findFirstTextNode(document.getElementById(id));
+}
-function triggerSpellingForEditables() {
- testEditable.focus();
- testTextArea.focus();
- testTextField.focus();
+var expectedNumberOfMarkers = "0";
+function checkMarkersFor(elementID, doFocus, continuation) {
+ var element = document.getElementById(elementID);
+ if (doFocus)
+ element.focus();
+ shouldBecomeEqual('internals.markerCountForNode(findFirstTextNodeOf("' + elementID + '"), "spelling")', expectedNumberOfMarkers, continuation);
}
-var expectedNumberOfMarkers;
-var textNode;
-function verifySpellingMarkers(expectation, doneCallback) {
- expectedNumberOfMarkers = expectation;
- shouldBecomeEqual('internals.markerCountForNode(findFirstTextNode(testEditable), "spelling")', 'expectedNumberOfMarkers', function() {
- shouldBecomeEqual('internals.markerCountForNode(findFirstTextNode(testTextArea), "spelling")', 'expectedNumberOfMarkers', function() {
- shouldBecomeEqual('internals.markerCountForNode(findFirstTextNode(testTextField), "spelling")', 'expectedNumberOfMarkers', function() {
- doneCallback();
+function verifySpellingMarkers(doFocus, doneCallback) {
+ checkMarkersFor('test_editable', doFocus, function () {
+ checkMarkersFor('test_textarea', doFocus, function () {
+ checkMarkersFor('test_textfield', doFocus, function () {
+ doneCallback && doneCallback();
// After focusing the editable elements, check whether they have spelling markers.
- verifySpellingMarkers(3, finishJSTest);
- });
+ expectedNumberOfMarkers = "3";
+ verifySpellingMarkers(true, finishJSTest);
+ });
});
});
}
@@ -53,9 +53,9 @@ function test() {
// Check whether non-focused elements do not have spelling markers, then
// verify them when they get focused.
- verifySpellingMarkers(0, triggerSpellingForEditables);
+ verifySpellingMarkers(false);
}
-
+test();
</script>
</body>
</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/spelling/spellcheck-editable-on-focus-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698