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