Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE html> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Tests AccessFu content integration</title> |
michael@0 | 5 | <meta charset="utf-8" /> |
michael@0 | 6 | <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
michael@0 | 7 | |
michael@0 | 8 | <script type="application/javascript" |
michael@0 | 9 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"> |
michael@0 | 10 | </script> |
michael@0 | 11 | <script type="application/javascript" |
michael@0 | 12 | src="chrome://mochikit/content/chrome-harness.js"> |
michael@0 | 13 | </script> |
michael@0 | 14 | |
michael@0 | 15 | <script type="application/javascript" src="../common.js"></script> |
michael@0 | 16 | <script type="application/javascript" src="../browser.js"></script> |
michael@0 | 17 | <script type="application/javascript" src="../events.js"></script> |
michael@0 | 18 | <script type="application/javascript" src="../role.js"></script> |
michael@0 | 19 | <script type="application/javascript" src="../states.js"></script> |
michael@0 | 20 | <script type="application/javascript" src="../layout.js"></script> |
michael@0 | 21 | <script type="application/javascript" src="jsatcommon.js"></script> |
michael@0 | 22 | |
michael@0 | 23 | <script type="application/javascript"> |
michael@0 | 24 | function doTest() { |
michael@0 | 25 | var doc = currentTabDocument(); |
michael@0 | 26 | var textTest = new AccessFuContentTest( |
michael@0 | 27 | [ |
michael@0 | 28 | // Read-only text tests |
michael@0 | 29 | [ContentMessages.simpleMoveFirst, { |
michael@0 | 30 | speak: 'These are my awards, Mother. From Army. ' + |
michael@0 | 31 | 'The seal is for marksmanship, and the gorilla is ' + |
michael@0 | 32 | 'for sand racing. Text content test document' |
michael@0 | 33 | }], |
michael@0 | 34 | [ContentMessages.moveNextBy('word'), { |
michael@0 | 35 | speak: 'These', |
michael@0 | 36 | speak_checkFunc: 'todo_is', // Bug 980509 |
michael@0 | 37 | android: [{ |
michael@0 | 38 | eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
michael@0 | 39 | fromIndex: 0, |
michael@0 | 40 | toIndex: 5 |
michael@0 | 41 | }] |
michael@0 | 42 | }], |
michael@0 | 43 | [ContentMessages.moveNextBy('word'), { |
michael@0 | 44 | speak: 'are', |
michael@0 | 45 | speak_checkFunc: 'todo_is', // Bug 980509 |
michael@0 | 46 | android: [{ |
michael@0 | 47 | eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
michael@0 | 48 | fromIndex: 6, |
michael@0 | 49 | toIndex: 9 |
michael@0 | 50 | }] |
michael@0 | 51 | }], |
michael@0 | 52 | [ContentMessages.moveNextBy('word'), { |
michael@0 | 53 | speak: 'my', |
michael@0 | 54 | speak_checkFunc: 'todo_is', // Bug 980509 |
michael@0 | 55 | android: [{ |
michael@0 | 56 | eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
michael@0 | 57 | fromIndex: 10, |
michael@0 | 58 | toIndex: 12 |
michael@0 | 59 | }] |
michael@0 | 60 | }], |
michael@0 | 61 | [ContentMessages.moveNextBy('word'), { |
michael@0 | 62 | speak: 'awards,', |
michael@0 | 63 | speak_checkFunc: 'todo_is', // Bug 980509 |
michael@0 | 64 | android: [{ |
michael@0 | 65 | eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
michael@0 | 66 | fromIndex: 13, |
michael@0 | 67 | toIndex: 20 |
michael@0 | 68 | }] |
michael@0 | 69 | }], |
michael@0 | 70 | [ContentMessages.moveNextBy('word'), { |
michael@0 | 71 | speak: 'Mother.', |
michael@0 | 72 | speak_checkFunc: 'todo_is', // Bug 980509 |
michael@0 | 73 | android: [{ |
michael@0 | 74 | eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
michael@0 | 75 | fromIndex: 21, |
michael@0 | 76 | toIndex: 28 |
michael@0 | 77 | }] |
michael@0 | 78 | }], |
michael@0 | 79 | [ContentMessages.movePreviousBy('word'), { |
michael@0 | 80 | speak: 'awards,', |
michael@0 | 81 | speak_checkFunc: 'todo_is', // Bug 980509 |
michael@0 | 82 | android: [{ |
michael@0 | 83 | eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
michael@0 | 84 | fromIndex: 13, |
michael@0 | 85 | toIndex: 20 |
michael@0 | 86 | }] |
michael@0 | 87 | }], |
michael@0 | 88 | [ContentMessages.movePreviousBy('word'), { |
michael@0 | 89 | speak: 'my', |
michael@0 | 90 | speak_checkFunc: 'todo_is', // Bug 980509 |
michael@0 | 91 | android: [{ |
michael@0 | 92 | eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
michael@0 | 93 | fromIndex: 10, |
michael@0 | 94 | toIndex: 12 |
michael@0 | 95 | }] |
michael@0 | 96 | }], |
michael@0 | 97 | [ContentMessages.movePreviousBy('word'), { |
michael@0 | 98 | speak: 'are', |
michael@0 | 99 | speak_checkFunc: 'todo_is', // Bug 980509 |
michael@0 | 100 | android: [{ |
michael@0 | 101 | eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
michael@0 | 102 | fromIndex: 6, |
michael@0 | 103 | toIndex: 9 |
michael@0 | 104 | }] |
michael@0 | 105 | }], |
michael@0 | 106 | [ContentMessages.movePreviousBy('word'), { |
michael@0 | 107 | speak: 'These', |
michael@0 | 108 | speak_checkFunc: 'todo_is', // Bug 980509 |
michael@0 | 109 | android: [{ |
michael@0 | 110 | eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
michael@0 | 111 | fromIndex: 0, |
michael@0 | 112 | toIndex: 5 |
michael@0 | 113 | }] |
michael@0 | 114 | }], |
michael@0 | 115 | // XXX: Bug 980510: doing next after text traversal should |
michael@0 | 116 | // bring us to the next paragraph. |
michael@0 | 117 | [ContentMessages.simpleMoveNext, { |
michael@0 | 118 | speak: 'You\'re a good guy, mon frere. ' + |
michael@0 | 119 | 'That means brother in French. ' + |
michael@0 | 120 | 'I don\'t know how I know that. ' + |
michael@0 | 121 | 'I took four years of Spanish.', |
michael@0 | 122 | speak_checkFunc: 'todo_is' // Bug 980510 |
michael@0 | 123 | }], |
michael@0 | 124 | // XXX: extra move op here because of bug 980510. |
michael@0 | 125 | [ContentMessages.simpleMoveNext, { |
michael@0 | 126 | speak: 'You\'re a good guy, mon frere. ' + |
michael@0 | 127 | 'That means brother in French. ' + |
michael@0 | 128 | 'I don\'t know how I know that. ' + |
michael@0 | 129 | 'I took four years of Spanish.', |
michael@0 | 130 | }], |
michael@0 | 131 | // XXX: Word boundary should be past the apostraphe. |
michael@0 | 132 | [ContentMessages.moveNextBy('word'), { |
michael@0 | 133 | speak: 'You\'re', |
michael@0 | 134 | speak_checkFunc: 'todo_is', // Bug 980509 |
michael@0 | 135 | android: [{ |
michael@0 | 136 | eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
michael@0 | 137 | fromIndex: 0, |
michael@0 | 138 | toIndex: 6 |
michael@0 | 139 | }], |
michael@0 | 140 | android_checkFunc: 'todo' // Bug 980512 |
michael@0 | 141 | }], |
michael@0 | 142 | |
michael@0 | 143 | // Editable text tests. |
michael@0 | 144 | [ContentMessages.focusSelector('textarea'), { |
michael@0 | 145 | speak: 'Please refrain from Mayoneggs during this ' + |
michael@0 | 146 | 'salmonella scare. text area' |
michael@0 | 147 | }], |
michael@0 | 148 | [null, { // When we first focus, caret is at 0. |
michael@0 | 149 | android: [{ |
michael@0 | 150 | eventType: AndroidEvent.VIEW_TEXT_SELECTION_CHANGED, |
michael@0 | 151 | brailleOutput: { |
michael@0 | 152 | selectionStart: 0, |
michael@0 | 153 | selectionEnd: 0 |
michael@0 | 154 | } |
michael@0 | 155 | }] |
michael@0 | 156 | } |
michael@0 | 157 | ], |
michael@0 | 158 | [ContentMessages.activateCurrent(10), { |
michael@0 | 159 | android: [{ |
michael@0 | 160 | eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
michael@0 | 161 | fromIndex: 0, |
michael@0 | 162 | toIndex: 10 |
michael@0 | 163 | }] |
michael@0 | 164 | }], |
michael@0 | 165 | [null, { |
michael@0 | 166 | android: [{ |
michael@0 | 167 | eventType: AndroidEvent.VIEW_TEXT_SELECTION_CHANGED, |
michael@0 | 168 | brailleOutput: { |
michael@0 | 169 | selectionStart: 10, |
michael@0 | 170 | selectionEnd: 10 |
michael@0 | 171 | } |
michael@0 | 172 | }] |
michael@0 | 173 | }], |
michael@0 | 174 | [ContentMessages.activateCurrent(20), { |
michael@0 | 175 | android: [{ |
michael@0 | 176 | eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
michael@0 | 177 | fromIndex: 10, |
michael@0 | 178 | toIndex: 20 |
michael@0 | 179 | }] |
michael@0 | 180 | }], |
michael@0 | 181 | [null, { |
michael@0 | 182 | android: [{ |
michael@0 | 183 | eventType: AndroidEvent.VIEW_TEXT_SELECTION_CHANGED, |
michael@0 | 184 | brailleOutput: { |
michael@0 | 185 | selectionStart: 20, |
michael@0 | 186 | selectionEnd: 20 |
michael@0 | 187 | } |
michael@0 | 188 | }] |
michael@0 | 189 | }], |
michael@0 | 190 | [ContentMessages.moveCaretNextBy('word'), { |
michael@0 | 191 | android: [{ |
michael@0 | 192 | eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
michael@0 | 193 | fromIndex: 20, |
michael@0 | 194 | toIndex: 29 |
michael@0 | 195 | }] |
michael@0 | 196 | }], |
michael@0 | 197 | [ContentMessages.moveCaretNextBy('word'), { |
michael@0 | 198 | android: [{ |
michael@0 | 199 | eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
michael@0 | 200 | fromIndex: 29, |
michael@0 | 201 | toIndex: 36 |
michael@0 | 202 | }] |
michael@0 | 203 | }], |
michael@0 | 204 | [ContentMessages.moveCaretNextBy('character'), { |
michael@0 | 205 | android: [{ |
michael@0 | 206 | eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
michael@0 | 207 | fromIndex: 36, |
michael@0 | 208 | toIndex: 37 |
michael@0 | 209 | }] |
michael@0 | 210 | }], |
michael@0 | 211 | [ContentMessages.moveCaretNextBy('character'), { |
michael@0 | 212 | android: [{ |
michael@0 | 213 | eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
michael@0 | 214 | fromIndex: 37, |
michael@0 | 215 | toIndex: 38 |
michael@0 | 216 | }] |
michael@0 | 217 | }], |
michael@0 | 218 | [ContentMessages.moveCaretNextBy('paragraph'), { |
michael@0 | 219 | android: [{ |
michael@0 | 220 | eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
michael@0 | 221 | fromIndex: 38, |
michael@0 | 222 | toIndex: 59 |
michael@0 | 223 | }] |
michael@0 | 224 | }], |
michael@0 | 225 | [ContentMessages.moveCaretPreviousBy('word'), { |
michael@0 | 226 | android: [{ |
michael@0 | 227 | eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
michael@0 | 228 | fromIndex: 53, |
michael@0 | 229 | toIndex: 59 |
michael@0 | 230 | }] |
michael@0 | 231 | }] |
michael@0 | 232 | ]); |
michael@0 | 233 | |
michael@0 | 234 | textTest.start(function () { |
michael@0 | 235 | closeBrowserWindow(); |
michael@0 | 236 | SimpleTest.finish(); |
michael@0 | 237 | }); |
michael@0 | 238 | } |
michael@0 | 239 | |
michael@0 | 240 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 241 | addLoadEvent( |
michael@0 | 242 | function () { |
michael@0 | 243 | openBrowserWindow( |
michael@0 | 244 | doTest, |
michael@0 | 245 | getRootDirectory(window.location.href) + "doc_content_text.html"); |
michael@0 | 246 | }); |
michael@0 | 247 | </script> |
michael@0 | 248 | </head> |
michael@0 | 249 | <body id="body"> |
michael@0 | 250 | |
michael@0 | 251 | <a target="_blank" |
michael@0 | 252 | title="Add tests for text editing and navigating" |
michael@0 | 253 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=972047">Mozilla Bug 933808</a> |
michael@0 | 254 | <p id="display"></p> |
michael@0 | 255 | <div id="content" style="display: none"></div> |
michael@0 | 256 | <pre id="test"> |
michael@0 | 257 | </pre> |
michael@0 | 258 | </body> |
michael@0 | 259 | </html> |