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 | /* |
michael@0 | 2 | * Copyright 2012, Mozilla Foundation and contributors |
michael@0 | 3 | * |
michael@0 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
michael@0 | 5 | * you may not use this file except in compliance with the License. |
michael@0 | 6 | * You may obtain a copy of the License at |
michael@0 | 7 | * |
michael@0 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
michael@0 | 9 | * |
michael@0 | 10 | * Unless required by applicable law or agreed to in writing, software |
michael@0 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
michael@0 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
michael@0 | 13 | * See the License for the specific language governing permissions and |
michael@0 | 14 | * limitations under the License. |
michael@0 | 15 | */ |
michael@0 | 16 | |
michael@0 | 17 | 'use strict'; |
michael@0 | 18 | // <INJECTED SOURCE:START> |
michael@0 | 19 | |
michael@0 | 20 | // THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT |
michael@0 | 21 | // DO NOT EDIT IT DIRECTLY |
michael@0 | 22 | |
michael@0 | 23 | var exports = {}; |
michael@0 | 24 | |
michael@0 | 25 | var TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testRemoteXhr.js</p>"; |
michael@0 | 26 | |
michael@0 | 27 | function test() { |
michael@0 | 28 | return Task.spawn(function() { |
michael@0 | 29 | let options = yield helpers.openTab(TEST_URI); |
michael@0 | 30 | yield helpers.openToolbar(options); |
michael@0 | 31 | gcli.addItems(mockCommands.items); |
michael@0 | 32 | |
michael@0 | 33 | yield helpers.runTests(options, exports); |
michael@0 | 34 | |
michael@0 | 35 | gcli.removeItems(mockCommands.items); |
michael@0 | 36 | yield helpers.closeToolbar(options); |
michael@0 | 37 | yield helpers.closeTab(options); |
michael@0 | 38 | }).then(finish, helpers.handleError); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | // <INJECTED SOURCE:END> |
michael@0 | 42 | |
michael@0 | 43 | // var assert = require('../testharness/assert'); |
michael@0 | 44 | // var helpers = require('./helpers'); |
michael@0 | 45 | |
michael@0 | 46 | // testRemoteWs and testRemoteXhr are virtually identical. |
michael@0 | 47 | // Changes made here should be made there too. |
michael@0 | 48 | // They are kept separate to save adding complexity to the test system and so |
michael@0 | 49 | // to help us select the test that are available in different environments |
michael@0 | 50 | |
michael@0 | 51 | exports.testRemoteXhr = function(options) { |
michael@0 | 52 | return helpers.audit(options, [ |
michael@0 | 53 | { |
michael@0 | 54 | skipRemainingIf: options.isRemote || options.isNode || options.isFirefox, |
michael@0 | 55 | setup: 'remote ', |
michael@0 | 56 | check: { |
michael@0 | 57 | input: 'remote ', |
michael@0 | 58 | hints: '', |
michael@0 | 59 | markup: 'EEEEEEV', |
michael@0 | 60 | cursor: 7, |
michael@0 | 61 | current: '__command', |
michael@0 | 62 | status: 'ERROR', |
michael@0 | 63 | options: [ ], |
michael@0 | 64 | message: 'Can\'t use \'remote\'.', |
michael@0 | 65 | predictions: [ ], |
michael@0 | 66 | unassigned: [ ], |
michael@0 | 67 | } |
michael@0 | 68 | }, |
michael@0 | 69 | { |
michael@0 | 70 | setup: 'connect remote', |
michael@0 | 71 | check: { |
michael@0 | 72 | args: { |
michael@0 | 73 | prefix: { value: 'remote' }, |
michael@0 | 74 | url: { value: undefined } |
michael@0 | 75 | } |
michael@0 | 76 | }, |
michael@0 | 77 | exec: { |
michael@0 | 78 | error: false |
michael@0 | 79 | } |
michael@0 | 80 | }, |
michael@0 | 81 | { |
michael@0 | 82 | setup: 'disconnect remote', |
michael@0 | 83 | check: { |
michael@0 | 84 | args: { |
michael@0 | 85 | prefix: { |
michael@0 | 86 | value: function(connection) { |
michael@0 | 87 | assert.is(connection.prefix, 'remote', 'disconnecting remote'); |
michael@0 | 88 | } |
michael@0 | 89 | } |
michael@0 | 90 | } |
michael@0 | 91 | }, |
michael@0 | 92 | exec: { |
michael@0 | 93 | output: /^Removed [0-9]* commands.$/, |
michael@0 | 94 | type: 'string', |
michael@0 | 95 | error: false |
michael@0 | 96 | } |
michael@0 | 97 | }, |
michael@0 | 98 | { |
michael@0 | 99 | setup: 'connect remote --method xhr', |
michael@0 | 100 | check: { |
michael@0 | 101 | args: { |
michael@0 | 102 | prefix: { value: 'remote' }, |
michael@0 | 103 | url: { value: undefined } |
michael@0 | 104 | } |
michael@0 | 105 | }, |
michael@0 | 106 | exec: { |
michael@0 | 107 | error: false |
michael@0 | 108 | } |
michael@0 | 109 | }, |
michael@0 | 110 | { |
michael@0 | 111 | setup: 'disconnect remote', |
michael@0 | 112 | check: { |
michael@0 | 113 | args: { |
michael@0 | 114 | prefix: { |
michael@0 | 115 | value: function(connection) { |
michael@0 | 116 | assert.is(connection.prefix, 'remote', 'disconnecting remote'); |
michael@0 | 117 | } |
michael@0 | 118 | } |
michael@0 | 119 | } |
michael@0 | 120 | }, |
michael@0 | 121 | exec: { |
michael@0 | 122 | output: /^Removed [0-9]* commands.$/, |
michael@0 | 123 | type: 'string', |
michael@0 | 124 | error: false |
michael@0 | 125 | } |
michael@0 | 126 | }, |
michael@0 | 127 | { |
michael@0 | 128 | setup: 'connect remote --method xhr', |
michael@0 | 129 | check: { |
michael@0 | 130 | args: { |
michael@0 | 131 | prefix: { value: 'remote' }, |
michael@0 | 132 | url: { value: undefined } |
michael@0 | 133 | } |
michael@0 | 134 | }, |
michael@0 | 135 | exec: { |
michael@0 | 136 | output: /^Added [0-9]* commands.$/, |
michael@0 | 137 | type: 'string', |
michael@0 | 138 | error: false |
michael@0 | 139 | } |
michael@0 | 140 | }, |
michael@0 | 141 | { |
michael@0 | 142 | setup: 'remote ', |
michael@0 | 143 | check: { |
michael@0 | 144 | input: 'remote ', |
michael@0 | 145 | // PhantomJS fails on this. Unsure why |
michael@0 | 146 | // hints: ' {', |
michael@0 | 147 | markup: 'IIIIIIV', |
michael@0 | 148 | status: 'ERROR', |
michael@0 | 149 | optionsIncludes: [ |
michael@0 | 150 | 'remote', 'remote cd', 'remote context', 'remote echo', |
michael@0 | 151 | 'remote exec', 'remote exit', 'remote firefox', 'remote help', |
michael@0 | 152 | 'remote intro', 'remote make' |
michael@0 | 153 | ], |
michael@0 | 154 | message: '', |
michael@0 | 155 | predictionsIncludes: [ 'remote' ], |
michael@0 | 156 | unassigned: [ ], |
michael@0 | 157 | } |
michael@0 | 158 | }, |
michael@0 | 159 | { |
michael@0 | 160 | setup: 'remote echo hello world', |
michael@0 | 161 | check: { |
michael@0 | 162 | input: 'remote echo hello world', |
michael@0 | 163 | hints: '', |
michael@0 | 164 | markup: 'VVVVVVVVVVVVVVVVVVVVVVV', |
michael@0 | 165 | cursor: 23, |
michael@0 | 166 | current: 'message', |
michael@0 | 167 | status: 'VALID', |
michael@0 | 168 | options: [ ], |
michael@0 | 169 | message: '', |
michael@0 | 170 | predictions: [ ], |
michael@0 | 171 | unassigned: [ ], |
michael@0 | 172 | args: { |
michael@0 | 173 | command: { name: 'remote echo' }, |
michael@0 | 174 | message: { |
michael@0 | 175 | value: 'hello world', |
michael@0 | 176 | arg: ' hello world', |
michael@0 | 177 | status: 'VALID', |
michael@0 | 178 | message: '' |
michael@0 | 179 | } |
michael@0 | 180 | } |
michael@0 | 181 | }, |
michael@0 | 182 | exec: { |
michael@0 | 183 | output: 'hello world', |
michael@0 | 184 | type: 'string', |
michael@0 | 185 | error: false |
michael@0 | 186 | } |
michael@0 | 187 | }, |
michael@0 | 188 | { |
michael@0 | 189 | setup: 'remote exec ls', |
michael@0 | 190 | check: { |
michael@0 | 191 | input: 'remote exec ls', |
michael@0 | 192 | hints: '', |
michael@0 | 193 | markup: 'VVVVVVVVVVVVVV', |
michael@0 | 194 | cursor: 14, |
michael@0 | 195 | current: 'command', |
michael@0 | 196 | status: 'VALID', |
michael@0 | 197 | options: [ ], |
michael@0 | 198 | message: '', |
michael@0 | 199 | predictions: [ ], |
michael@0 | 200 | unassigned: [ ], |
michael@0 | 201 | args: { |
michael@0 | 202 | command: { |
michael@0 | 203 | value: 'ls', |
michael@0 | 204 | arg: ' ls', |
michael@0 | 205 | status: 'VALID', |
michael@0 | 206 | message: '' |
michael@0 | 207 | } |
michael@0 | 208 | } |
michael@0 | 209 | }, |
michael@0 | 210 | exec: { |
michael@0 | 211 | // output: '', We can't rely on the contents of the FS |
michael@0 | 212 | type: 'output', |
michael@0 | 213 | error: false |
michael@0 | 214 | } |
michael@0 | 215 | }, |
michael@0 | 216 | { |
michael@0 | 217 | setup: 'remote sleep mistake', |
michael@0 | 218 | check: { |
michael@0 | 219 | input: 'remote sleep mistake', |
michael@0 | 220 | hints: '', |
michael@0 | 221 | markup: 'VVVVVVVVVVVVVEEEEEEE', |
michael@0 | 222 | cursor: 20, |
michael@0 | 223 | current: 'length', |
michael@0 | 224 | status: 'ERROR', |
michael@0 | 225 | options: [ ], |
michael@0 | 226 | message: 'Can\'t convert "mistake" to a number.', |
michael@0 | 227 | predictions: [ ], |
michael@0 | 228 | unassigned: [ ], |
michael@0 | 229 | args: { |
michael@0 | 230 | command: { name: 'remote sleep' }, |
michael@0 | 231 | length: { |
michael@0 | 232 | value: undefined, |
michael@0 | 233 | arg: ' mistake', |
michael@0 | 234 | status: 'ERROR', |
michael@0 | 235 | message: 'Can\'t convert "mistake" to a number.' |
michael@0 | 236 | } |
michael@0 | 237 | } |
michael@0 | 238 | } |
michael@0 | 239 | }, |
michael@0 | 240 | { |
michael@0 | 241 | setup: 'remote sleep 1', |
michael@0 | 242 | check: { |
michael@0 | 243 | input: 'remote sleep 1', |
michael@0 | 244 | hints: '', |
michael@0 | 245 | markup: 'VVVVVVVVVVVVVV', |
michael@0 | 246 | cursor: 14, |
michael@0 | 247 | current: 'length', |
michael@0 | 248 | status: 'VALID', |
michael@0 | 249 | options: [ ], |
michael@0 | 250 | message: '', |
michael@0 | 251 | predictions: [ ], |
michael@0 | 252 | unassigned: [ ], |
michael@0 | 253 | args: { |
michael@0 | 254 | command: { name: 'remote sleep' }, |
michael@0 | 255 | length: { value: 1, arg: ' 1', status: 'VALID', message: '' } |
michael@0 | 256 | } |
michael@0 | 257 | }, |
michael@0 | 258 | exec: { |
michael@0 | 259 | output: 'Done', |
michael@0 | 260 | type: 'string', |
michael@0 | 261 | error: false |
michael@0 | 262 | } |
michael@0 | 263 | }, |
michael@0 | 264 | { |
michael@0 | 265 | setup: 'remote help ', |
michael@0 | 266 | skipIf: true, // The help command is not remotable |
michael@0 | 267 | check: { |
michael@0 | 268 | input: 'remote help ', |
michael@0 | 269 | hints: '[search]', |
michael@0 | 270 | markup: 'VVVVVVVVVVVV', |
michael@0 | 271 | cursor: 12, |
michael@0 | 272 | current: 'search', |
michael@0 | 273 | status: 'VALID', |
michael@0 | 274 | options: [ ], |
michael@0 | 275 | message: '', |
michael@0 | 276 | predictions: [ ], |
michael@0 | 277 | unassigned: [ ], |
michael@0 | 278 | args: { |
michael@0 | 279 | command: { name: 'remote help' }, |
michael@0 | 280 | search: { |
michael@0 | 281 | value: undefined, |
michael@0 | 282 | arg: '', |
michael@0 | 283 | status: 'VALID', |
michael@0 | 284 | message: '' |
michael@0 | 285 | } |
michael@0 | 286 | } |
michael@0 | 287 | }, |
michael@0 | 288 | exec: { |
michael@0 | 289 | output: '', |
michael@0 | 290 | type: 'string', |
michael@0 | 291 | error: false |
michael@0 | 292 | } |
michael@0 | 293 | }, |
michael@0 | 294 | { |
michael@0 | 295 | setup: 'remote intro', |
michael@0 | 296 | check: { |
michael@0 | 297 | input: 'remote intro', |
michael@0 | 298 | hints: '', |
michael@0 | 299 | markup: 'VVVVVVVVVVVV', |
michael@0 | 300 | cursor: 12, |
michael@0 | 301 | current: '__command', |
michael@0 | 302 | status: 'VALID', |
michael@0 | 303 | options: [ ], |
michael@0 | 304 | message: '', |
michael@0 | 305 | predictions: [ ], |
michael@0 | 306 | unassigned: [ ], |
michael@0 | 307 | args: { |
michael@0 | 308 | command: { name: 'remote intro' } |
michael@0 | 309 | } |
michael@0 | 310 | }, |
michael@0 | 311 | exec: { |
michael@0 | 312 | output: [ |
michael@0 | 313 | /^GCLI is an experiment/, |
michael@0 | 314 | /F1\/Escape/ |
michael@0 | 315 | ], |
michael@0 | 316 | type: 'intro', |
michael@0 | 317 | error: false |
michael@0 | 318 | } |
michael@0 | 319 | }, |
michael@0 | 320 | { |
michael@0 | 321 | setup: 'context remote', |
michael@0 | 322 | check: { |
michael@0 | 323 | input: 'context remote', |
michael@0 | 324 | // hints: ' {', |
michael@0 | 325 | markup: 'VVVVVVVVVVVVVV', |
michael@0 | 326 | cursor: 14, |
michael@0 | 327 | current: 'prefix', |
michael@0 | 328 | status: 'VALID', |
michael@0 | 329 | optionsContains: [ |
michael@0 | 330 | 'remote', 'remote cd', 'remote echo', 'remote exec', 'remote exit', |
michael@0 | 331 | 'remote firefox', 'remote help', 'remote intro', 'remote make' |
michael@0 | 332 | ], |
michael@0 | 333 | message: '', |
michael@0 | 334 | // predictionsContains: [ |
michael@0 | 335 | // 'remote', 'remote cd', 'remote echo', 'remote exec', 'remote exit', |
michael@0 | 336 | // 'remote firefox', 'remote help', 'remote intro', 'remote make', |
michael@0 | 337 | // 'remote pref' |
michael@0 | 338 | // ], |
michael@0 | 339 | unassigned: [ ], |
michael@0 | 340 | args: { |
michael@0 | 341 | command: { name: 'context' }, |
michael@0 | 342 | prefix: { |
michael@0 | 343 | arg: ' remote', |
michael@0 | 344 | status: 'VALID', |
michael@0 | 345 | message: '' |
michael@0 | 346 | } |
michael@0 | 347 | } |
michael@0 | 348 | }, |
michael@0 | 349 | exec: { |
michael@0 | 350 | output: 'Using remote as a command prefix', |
michael@0 | 351 | type: 'string', |
michael@0 | 352 | error: false |
michael@0 | 353 | } |
michael@0 | 354 | }, |
michael@0 | 355 | { |
michael@0 | 356 | setup: 'exec ls', |
michael@0 | 357 | check: { |
michael@0 | 358 | input: 'exec ls', |
michael@0 | 359 | hints: '', |
michael@0 | 360 | markup: 'VVVVVVV', |
michael@0 | 361 | cursor: 7, |
michael@0 | 362 | current: 'command', |
michael@0 | 363 | status: 'VALID', |
michael@0 | 364 | options: [ ], |
michael@0 | 365 | message: '', |
michael@0 | 366 | predictions: [ ], |
michael@0 | 367 | unassigned: [ ], |
michael@0 | 368 | args: { |
michael@0 | 369 | command: { value: 'ls', arg: ' ls', status: 'VALID', message: '' }, |
michael@0 | 370 | } |
michael@0 | 371 | }, |
michael@0 | 372 | exec: { |
michael@0 | 373 | // output: '', We can't rely on the contents of the filesystem |
michael@0 | 374 | type: 'output', |
michael@0 | 375 | error: false |
michael@0 | 376 | } |
michael@0 | 377 | }, |
michael@0 | 378 | { |
michael@0 | 379 | setup: 'echo hello world', |
michael@0 | 380 | check: { |
michael@0 | 381 | input: 'echo hello world', |
michael@0 | 382 | hints: '', |
michael@0 | 383 | markup: 'VVVVVVVVVVVVVVVV', |
michael@0 | 384 | cursor: 16, |
michael@0 | 385 | current: 'message', |
michael@0 | 386 | status: 'VALID', |
michael@0 | 387 | options: [ ], |
michael@0 | 388 | message: '', |
michael@0 | 389 | predictions: [ ], |
michael@0 | 390 | unassigned: [ ], |
michael@0 | 391 | args: { |
michael@0 | 392 | command: { name: 'remote echo' }, |
michael@0 | 393 | message: { |
michael@0 | 394 | value: 'hello world', |
michael@0 | 395 | arg: ' hello world', |
michael@0 | 396 | status: 'VALID', |
michael@0 | 397 | message: '' |
michael@0 | 398 | } |
michael@0 | 399 | } |
michael@0 | 400 | }, |
michael@0 | 401 | exec: { |
michael@0 | 402 | output: /^hello world$/, |
michael@0 | 403 | type: 'string', |
michael@0 | 404 | error: false |
michael@0 | 405 | } |
michael@0 | 406 | }, |
michael@0 | 407 | { |
michael@0 | 408 | setup: 'context', |
michael@0 | 409 | check: { |
michael@0 | 410 | input: 'context', |
michael@0 | 411 | hints: ' [prefix]', |
michael@0 | 412 | markup: 'VVVVVVV', |
michael@0 | 413 | cursor: 7, |
michael@0 | 414 | current: '__command', |
michael@0 | 415 | status: 'VALID', |
michael@0 | 416 | optionsContains: [ |
michael@0 | 417 | 'remote', 'remote cd', 'remote echo', 'remote exec', 'remote exit', |
michael@0 | 418 | 'remote firefox', 'remote help', 'remote intro', 'remote make' |
michael@0 | 419 | ], |
michael@0 | 420 | message: '', |
michael@0 | 421 | predictions: [ ], |
michael@0 | 422 | unassigned: [ ], |
michael@0 | 423 | args: { |
michael@0 | 424 | command: { name: 'context' }, |
michael@0 | 425 | prefix: { value: undefined, arg: '', status: 'VALID', message: '' } |
michael@0 | 426 | } |
michael@0 | 427 | }, |
michael@0 | 428 | exec: { |
michael@0 | 429 | output: 'Command prefix is unset', |
michael@0 | 430 | type: 'string', |
michael@0 | 431 | error: false |
michael@0 | 432 | } |
michael@0 | 433 | }, |
michael@0 | 434 | { |
michael@0 | 435 | setup: 'disconnect ', |
michael@0 | 436 | check: { |
michael@0 | 437 | input: 'disconnect ', |
michael@0 | 438 | hints: 'remote', |
michael@0 | 439 | markup: 'VVVVVVVVVVV', |
michael@0 | 440 | cursor: 11, |
michael@0 | 441 | current: 'prefix', |
michael@0 | 442 | status: 'ERROR', |
michael@0 | 443 | options: [ 'remote' ], |
michael@0 | 444 | message: '', |
michael@0 | 445 | predictions: [ 'remote' ], |
michael@0 | 446 | unassigned: [ ], |
michael@0 | 447 | args: { |
michael@0 | 448 | command: { name: 'disconnect' }, |
michael@0 | 449 | prefix: { |
michael@0 | 450 | value: undefined, |
michael@0 | 451 | arg: '', |
michael@0 | 452 | status: 'INCOMPLETE', |
michael@0 | 453 | message: 'Value required for \'prefix\'.' |
michael@0 | 454 | } |
michael@0 | 455 | } |
michael@0 | 456 | } |
michael@0 | 457 | }, |
michael@0 | 458 | { |
michael@0 | 459 | setup: 'disconnect remote', |
michael@0 | 460 | check: { |
michael@0 | 461 | input: 'disconnect remote', |
michael@0 | 462 | hints: '', |
michael@0 | 463 | markup: 'VVVVVVVVVVVVVVVVV', |
michael@0 | 464 | status: 'VALID', |
michael@0 | 465 | message: '', |
michael@0 | 466 | unassigned: [ ], |
michael@0 | 467 | args: { |
michael@0 | 468 | prefix: { |
michael@0 | 469 | value: function(connection) { |
michael@0 | 470 | assert.is(connection.prefix, 'remote', 'disconnecting remote'); |
michael@0 | 471 | }, |
michael@0 | 472 | arg: ' remote', |
michael@0 | 473 | status: 'VALID', |
michael@0 | 474 | message: '' |
michael@0 | 475 | } |
michael@0 | 476 | } |
michael@0 | 477 | }, |
michael@0 | 478 | exec: { |
michael@0 | 479 | output: /^Removed [0-9]* commands.$/, |
michael@0 | 480 | type: 'string', |
michael@0 | 481 | error: false |
michael@0 | 482 | } |
michael@0 | 483 | }, |
michael@0 | 484 | { |
michael@0 | 485 | setup: 'remote ', |
michael@0 | 486 | check: { |
michael@0 | 487 | input: 'remote ', |
michael@0 | 488 | hints: '', |
michael@0 | 489 | markup: 'EEEEEEV', |
michael@0 | 490 | cursor: 7, |
michael@0 | 491 | current: '__command', |
michael@0 | 492 | status: 'ERROR', |
michael@0 | 493 | options: [ ], |
michael@0 | 494 | message: 'Can\'t use \'remote\'.', |
michael@0 | 495 | predictions: [ ], |
michael@0 | 496 | unassigned: [ ], |
michael@0 | 497 | } |
michael@0 | 498 | } |
michael@0 | 499 | ]); |
michael@0 | 500 | }; |