|
1 <html> |
|
2 |
|
3 <head> |
|
4 <title>AccessFu test for enabling</title> |
|
5 |
|
6 <link rel="stylesheet" type="text/css" |
|
7 href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
|
8 <script type="application/javascript" |
|
9 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
|
10 <script type="application/javascript" |
|
11 src="../common.js"></script> |
|
12 <script type="application/javascript" |
|
13 src="./jsatcommon.js"></script> |
|
14 <script type="application/javascript"> |
|
15 |
|
16 function prefStart() { |
|
17 // Start AccessFu via pref. |
|
18 SpecialPowers.setIntPref("accessibility.accessfu.activate", 1); |
|
19 AccessFuTest.once_log("EventManager.start", AccessFuTest.nextTest); |
|
20 } |
|
21 |
|
22 // Listen for 'EventManager.stop' and enable AccessFu again. |
|
23 function settingsStart() { |
|
24 ok(true, "EventManager was stopped."); |
|
25 isnot(AccessFu._enabled, true, "AccessFu was disabled."); |
|
26 AccessFuTest.once([{ |
|
27 "method": "speak", |
|
28 "data": "Screen reader started", |
|
29 "options": { |
|
30 "enqueue": false |
|
31 } |
|
32 }], AccessFuTest.nextTest); |
|
33 // XXX: Bug 978076 - test start with SettingsManager. |
|
34 //navigator.mozSettings.createLock().set( |
|
35 // {'accessibility.screenreader': false}); |
|
36 AccessFu._enable() |
|
37 } |
|
38 |
|
39 // Make sure EventManager is started again. |
|
40 function settingsStop() { |
|
41 ok(AccessFu._enabled, "AccessFu was enabled again."); |
|
42 AccessFuTest.once([{ |
|
43 "method": "speak", |
|
44 "data": "Screen reader stopped", |
|
45 "options": { |
|
46 "enqueue": false |
|
47 } |
|
48 }], AccessFuTest.finish); |
|
49 // XXX: Bug 978076 - test stop with SettingsManager. |
|
50 //navigator.mozSettings.createLock().set( |
|
51 // {'accessibility.screenreader': false}); |
|
52 AccessFu._disable(); |
|
53 } |
|
54 |
|
55 // Listen for initial 'EventManager.start' and disable AccessFu. |
|
56 function prefStop() { |
|
57 ok(AccessFu._enabled, "AccessFu was started via preference."); |
|
58 AccessFuTest.once_log("EventManager.stop", AccessFuTest.nextTest); |
|
59 SpecialPowers.setIntPref("accessibility.accessfu.activate", 0); |
|
60 } |
|
61 |
|
62 function doTest() { |
|
63 AccessFuTest.addFunc(prefStart); |
|
64 AccessFuTest.addFunc(prefStop); |
|
65 AccessFuTest.addFunc(settingsStart); |
|
66 AccessFuTest.addFunc(settingsStop); |
|
67 AccessFuTest.waitForExplicitFinish(); |
|
68 AccessFuTest.runTests(); // Will call SimpleTest.finish(); |
|
69 } |
|
70 |
|
71 SimpleTest.waitForExplicitFinish(); |
|
72 addA11yLoadEvent(doTest); |
|
73 </script> |
|
74 |
|
75 </head> |
|
76 <body> |
|
77 <a target="_blank" |
|
78 href="https://bugzilla.mozilla.org/show_bug.cgi?id=811307" |
|
79 title="[AccessFu] Add mochitest for enabling"> |
|
80 Mozilla Bug 811307 |
|
81 </a> |
|
82 </body> |
|
83 </html> |