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

Unified Diff: third_party/WebKit/LayoutTests/editing/spelling/focusing-other-frame.html

Issue 2224103003: Convert some spell-checking layout tests to use unified text checker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@SpellCheckerDebugInfo
Patch Set: add setUnifiedTextCheckerEnabled(true) in util.js Created 4 years, 4 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: third_party/WebKit/LayoutTests/editing/spelling/focusing-other-frame.html
diff --git a/third_party/WebKit/LayoutTests/editing/spelling/focusing-other-frame.html b/third_party/WebKit/LayoutTests/editing/spelling/focusing-other-frame.html
index 4ccb20c84c3307464954fc3e50ab71b203faa07c..ae5ba9a1c1e53d7c9c107e3f9c7d6fd0b477054a 100644
--- a/third_party/WebKit/LayoutTests/editing/spelling/focusing-other-frame.html
+++ b/third_party/WebKit/LayoutTests/editing/spelling/focusing-other-frame.html
@@ -1,37 +1,41 @@
<!DOCTYPE html>
<html>
<head>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
<script src="resources/util.js"></script>
-<script src="../../resources/js-test.js"></script>
</head>
<body>
<pre id="console"></pre>
-<iframe id="frame1" src="data:text/html,<body contenteditable></body>"></iframe>
-<iframe id="frame2" src="data:text/html,<body contenteditable></body>"></iframe>
+<iframe id="frame1"></iframe>
+<iframe id="frame2"></iframe>
<script>
+var frame1 = document.getElementById('frame1');
+var testEditable1 = frame1.contentWindow.document.createElement('div');
+testEditable1.setAttribute('contentEditable', 'true');
+frame1.contentWindow.document.body.appendChild(testEditable1);
+var frame2 = document.getElementById('frame2');
+var testEditable2 = frame2.contentWindow.document.createElement('div');
+testEditable2.setAttribute('contentEditable', 'true');
+frame2.contentWindow.document.body.appendChild(testEditable2);
-description("Last word written in an editable in one frame should be " +
-"spellchecked when focusing other frame. To test manually type some " +
-"misspelled word in one frame and focus other frame. The word should be marked.");
+var steps = [
+ function() {
+ testEditable1.focus();
+ frame1.contentWindow.document.execCommand('InsertText', false, 'zz');
+ },
+ function() {
+ testEditable2.focus();
+ }
+];
-if (window.internals) {
- var frame1 = document.getElementById("frame1");
- var testEditable1 = frame1.contentWindow.document.createElement("div");
- testEditable1.setAttribute("contentEditable", "true");
- frame1.contentWindow.document.body.appendChild(testEditable1);
- var frame2 = document.getElementById("frame2");
- var testEditable2 = frame1.contentWindow.document.createElement("div");
- testEditable2.setAttribute("contentEditable", "true");
- frame2.contentWindow.document.body.appendChild(testEditable2);
- testEditable1.focus();
- frame1.contentWindow.document.execCommand("InsertText", false, "zz");
- shouldBe('internals.markerCountForNode(testEditable1.childNodes[0], "spelling")', '0');
- testEditable2.focus();
- shouldBe('internals.markerCountForNode(testEditable1.childNodes[0], "spelling")', '1');
-} else {
- log("Automatic testing impossible. Test manually. See steps in the description.");
-}
+var assertions = [
+ () => assert_equals(internals.markerCountForNode(testEditable1.childNodes[0], 'spelling'), 0),
+ () => assert_equals(internals.markerCountForNode(testEditable1.childNodes[0], 'spelling'), 1)
+];
+
+runSpellingTest(steps, assertions,'Text written in an editable in one frame should be spellchecked when focusing other frame')
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698