Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / spelling / spellcheck-sequencenum.html
bloba5aa4c1144973a7d6e0264d6875953b3f2d134ed
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9 <script>
10 description('For Bug 73511: Internals should have a method to return the max sequence number of spellcheck request.');
12 if (window.internals) {
13 window.jsTestIsAsync = true;
14 internals.settings.setAsynchronousSpellCheckingEnabled(true);
17 var testRoot = document.createElement("div");
18 document.body.insertBefore(testRoot, document.body.firstChild);
20 var source = document.createElement("div");
21 source.innerHTML = "foo bar";
22 testRoot.appendChild(source);
24 function createInput(testRoot) {
25 var e = document.createElement('input');
26 e.setAttribute("type", "text");
27 testRoot.appendChild(e);
29 return e;
32 function createTextArea(testRoot) {
33 var e = document.createElement("textarea");
34 testRoot.appendChild(e);
36 return e;
39 function createContentEditable(testRoot) {
40 var e = document.createElement("div");
41 e.setAttribute("contentEditable", "true");
42 testRoot.appendChild(e);
44 return e;
47 var destinations = [
48 createInput(testRoot),
49 createTextArea(testRoot),
50 createContentEditable(testRoot),
53 var sel = window.getSelection();
55 var tests = [];
56 for (var i = 0; i < destinations.length; ++i) {
57 var t = function(i) {
58 return function() {
59 if (!window.internals)
60 return;
61 var sequence = internals.lastSpellCheckRequestSequence(document);
62 var processed = internals.lastSpellCheckProcessedSequence(document);
63 copyAndPaste(source, destinations[i]);
64 verify(sequence, processed);
66 }(i);
67 tests.push(t);
70 function verifyIfAny()
72 var next = tests.shift();
73 if (next) {
74 next();
75 return;
78 testRoot.style.display = "none";
79 finishJSTest();
82 function copyAndPaste(source, dest)
84 sel.selectAllChildren(source);
85 document.execCommand("Copy");
87 if (dest instanceof HTMLInputElement || dest instanceof HTMLTextAreaElement) {
88 dest.value = "";
89 dest.focus();
90 } else {
91 dest.innerHTML = "";
92 sel.selectAllChildren(dest);
94 document.execCommand("Paste");
97 function verify(sequence, processed)
99 var nretry = 10;
100 var nsleep = 1;
101 function trial() {
102 var newSequence = internals.lastSpellCheckRequestSequence(document);
103 var newProcessed = internals.lastSpellCheckProcessedSequence(document);
105 var verified = newSequence >= sequence && newProcessed >= processed && newSequence == newProcessed;
106 if (verified) {
107 testPassed("SpellCheck sequence seems working correctly.");
108 verifyIfAny();
109 return;
112 nretry--;
113 if (0 == nretry) {
114 testFailed("SpellCheck sequence didn't increase.");
115 verifyIfAny();
116 return;
119 nsleep *= 2;
120 window.setTimeout(trial, nsleep);
122 trial();
125 verifyIfAny();
127 var successfullyParsed = true;
129 </script>
130 </body>
131 </html>