1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
|
<!DOCTYPE html>
<html>
<head>
<title>Tests AccessFu content integration</title>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js">
</script>
<script type="application/javascript"
src="chrome://mochikit/content/chrome-harness.js">
</script>
<script type="application/javascript" src="../common.js"></script>
<script type="application/javascript" src="../browser.js"></script>
<script type="application/javascript" src="../events.js"></script>
<script type="application/javascript" src="../role.js"></script>
<script type="application/javascript" src="../states.js"></script>
<script type="application/javascript" src="../layout.js"></script>
<script type="application/javascript" src="jsatcommon.js"></script>
<script type="application/javascript">
function doTest() {
var doc = currentTabDocument();
var iframe = doc.createElement('iframe');
iframe.id = 'iframe';
iframe.mozbrowser = true;
iframe.addEventListener('mozbrowserloadend', function () {
var contentTest = new AccessFuContentTest(
[
// Simple traversal forward
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(
['Traversal Rule test document', 'Phone status bar'],
{ focused: 'body' })],
[ContentMessages.simpleMovePrevious, new ExpectedNoMove()],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
[ContentMessages.simpleMoveNext, new ExpectedCursorChange(
['such app', 'wow', {'string': 'headingLevel', 'args': [1]}],
{ focused: 'iframe' })],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['many option', {'string': 'stateNotChecked'},
{'string': 'checkbutton'}, {'string': 'listStart'},
{'string': 'list'}, {'string': 'listItemsCount', 'count': 1}])],
// check checkbox
[ContentMessages.activateCurrent(),
new ExpectedClickAction({ no_android: true }),
new ExpectedCheckAction(true)],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['much range', {'string': 'label'}])],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['much range', '5', {'string': 'slider'}])],
[ContentMessages.moveOrAdjustUp(), new ExpectedValueChange('6')],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['apple', {'string': 'pushbutton'}])],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Light', {"string": "stateOff"}, {'string': 'switch'}])],
// switch on
[ContentMessages.activateCurrent(),
new ExpectedClickAction({ no_android: true }),
new ExpectedSwitchAction(true)],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['slider', '0', {'string': 'slider'}])],
// Simple traversal backward
[ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['Light', {"string": "stateOn"}, {'string': 'switch'}])],
// switch off
[ContentMessages.activateCurrent(),
new ExpectedClickAction({ no_android: true }),
new ExpectedSwitchAction(false)],
[ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['apple', {'string': 'pushbutton'}])],
[ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])],
[ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['such app', 'much range', '6', {'string': 'slider'}])],
[ContentMessages.moveOrAdjustDown(), new ExpectedValueChange('5')],
[ContentMessages.androidScrollForward(), new ExpectedValueChange('6')],
[ContentMessages.androidScrollBackward(), new ExpectedValueChange('5')],
[ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['much range', {'string': 'label'}])],
[ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['many option', {'string': 'stateChecked'},
{'string': 'checkbutton'}, {'string': 'listStart'},
{'string': 'list'}, {'string': 'listItemsCount', 'count': 1}])],
// uncheck checkbox
[ContentMessages.activateCurrent(),
new ExpectedClickAction({ no_android: true }),
new ExpectedCheckAction(false)],
[ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['wow', {'string': 'headingLevel', 'args': [1]}])],
[ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
[ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['Phone status bar'])],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
// Moving to the absolute last item from an embedded document
// fails. Bug 972035.
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(
['such app', 'wow', {'string': 'headingLevel', 'args': [1]}])],
// Move from an inner frame to the last element in the parent doc
[ContentMessages.simpleMoveLast,
new ExpectedCursorChange(
['slider', '0', {'string': 'slider'}], { b2g_todo: true })],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])],
[ContentMessages.moveOrAdjustDown('FormElement'),
new ExpectedCursorChange(['Back', {"string": "pushbutton"}])],
[ContentMessages.moveOrAdjustDown('FormElement'),
new ExpectedCursorChange(['such app', 'many option', {'string': 'stateNotChecked'},
{'string': 'checkbutton'}, {'string': 'listStart'},
{'string': 'list'}, {'string': 'listItemsCount', 'count': 1}])],
[ContentMessages.moveOrAdjustDown('FormElement'),
new ExpectedCursorChange(['much range', '5', {'string': 'slider'}])],
// Calling AdjustOrMove should adjust the range.
[ContentMessages.moveOrAdjustDown('FormElement'),
new ExpectedValueChange('4')],
[ContentMessages.moveOrAdjustUp('FormElement'),
new ExpectedValueChange('5')],
[ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['much range', {'string': 'label'}])],
[ContentMessages.moveOrAdjustUp('FormElement'),
new ExpectedCursorChange(['many option', {'string': 'stateNotChecked'},
{'string': 'checkbutton'}, {'string': 'listStart'},
{'string': 'list'}, {'string': 'listItemsCount', 'count': 1}])],
[ContentMessages.moveOrAdjustUp('FormElement'),
new ExpectedCursorChange(['Back', {"string": "pushbutton"}])],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
// Moving to the absolute first item from an embedded document
// fails. Bug 972035.
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['such app', 'wow', {'string': 'headingLevel', 'args': [1]}])],
[ContentMessages.simpleMoveNext, new ExpectedCursorChange(
['many option', {'string': 'stateNotChecked'},
{'string': 'checkbutton'}, {'string': 'listStart'},
{'string': 'list'}, {'string': 'listItemsCount', 'count': 1}])],
[ContentMessages.simpleMoveFirst,
new ExpectedCursorChange(['Phone status bar'], { b2g_todo: true })],
// Reset cursors
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
// Current virtual cursor's position's name changes
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])],
[ContentMessages.focusSelector('button#fruit', false),
new ExpectedCursorChange(['apple', {'string': 'pushbutton'}])],
[doc.defaultView.renameFruit, new ExpectedNameChange('banana')],
// Name and value changes inside a live-region (no cursor present)
[doc.defaultView.renameSlider,
new ExpectedNameChange('mover')],
[doc.defaultView.changeSliderValue,
new ExpectedValueChange('medium')],
// Blur button and reset cursor
[ContentMessages.focusSelector('button#fruit', true), null],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
// Move cursor with focus in outside document
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])],
[ContentMessages.focusSelector('button#home', false),
new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])],
// Blur button and reset cursor
[ContentMessages.focusSelector('button#home', true), null],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
// Set focus on element outside of embedded frame while
// cursor is in frame
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['such app', 'wow', {'string': 'headingLevel', 'args': [1]}])],
[ContentMessages.focusSelector('button#home', false),
new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])],
// Blur button and reset cursor
[ContentMessages.focusSelector('button#home', true), null],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
// XXX: Set focus on iframe itself.
// XXX: Set focus on element in iframe when cursor is outside of it.
// XXX: Set focus on element in iframe when cursor is in iframe.
// aria-hidden element that the virtual cursor is positioned on
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
[doc.defaultView.ariaHideBack,
new ExpectedCursorChange(
["such app", "wow", {"string": "headingLevel","args": [1]}])],
// Changing aria-hidden attribute twice and making sure that the event
// is fired only once when the actual change happens.
[doc.defaultView.ariaHideBack],
[doc.defaultView.ariaShowBack],
[ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
// aria-hidden on the iframe that has the vc.
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['such app', 'wow', {'string': 'headingLevel', 'args': [1]}])],
[doc.defaultView.ariaHideIframe,
new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])],
[doc.defaultView.ariaShowIframe],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
// aria-hidden element and auto Move
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])],
[doc.defaultView.ariaHideBack],
[ContentMessages.focusSelector('button#back', false),
// Must not speak Back button as it is aria-hidden
new ExpectedCursorChange(
["such app", "wow", {"string": "headingLevel","args": [1]}])],
[doc.defaultView.ariaShowBack],
[ContentMessages.focusSelector('button#back', true), null],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
// Open dialog in outer doc, while cursor is also in outer doc
[ContentMessages.simpleMoveLast,
new ExpectedCursorChange(['Traversal Rule test document', 'mover',
'medium', {'string': 'slider'}])],
[doc.defaultView.showAlert,
new ExpectedCursorChange(['This is an alert!',
{'string': 'headingLevel', 'args': [1]},
{'string': 'dialog'}])],
[doc.defaultView.hideAlert,
new ExpectedCursorChange(['Traversal Rule test document', 'mover',
'medium', {'string': 'slider'}])],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
// Open dialog in outer doc, while cursor is in inner frame
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(
['such app', 'wow', {'string': 'headingLevel', 'args': [1]}])],
[doc.defaultView.showAlert, new ExpectedCursorChange(['This is an alert!',
{'string': 'headingLevel', 'args': [1]},
{'string': 'dialog'}])],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Do you agree?'])],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Yes', {'string': 'pushbutton'}])],
[ContentMessages.activateCurrent(),
new ExpectedClickAction(),
new ExpectedCursorChange(
['such app', 'wow', {'string': 'headingLevel', 'args': [1]}])],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
// Open dialog, then focus on something when closing
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])],
[doc.defaultView.showAlert,
new ExpectedCursorChange(['This is an alert!',
{'string': 'headingLevel', 'args': [1]}, {'string': 'dialog'}])],
[function hideAlertAndFocusHomeButton() {
doc.defaultView.hideAlert();
doc.querySelector('button#home').focus();
}, new ExpectedCursorChange(['Traversal Rule test document',
'Home', {'string': 'pushbutton'}])],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['banana', {'string': 'pushbutton'}])]
[ContentMessages.simpleMoveNext, new ExpectedNoMove()]
]);
addA11yLoadEvent(function() {
contentTest.start(function () {
closeBrowserWindow();
SimpleTest.finish();
});
}, doc.defaultView)
});
iframe.src = 'data:text/html;charset=utf-8,' + doc.defaultView.frameContents;
doc.getElementById('appframe').appendChild(iframe);
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(
function () {
openBrowserWindow(
function () {
SpecialPowers.pushPrefEnv({
'set': [
// TODO: remove this as part of bug 820712
['network.disable.ipc.security', true],
['dom.ipc.browser_frames.oop_by_default', true],
['dom.mozBrowserFramesEnabled', true],
['browser.pagethumbnails.capturing_disabled', true]
]
}, doTest) },
getRootDirectory(window.location.href) + 'doc_content_integration.html');
});
</script>
</head>
<body id="body">
<a target="_blank"
title="Add tests for OOP message handling and general integration"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=972047">Mozilla Bug 933808</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
</body>
</html>
|