|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 <head> |
|
4 <title>Tests AccessFu content integration</title> |
|
5 <meta charset="utf-8" /> |
|
6 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
|
7 |
|
8 <script type="application/javascript" |
|
9 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"> |
|
10 </script> |
|
11 <script type="application/javascript" |
|
12 src="chrome://mochikit/content/chrome-harness.js"> |
|
13 </script> |
|
14 |
|
15 <script type="application/javascript" src="../common.js"></script> |
|
16 <script type="application/javascript" src="../browser.js"></script> |
|
17 <script type="application/javascript" src="../events.js"></script> |
|
18 <script type="application/javascript" src="../role.js"></script> |
|
19 <script type="application/javascript" src="../states.js"></script> |
|
20 <script type="application/javascript" src="../layout.js"></script> |
|
21 <script type="application/javascript" src="jsatcommon.js"></script> |
|
22 |
|
23 <script type="application/javascript"> |
|
24 function doTest() { |
|
25 var doc = currentTabDocument(); |
|
26 var iframe = doc.createElement("iframe"); |
|
27 iframe.mozbrowser = true; |
|
28 iframe.addEventListener("mozbrowserloadend", function () { |
|
29 var contentTest = new AccessFuContentTest( |
|
30 [ |
|
31 // Simple traversal forward |
|
32 [ContentMessages.simpleMoveNext, { |
|
33 speak: 'Phone status bar Traversal Rule test document' |
|
34 }], |
|
35 [ContentMessages.simpleMoveNext, { |
|
36 speak: 'wow heading level 1 such app' |
|
37 }], |
|
38 [ContentMessages.simpleMoveNext, { |
|
39 speak: 'many option not checked check button' |
|
40 }], |
|
41 // check checkbox |
|
42 [ContentMessages.activateCurrent(), { |
|
43 speak: 'checked' |
|
44 }], |
|
45 [ContentMessages.simpleMoveNext, { |
|
46 speak: 'much range label' |
|
47 }], |
|
48 [ContentMessages.simpleMoveNext, { |
|
49 speak: 'much range 5 slider' |
|
50 }], |
|
51 [ContentMessages.adjustRangeUp, |
|
52 { speak: '6'}], |
|
53 [ContentMessages.simpleMoveNext, { |
|
54 speak: 'Home button' |
|
55 }], |
|
56 |
|
57 // Simple traversal backward |
|
58 [ContentMessages.simpleMovePrevious, { |
|
59 speak: 'much range 6 slider such app' |
|
60 }], |
|
61 [ContentMessages.adjustRangeDown, |
|
62 { speak: '5'}], |
|
63 [ContentMessages.simpleMovePrevious, { |
|
64 speak: 'much range label' |
|
65 }], |
|
66 [ContentMessages.simpleMovePrevious, { |
|
67 speak: 'many option checked check button' |
|
68 }], |
|
69 // uncheck checkbox |
|
70 [ContentMessages.activateCurrent(), { |
|
71 speak: 'unchecked' |
|
72 }], |
|
73 [ContentMessages.simpleMovePrevious, { |
|
74 speak: 'wow heading level 1' |
|
75 }], |
|
76 [ContentMessages.simpleMovePrevious, { |
|
77 speak: 'Phone status bar' |
|
78 }], |
|
79 |
|
80 // Moving to the absolute last item from an embedded document |
|
81 // fails. Bug 972035. |
|
82 [ContentMessages.simpleMoveNext, { |
|
83 speak: 'wow heading level 1 such app' |
|
84 }], |
|
85 // Move from an inner frame to the last element in the parent doc |
|
86 [ContentMessages.simpleMoveLast, { |
|
87 speak: 'Home button', |
|
88 speak_checkFunc: 'todo_is' |
|
89 }], |
|
90 |
|
91 [ContentMessages.clearCursor, 'AccessFu:CursorCleared'], |
|
92 |
|
93 // Moving to the absolute first item from an embedded document |
|
94 // fails. Bug 972035. |
|
95 [ContentMessages.simpleMoveNext, { |
|
96 speak: 'Phone status bar Traversal Rule test document' |
|
97 }], |
|
98 [ContentMessages.simpleMoveNext, { |
|
99 speak: 'wow heading level 1 such app' |
|
100 }], |
|
101 [ContentMessages.simpleMoveNext, { |
|
102 speak: 'many option not checked check button' |
|
103 }], |
|
104 [ContentMessages.simpleMoveFirst, { |
|
105 speak: 'Phone status bar', |
|
106 speak_checkFunc: 'todo_is' |
|
107 }], |
|
108 |
|
109 // Reset cursors |
|
110 [ContentMessages.clearCursor, 'AccessFu:CursorCleared'], |
|
111 |
|
112 // Move cursor with focus in outside document |
|
113 [ContentMessages.simpleMoveNext, { |
|
114 speak: 'Phone status bar Traversal Rule test document' |
|
115 }], |
|
116 [ContentMessages.focusSelector('button#home', false), { |
|
117 speak: 'Home button' |
|
118 }], |
|
119 |
|
120 // Blur button and reset cursor |
|
121 [ContentMessages.focusSelector('button#home', true), null], |
|
122 [ContentMessages.clearCursor, 'AccessFu:CursorCleared'], |
|
123 |
|
124 // Set focus on element outside of embedded frame while |
|
125 // cursor is in frame |
|
126 [ContentMessages.simpleMoveNext, { |
|
127 speak: 'Phone status bar Traversal Rule test document' |
|
128 }], |
|
129 [ContentMessages.simpleMoveNext, { |
|
130 speak: 'wow heading level 1 such app' |
|
131 }], |
|
132 [ContentMessages.focusSelector('button#home', false), { |
|
133 speak: 'Home button' |
|
134 }] |
|
135 |
|
136 // Blur button and reset cursor |
|
137 [ContentMessages.focusSelector('button#home', true), null], |
|
138 [ContentMessages.clearCursor, 'AccessFu:CursorCleared'], |
|
139 |
|
140 // XXX: Set focus on iframe itself. |
|
141 // XXX: Set focus on element in iframe when cursor is outside of it. |
|
142 // XXX: Set focus on element in iframe when cursor is in iframe. |
|
143 |
|
144 // Open dialog in outer doc, while cursor is also in outer doc |
|
145 [ContentMessages.simpleMoveNext, { |
|
146 speak: 'Phone status bar Traversal Rule test document' |
|
147 }], |
|
148 [doc.defaultView.showAlert, { |
|
149 speak: 'This is an alert! heading level 1 dialog' |
|
150 }], |
|
151 |
|
152 [function() { |
|
153 doc.defaultView.hideAlert() |
|
154 }, { |
|
155 speak: 'wow heading level 1 such app' |
|
156 }], |
|
157 |
|
158 [ContentMessages.clearCursor, 'AccessFu:CursorCleared'], |
|
159 |
|
160 // Open dialog in outer doc, while cursor is in inner frame |
|
161 [ContentMessages.simpleMoveNext, { |
|
162 speak: 'Phone status bar Traversal Rule test document' |
|
163 }], |
|
164 [ContentMessages.simpleMoveNext, { |
|
165 speak: 'wow heading level 1 such app' |
|
166 }], |
|
167 [doc.defaultView.showAlert, { |
|
168 speak: 'This is an alert! heading level 1 dialog' |
|
169 }], |
|
170 |
|
171 // XXX: Place cursor back where it was. |
|
172 [doc.defaultView.hideAlert, { |
|
173 speak: 'many option not checked check button such app' |
|
174 }], |
|
175 |
|
176 [ContentMessages.clearCursor, 'AccessFu:CursorCleared'], |
|
177 |
|
178 // Open dialog, then focus on something when closing |
|
179 [ContentMessages.simpleMoveNext, { |
|
180 speak: 'Phone status bar Traversal Rule test document' |
|
181 }], |
|
182 [doc.defaultView.showAlert, { |
|
183 speak: 'This is an alert! heading level 1 dialog' |
|
184 }], |
|
185 |
|
186 [function() { |
|
187 doc.defaultView.hideAlert(); |
|
188 doc.querySelector('button#home').focus(); |
|
189 }, { |
|
190 speak: 'Home button Traversal Rule test document' |
|
191 }] |
|
192 ]); |
|
193 |
|
194 contentTest.start(function () { |
|
195 closeBrowserWindow(); |
|
196 SimpleTest.finish(); |
|
197 }); |
|
198 |
|
199 }); |
|
200 iframe.src = 'data:text/html;charset=utf-8,' + doc.defaultView.frameContents; |
|
201 doc.getElementById('appframe').appendChild(iframe); |
|
202 } |
|
203 |
|
204 SimpleTest.waitForExplicitFinish(); |
|
205 addLoadEvent( |
|
206 function () { |
|
207 openBrowserWindow( |
|
208 function () { |
|
209 SpecialPowers.pushPrefEnv({ |
|
210 "set": [ |
|
211 // TODO: remove this as part of bug 820712 |
|
212 ["network.disable.ipc.security", true], |
|
213 |
|
214 |
|
215 ["dom.ipc.browser_frames.oop_by_default", true], |
|
216 ["dom.mozBrowserFramesEnabled", true], |
|
217 ["browser.pagethumbnails.capturing_disabled", true] |
|
218 ] |
|
219 }, doTest) }, |
|
220 getRootDirectory(window.location.href) + "doc_content_integration.html"); |
|
221 }); |
|
222 </script> |
|
223 </head> |
|
224 <body id="body"> |
|
225 |
|
226 <a target="_blank" |
|
227 title="Add tests for OOP message handling and general integration" |
|
228 href="https://bugzilla.mozilla.org/show_bug.cgi?id=972047">Mozilla Bug 933808</a> |
|
229 <p id="display"></p> |
|
230 <div id="content" style="display: none"></div> |
|
231 <pre id="test"> |
|
232 </pre> |
|
233 </body> |
|
234 </html> |