Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=753984
5 -->
6 <head>
7 <title>[AccessFu] utterance order test</title>
8 <meta charset="utf-8">
9 <link rel="stylesheet" type="text/css"
10 href="chrome://mochikit/content/tests/SimpleTest/test.css" />
11 <script type="application/javascript"
12 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
13 <script type="application/javascript"
14 src="../common.js"></script>
15 <script type="application/javascript"
16 src="./output.js"></script>
17 <script type="application/javascript">
19 function doTest() {
20 // Test the following accOrElmOrID (with optional old accOrElmOrID).
21 // Note: each accOrElmOrID entry maps to a unique object utterance
22 // generator function within the UtteranceGenerator.
23 var tests = [{
24 accOrElmOrID: "anchor",
25 expectedUtterance: [["link", "title"], ["title", "link"]],
26 expectedBraille: [["lnk", "title"], ["title", "lnk"]]
27 }, {
28 accOrElmOrID: "anchor_titleandtext",
29 expectedUtterance: [["link", "goes to the tests -", "Tests"],
30 ["Tests", "- goes to the tests", "link"]],
31 expectedBraille: [["lnk", "goes to the tests -", "Tests"],
32 ["Tests", "- goes to the tests", "lnk"]],
33 }, {
34 accOrElmOrID: "anchor_duplicatedtitleandtext",
35 expectedUtterance: [["link", "Tests"], ["Tests", "link"]],
36 expectedBraille: [["lnk", "Tests"], ["Tests", "lnk"]]
37 }, {
38 accOrElmOrID: "anchor_arialabelandtext",
39 expectedUtterance: [["link", "goes to the tests - Tests"],
40 ["Tests - goes to the tests", "link"]],
41 expectedBraille: [["lnk", "goes to the tests - Tests"],
42 ["Tests - goes to the tests", "lnk"]],
43 }, {
44 accOrElmOrID: "textarea",
45 expectedUtterance: [[
46 "text area", "This is the text area text."
47 ], [
48 "This is the text area text.", "text area"
49 ],],
50 expectedBraille: [[
51 "txtarea", "This is the text area text."
52 ], [
53 "This is the text area text.", "txtarea"
54 ],],
55 }, {
56 accOrElmOrID: "heading",
57 expectedUtterance: [
58 ["heading level 1", "Test heading"],
59 ["Test heading", "heading level 1"]
60 ],
61 expectedBraille: [
62 ["heading", "Test heading"],
63 ["Test heading", "heading"]
64 ]
65 }, {
66 accOrElmOrID: "list",
67 expectedUtterance: [
68 ["list 1 item", "First item", "1.", "list one"],
69 ["1.", "list one", "First item", "list 1 item"]
70 ],
71 expectedBraille: [
72 ["list", "list one"],
73 ["list one", "list"]
74 ]
75 }, {
76 accOrElmOrID: "dlist",
77 expectedUtterance: [
78 ["definition list 0.5 items", "dd one"],
79 ["dd one", "definition list 0.5 items"]
80 ],
81 expectedBraille: [
82 ["definition list", "dd one"],
83 ["dd one", "definition list"]
84 ]
85 }, {
86 accOrElmOrID: "li_one",
87 expectedUtterance: [
88 ["list 1 item", "First item", "1.", "list one"],
89 ["1.", "list one", "First item", "list 1 item"]
90 ],
91 expectedBraille: [
92 ["1.", "list one"],
93 ["1.", "list one"]
94 ]
95 }, {
96 accOrElmOrID: "cell",
97 expectedUtterance: [[
98 "table with 1 column and 1 row", "Fruits and vegetables",
99 "Column 1 Row 1", "list 4 items", "First item", "link", "Apples",
100 "link", "Bananas", "link", "Peaches", "Last item", "link", "Plums"
101 ], [
102 "Apples", "link", "First item", "Bananas", "link", "Peaches",
103 "link", "Plums", "link", "Last item", "list 4 items",
104 "Column 1 Row 1", "Fruits and vegetables",
105 "table with 1 column and 1 row"
106 ]],
107 expectedBraille: [[
108 "c1r1", "list", "lnk", "Apples", "lnk", "Bananas", "lnk",
109 "Peaches", "lnk", "Plums"
110 ], [
111 "Apples", "lnk", "Bananas", "lnk", "Peaches", "lnk", "Plums",
112 "lnk", "list", "c1r1"
113 ]]
114 }, {
115 accOrElmOrID: "date",
116 expectedUtterance: [["date entry", "2011-09-29"], ["2011-09-29", "date entry"]],
117 expectedBraille: [["date entry", "2011-09-29"], ["2011-09-29", "date entry"]]
118 }, {
119 accOrElmOrID: "email",
120 expectedUtterance: [
121 ["e-mail entry", "test@example.com"],
122 ["test@example.com", "e-mail entry"]
123 ],
124 expectedBraille: [
125 ["e-mail entry", "test@example.com"],
126 ["test@example.com", "e-mail entry"]
127 ]
128 }, {
129 accOrElmOrID: "search",
130 expectedUtterance: [
131 ["search entry", "This is a search"],
132 ["This is a search", "search entry"]
133 ],
134 expectedBraille: [
135 ["search entry", "This is a search"],
136 ["This is a search", "search entry"]
137 ]
138 }, {
139 accOrElmOrID: "tel",
140 expectedUtterance: [
141 ["telephone entry", "555-5555"], ["555-5555", "telephone entry"]
142 ],
143 expectedBraille: [
144 ["telephone entry", "555-5555"], ["555-5555", "telephone entry"]
145 ]
146 }, {
147 accOrElmOrID: "url",
148 expectedUtterance: [
149 ["URL entry", "http://example.com"],
150 ["http://example.com", "URL entry"]
151 ],
152 expectedBraille: [
153 ["URL entry", "http://example.com"],
154 ["http://example.com", "URL entry"]
155 ]
156 }, {
157 accOrElmOrID: "textInput",
158 expectedUtterance: [["entry", "This is text."], ["This is text.", "entry"]],
159 expectedBraille: [["entry", "This is text."], ["This is text.", "entry"]]
160 }, {
161 // Test pivot to list from li_one.
162 accOrElmOrID: "list",
163 oldAccOrElmOrID: "li_one",
164 expectedUtterance: [
165 ["list 1 item", "First item", "1.", "list one"],
166 ["1.", "list one", "First item", "list 1 item"]
167 ],
168 expectedBraille: [
169 ["list", "list one"],
170 ["list one", "list"]
171 ]
172 }, {
173 // Test pivot to "apples" link from the table cell.
174 accOrElmOrID: "apples",
175 oldAccOrElmOrID: "cell",
176 expectedUtterance: [
177 ["list 4 items", "First item", "link", "Apples"],
178 ["Apples", "link", "First item", "list 4 items"]
179 ],
180 expectedBraille: [
181 ["*", "lnk", "Apples"],
182 ["*", "Apples", "lnk"]
183 ]
184 }, {
185 // Test pivot to 'bananas' link from 'apples' link.
186 accOrElmOrID: "bananas",
187 oldAccOrElmOrID: "apples",
188 expectedUtterance: [["link", "Bananas"], ["Bananas", "link"]],
189 expectedBraille: [["*", "lnk", "Bananas"], ["*", "Bananas", "lnk"]]
190 }, {
191 // test unavailable state utterance
192 accOrElmOrID: 'unavailableButton',
193 expectedUtterance: [["unavailable button", "I am unavailable"],
194 ["I am unavailable", "unavailable button"]],
195 expectedBraille: [["btn", "I am unavailable"],
196 ["I am unavailable", "btn"]]
197 }, {
198 // test expanded state utterance
199 accOrElmOrID: 'expandedButton',
200 expectedUtterance: [["expanded button", "I am expanded"],
201 ["I am expanded", "expanded button"]],
202 expectedBraille: [["btn", "I am expanded"],
203 ["I am expanded", "btn"]]
204 }, {
205 // test collapsed state utterance
206 accOrElmOrID: 'collapsedButton',
207 expectedUtterance: [["collapsed button", "I am collapsed"],
208 ["I am collapsed", "collapsed button"]],
209 expectedBraille: [["btn", "I am collapsed"],
210 ["I am collapsed", "btn"]]
211 }, {
212 // test required state utterance
213 accOrElmOrID: 'requiredInput',
214 expectedUtterance: [["required entry", "I am required"],
215 ["I am required", "required entry"]],
216 expectedBraille: [["entry", "I am required"],
217 ["I am required", "entry"]]
218 }, {
219 // test has popup state utterance
220 accOrElmOrID: 'hasPopupButton',
221 expectedUtterance: [["has pop up button menu", "I have a popup"],
222 ["I have a popup", "has pop up button menu"]],
223 expectedBraille: [["button menu", "I have a popup"],
224 ["I have a popup", "button menu"]]
225 }, {
226 // Test selected tab
227 accOrElmOrID: 'tab1',
228 expectedUtterance: [['tab list', 'selected tab 1 of 2', 'Account'],
229 ['Account', 'selected tab 1 of 2', 'tab list']],
230 expectedBraille: [['tab 1 of 2', 'Account'],
231 ['Account', 'tab 1 of 2']]
232 }, {
233 // Test unselected tab
234 accOrElmOrID: 'tab2',
235 expectedUtterance: [['tab list', 'tab 2 of 2', 'Advanced'],
236 ['Advanced', 'tab 2 of 2', 'tab list']],
237 expectedBraille: [['tab 2 of 2', 'Advanced'],
238 ['Advanced', 'tab 2 of 2']]
239 },
241 {
242 // Landing on this label should mimic landing on the checkbox.
243 accOrElmOrID: "label1",
244 expectedUtterance: [['not checked check button', 'Orange'],
245 ['Orange', 'not checked check button']],
246 expectedBraille: [['( )', 'Orange'],
247 ['Orange', '( )']]
248 },
249 {
250 // Here we get a top-level view of the form.
251 accOrElmOrID: "form1",
252 expectedUtterance: [['label', 'not checked check button', 'Orange', 'Orange',
253 'not checked check button', 'Blue', 'label', 'Blue'],
254 ['Orange', 'not checked check button', 'Orange', 'label',
255 'Blue', 'not checked check button', 'Blue', 'label']],
256 expectedBraille: [['label', '( )', 'Orange', 'Orange',
257 '( )', 'Blue', 'label', 'Blue'],
258 ['Orange', '( )', 'Orange', 'label',
259 'Blue', '( )', 'Blue', 'label']]
260 },
261 {
262 // This is a non-nesting label.
263 accOrElmOrID: "label2",
264 expectedUtterance: [['label', 'Blue'], ['Blue', 'label']],
265 expectedBraille: [['label', 'Blue'], ['Blue', 'label']]
266 },
267 {
268 // This is a distinct control.
269 accOrElmOrID: "input2",
270 expectedUtterance: [['not checked check button', 'Blue'],
271 ['Blue', 'not checked check button']],
272 expectedBraille: [['( )', 'Blue'],
273 ['Blue', '( )']]
274 },
275 {
276 // This is a nested control.
277 accOrElmOrID: "input1",
278 expectedUtterance: [['not checked check button', 'Orange'],
279 ['Orange', 'not checked check button']],
280 expectedBraille: [['( )', 'Orange'],
281 ['Orange', '( )']]
282 },
283 {
284 // Landing on this label should mimic landing on the entry.
285 accOrElmOrID: "label3",
286 expectedUtterance: [['entry', 'Joe', 'First name:'],
287 ['First name:', 'Joe', 'entry']],
288 expectedBraille: [['entry', 'Joe', 'First name:'],
289 ['First name:', 'Joe', 'entry']]
290 },
291 {
292 // This is a nested control with a value.
293 accOrElmOrID: "input3",
294 expectedUtterance: [['entry', 'Joe', 'First name:'],
295 ['First name:', 'Joe', 'entry']],
296 expectedBraille: [['entry', 'Joe', 'First name:'],
297 ['First name:', 'Joe', 'entry']]
298 },
299 {
300 // This is a nested control with a value.
301 accOrElmOrID: "input4",
302 expectedUtterance: [['slider', '3', 'Points:'],
303 ['Points:', '3', 'slider']],
304 expectedBraille: [['slider', '3', 'Points:'],
305 ['Points:', '3', 'slider']]
306 },{
307 accOrElmOrID: "password",
308 expectedUtterance: [["password text", "Secret Password"],
309 ["Secret Password", "password text"]],
310 expectedBraille: [["passwdtxt", "Secret Password"],
311 ["Secret Password", "passwdtxt"]]
312 },{
313 accOrElmOrID: "input5",
314 expectedUtterance: [["checked check button", "Boring label"],
315 ["Boring label", "checked check button"]],
316 expectedBraille: [["(x)", "Boring label"],
317 ["Boring label", "(x)"]]
318 },{
319 accOrElmOrID: "radio_unselected",
320 expectedUtterance: [["not checked radio button", "any old radio button"],
321 ["any old radio button", "not checked radio button"]],
322 expectedBraille: [["( )", "any old radio button"],
323 ["any old radio button", "( )"]]
324 },{
325 accOrElmOrID: "radio_selected",
326 expectedUtterance: [["checked radio button", "a unique radio button"],
327 ["a unique radio button", "checked radio button"]],
328 expectedBraille: [["(x)", "a unique radio button"],
329 ["a unique radio button", "(x)"]]
330 },{
331 accOrElmOrID: "togglebutton_notpressed",
332 expectedUtterance: [["toggle button", "I ain't pressed"],
333 ["I ain't pressed", "toggle button"]],
334 expectedBraille: [["( )", "I ain't pressed"],
335 ["I ain't pressed", "( )"]]
336 },{
337 accOrElmOrID: "togglebutton_pressed",
338 expectedUtterance: [["pressed toggle button", "I am pressed!"],
339 ["I am pressed!", "pressed toggle button"]],
340 expectedBraille: [["(x)", "I am pressed!"],
341 ["I am pressed!", "(x)"]]
342 }
343 ];
345 // Test all possible utterance order preference values.
346 tests.forEach(function run(test) {
347 var utteranceOrderValues = [0, 1];
348 utteranceOrderValues.forEach(
349 function testUtteranceOrder(utteranceOrder) {
350 SpecialPowers.setIntPref(PREF_UTTERANCE_ORDER, utteranceOrder);
351 testOutput(test.expectedUtterance[utteranceOrder],
352 test.accOrElmOrID, test.oldAccOrElmOrID, 1);
353 testOutput(test.expectedBraille[utteranceOrder],
354 test.accOrElmOrID, test.oldAccOrElmOrID, 0);
355 }
356 );
357 });
359 // If there was an original utterance order preference, revert to it.
360 SpecialPowers.clearUserPref(PREF_UTTERANCE_ORDER);
361 SimpleTest.finish();
362 }
364 SimpleTest.waitForExplicitFinish();
365 addA11yLoadEvent(doTest);
367 </script>
368 </head>
369 <body>
370 <div id="root">
371 <a target="_blank"
372 href="https://bugzilla.mozilla.org/show_bug.cgi?id=753984"
373 title="[AccessFu] utterance order test">
374 Mozilla Bug 753984</a>
375 <a target="_blank"
376 href="https://bugzilla.mozilla.org/show_bug.cgi?id=758675"
377 title="[AccessFu] Add support for accDescription">
378 Mozilla Bug 758675</a>
379 <a target="_blank"
380 href="https://bugzilla.mozilla.org/show_bug.cgi?id=876475"
381 title="[AccessFu] Make braille output less verbose">
382 Mozilla Bug 876475</a>
383 <a target="_blank"
384 href="https://bugzilla.mozilla.org/show_bug.cgi?id=924284"
385 title="[AccessFu] Output accessible values">
386 Mozilla Bug 924284</a>
387 <a target="_blank"
388 href="https://bugzilla.mozilla.org/show_bug.cgi?id=925845"
389 title="[AccessFu] Unify output tests">
390 Mozilla Bug 925845</a>
391 <p id="display"></p>
392 <div id="content" style="display: none"></div>
393 <pre id="test"></pre>
394 <a id="anchor" href="#test" title="title"></a>
395 <a id="anchor_titleandtext" href="#test" title="goes to the tests">Tests</a>
396 <a id="anchor_duplicatedtitleandtext" href="#test" title="Tests">Tests</a>
397 <a id="anchor_arialabelandtext" href="#test" aria-label="Tests" title="goes to the tests">Tests</a>
398 <textarea id="textarea" cols="80" rows="5">
399 This is the text area text.
400 </textarea>
401 <h1 id="heading" title="Test heading"></h1>
402 <ol id="list">
403 <li id="li_one">list one</li>
404 </ol>
405 <dl id="dlist">
406 <dd id="dd_one">
407 dd one
408 </dd>
409 </dl>
410 <table>
411 <caption>Fruits and vegetables</caption>
412 <tr>
413 <td id="cell">
414 <ul style="list-style-type: none;">
415 <li><a id="apples" href="#">Apples</a></li>
416 <li><a id="bananas" href="#">Bananas</a></li>
417 <li><a href="#">Peaches</a></li>
418 <li>
419 <a href="#">
420 Plums
421 </a>
422 </li>
423 </ul>
424 </td>
425 </tr>
426 </table>
427 <button id="unavailableButton" disabled>I am unavailable</button>
428 <button id="expandedButton" aria-expanded="true">I am expanded</button>
429 <button id="collapsedButton" aria-expanded="false">I am collapsed</button>
430 <input id="requiredInput" required placeholder="I am required" />
431 <button id="hasPopupButton" aria-haspopup="true">I have a popup</button>
432 <div role="tablist">
433 <a id="tab1" href="#" role="tab" aria-selected="true">Account</a>
434 <a id="tab2" href="#" role="tab" aria-selected="false">Advanced</a>
435 </div>
436 <form id="form1">
437 <label id="label1"><input id="input1" type="checkbox">Orange</label>
438 <input id="input2" type="checkbox"><label id="label2" for="input2">Blue</label>
439 </form>
440 <label id="label3">First name: <input id="input3" value="Joe"></label>
441 <label id="label4">Points:
442 <input id="input4" type="range" name="points" min="1" max="10" value="3">
443 </label>
444 <label for="input5">Boring label</label><input id="input5" type="checkbox" checked></input>
445 <label for="password">Secret Password</label><input id="password" type="password"></input>
446 <label for="radio_unselected">any old radio button</label><input id="radio_unselected" type="radio"></input>
447 <label for="radio_selected">a unique radio button</label><input id="radio_selected" type="radio" checked></input>
448 <input id="date" type="date" value="2011-09-29" />
449 <input id="email" type="email" value="test@example.com" />
450 <input id="search" type="search" value="This is a search" />
451 <input id="tel" type="tel" value="555-5555" />
452 <input id="url" type="url" value="http://example.com" />
453 <input id="textInput" type="text" value="This is text." />
454 <label>Points: <input id="range" type="range" name="points" min="1" max="10" value="3"></label>
455 <div id="togglebutton_notpressed" aria-pressed="false" role="button" tabindex="-1">I ain't pressed</div>
456 <div id="togglebutton_pressed" aria-pressed="true" role="button" tabindex="-1">I am pressed!</div>
457 </div>
458 </body>
459 </html>