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.
1 /*
2 * Copyright 2012, Mozilla Foundation and contributors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
17 'use strict';
18 // <INJECTED SOURCE:START>
20 // THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
21 // DO NOT EDIT IT DIRECTLY
23 var exports = {};
25 var TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testCli1.js</p>";
27 function test() {
28 return Task.spawn(function() {
29 let options = yield helpers.openTab(TEST_URI);
30 yield helpers.openToolbar(options);
31 gcli.addItems(mockCommands.items);
33 yield helpers.runTests(options, exports);
35 gcli.removeItems(mockCommands.items);
36 yield helpers.closeToolbar(options);
37 yield helpers.closeTab(options);
38 }).then(finish, helpers.handleError);
39 }
41 // <INJECTED SOURCE:END>
43 // var assert = require('../testharness/assert');
44 // var helpers = require('./helpers');
46 exports.testBlank = function(options) {
47 return helpers.audit(options, [
48 {
49 setup: '',
50 check: {
51 input: '',
52 hints: '',
53 markup: '',
54 cursor: 0,
55 current: '__command',
56 status: 'ERROR'
57 },
58 post: function() {
59 assert.is(options.requisition.commandAssignment.value, undefined);
60 }
61 },
62 {
63 setup: ' ',
64 check: {
65 input: ' ',
66 hints: '',
67 markup: 'V',
68 cursor: 1,
69 current: '__command',
70 status: 'ERROR'
71 },
72 post: function() {
73 assert.is(options.requisition.commandAssignment.value, undefined);
74 }
75 },
76 {
77 name: '| ',
78 setup: function() {
79 return helpers.setInput(options, ' ', 0);
80 },
81 check: {
82 input: ' ',
83 hints: '',
84 markup: 'V',
85 cursor: 0,
86 current: '__command',
87 status: 'ERROR'
88 },
89 post: function() {
90 assert.is(options.requisition.commandAssignment.value, undefined);
91 }
92 }
93 ]);
94 };
96 exports.testDelete = function(options) {
97 return helpers.audit(options, [
98 {
99 setup: 'x<BACKSPACE>',
100 check: {
101 input: '',
102 hints: '',
103 markup: '',
104 cursor: 0,
105 current: '__command',
106 status: 'ERROR'
107 },
108 post: function() {
109 assert.is(options.requisition.commandAssignment.value, undefined);
110 }
111 }
112 ]);
113 };
115 exports.testIncompleteMultiMatch = function(options) {
116 return helpers.audit(options, [
117 {
118 setup: 'tsn ex',
119 check: {
120 input: 'tsn ex',
121 hints: 't',
122 markup: 'IIIVII',
123 cursor: 6,
124 current: '__command',
125 status: 'ERROR',
126 predictionsContains: [
127 'tsn ext', 'tsn exte', 'tsn exten', 'tsn extend'
128 ]
129 }
130 }
131 ]);
132 };
134 exports.testIncompleteSingleMatch = function(options) {
135 return helpers.audit(options, [
136 {
137 setup: 'tselar',
138 check: {
139 input: 'tselar',
140 hints: 'r',
141 markup: 'IIIIII',
142 cursor: 6,
143 current: '__command',
144 status: 'ERROR',
145 predictions: [ 'tselarr' ],
146 unassigned: [ ]
147 }
148 }
149 ]);
150 };
152 exports.testTsv = function(options) {
153 return helpers.audit(options, [
154 {
155 setup: 'tsv',
156 check: {
157 input: 'tsv',
158 hints: ' <optionType> <optionValue>',
159 markup: 'VVV',
160 cursor: 3,
161 current: '__command',
162 status: 'ERROR',
163 predictions: [ ],
164 unassigned: [ ],
165 args: {
166 command: { name: 'tsv' },
167 optionType: { arg: '', status: 'INCOMPLETE' },
168 optionValue: { arg: '', status: 'INCOMPLETE' }
169 }
170 }
171 },
172 {
173 setup: 'tsv ',
174 check: {
175 input: 'tsv ',
176 hints: 'option1 <optionValue>',
177 markup: 'VVVV',
178 cursor: 4,
179 current: 'optionType',
180 status: 'ERROR',
181 predictions: [ 'option1', 'option2', 'option3' ],
182 unassigned: [ ],
183 tooltipState: 'true:importantFieldFlag',
184 args: {
185 command: { name: 'tsv' },
186 optionType: { arg: '', status: 'INCOMPLETE' },
187 optionValue: { arg: '', status: 'INCOMPLETE' }
188 }
189 }
190 },
191 {
192 name: 'ts|v',
193 setup: function() {
194 return helpers.setInput(options, 'tsv ', 2);
195 },
196 check: {
197 input: 'tsv ',
198 hints: '<optionType> <optionValue>',
199 markup: 'VVVV',
200 cursor: 2,
201 current: '__command',
202 status: 'ERROR',
203 predictions: [ ],
204 unassigned: [ ],
205 args: {
206 command: { name: 'tsv' },
207 optionType: { arg: '', status: 'INCOMPLETE' },
208 optionValue: { arg: '', status: 'INCOMPLETE' }
209 }
210 }
211 },
212 {
213 setup: 'tsv o',
214 check: {
215 input: 'tsv o',
216 hints: 'ption1 <optionValue>',
217 markup: 'VVVVI',
218 cursor: 5,
219 current: 'optionType',
220 status: 'ERROR',
221 predictions: [ 'option1', 'option2', 'option3' ],
222 unassigned: [ ],
223 tooltipState: 'true:importantFieldFlag',
224 args: {
225 command: { name: 'tsv' },
226 optionType: {
227 value: undefined,
228 arg: ' o',
229 status: 'INCOMPLETE',
230 message: 'Value required for \'optionType\'.'
231 },
232 optionValue: {
233 value: undefined,
234 arg: '',
235 status: 'INCOMPLETE',
236 message: 'Value required for \'optionValue\'.'
237 }
238 }
239 }
240 },
241 {
242 setup: 'tsv option',
243 check: {
244 input: 'tsv option',
245 hints: '1 <optionValue>',
246 markup: 'VVVVIIIIII',
247 cursor: 10,
248 current: 'optionType',
249 status: 'ERROR',
250 predictions: [ 'option1', 'option2', 'option3' ],
251 unassigned: [ ],
252 tooltipState: 'true:importantFieldFlag',
253 args: {
254 command: { name: 'tsv' },
255 optionType: {
256 value: undefined,
257 arg: ' option',
258 status: 'INCOMPLETE',
259 message: 'Value required for \'optionType\'.'
260 },
261 optionValue: {
262 value: undefined,
263 arg: '',
264 status: 'INCOMPLETE',
265 message: 'Value required for \'optionValue\'.'
266 }
267 }
268 }
269 },
270 {
271 skipRemainingIf: options.isNoDom,
272 name: '|tsv option',
273 setup: function() {
274 return helpers.setInput(options, 'tsv option', 0);
275 },
276 check: {
277 input: 'tsv option',
278 hints: ' <optionValue>',
279 markup: 'VVVVEEEEEE',
280 cursor: 0,
281 current: '__command',
282 status: 'ERROR',
283 predictions: [ ],
284 unassigned: [ ],
285 args: {
286 command: { name: 'tsv' },
287 optionType: {
288 value: undefined,
289 arg: ' option',
290 status: 'INCOMPLETE',
291 message: 'Value required for \'optionType\'.'
292 },
293 optionValue: {
294 value: undefined,
295 arg: '',
296 status: 'INCOMPLETE',
297 message: 'Value required for \'optionValue\'.'
298 }
299 }
300 }
301 },
302 {
303 setup: 'tsv option ',
304 check: {
305 input: 'tsv option ',
306 hints: '<optionValue>',
307 markup: 'VVVVEEEEEEV',
308 cursor: 11,
309 current: 'optionValue',
310 status: 'ERROR',
311 predictions: [ ],
312 unassigned: [ ],
313 tooltipState: 'false:default',
314 args: {
315 command: { name: 'tsv' },
316 optionType: {
317 value: undefined,
318 arg: ' option ',
319 status: 'ERROR',
320 message: 'Can\'t use \'option\'.'
321 },
322 optionValue: {
323 value: undefined,
324 arg: '',
325 status: 'INCOMPLETE',
326 message: 'Value required for \'optionValue\'.'
327 }
328 }
329 }
330 },
331 {
332 setup: 'tsv option1',
333 check: {
334 input: 'tsv option1',
335 hints: ' <optionValue>',
336 markup: 'VVVVVVVVVVV',
337 cursor: 11,
338 current: 'optionType',
339 status: 'ERROR',
340 predictions: [ 'option1' ],
341 unassigned: [ ],
342 tooltipState: 'true:importantFieldFlag',
343 args: {
344 command: { name: 'tsv' },
345 optionType: {
346 value: 'string',
347 arg: ' option1',
348 status: 'VALID',
349 message: ''
350 },
351 optionValue: {
352 value: undefined,
353 arg: '',
354 status: 'INCOMPLETE',
355 message: 'Value required for \'optionValue\'.'
356 }
357 }
358 }
359 },
360 {
361 setup: 'tsv option1 ',
362 check: {
363 input: 'tsv option1 ',
364 hints: '<optionValue>',
365 markup: 'VVVVVVVVVVVV',
366 cursor: 12,
367 current: 'optionValue',
368 status: 'ERROR',
369 predictions: [ ],
370 unassigned: [ ],
371 args: {
372 command: { name: 'tsv' },
373 optionType: {
374 value: 'string',
375 arg: ' option1 ',
376 status: 'VALID',
377 message: ''
378 },
379 optionValue: {
380 value: undefined,
381 arg: '',
382 status: 'INCOMPLETE',
383 message: 'Value required for \'optionValue\'.'
384 }
385 }
386 }
387 },
388 {
389 setup: 'tsv option2',
390 check: {
391 input: 'tsv option2',
392 hints: ' <optionValue>',
393 markup: 'VVVVVVVVVVV',
394 cursor: 11,
395 current: 'optionType',
396 status: 'ERROR',
397 predictions: [ 'option2' ],
398 unassigned: [ ],
399 tooltipState: 'true:importantFieldFlag',
400 args: {
401 command: { name: 'tsv' },
402 optionType: {
403 value: 'number',
404 arg: ' option2',
405 status: 'VALID',
406 message: ''
407 },
408 optionValue: {
409 value: undefined,
410 arg: '',
411 status: 'INCOMPLETE',
412 message: 'Value required for \'optionValue\'.'
413 }
414 }
415 }
416 }
417 ]);
418 };
420 exports.testTsvValues = function(options) {
421 return helpers.audit(options, [
422 {
423 setup: 'tsv option1 6',
424 check: {
425 input: 'tsv option1 6',
426 hints: '',
427 markup: 'VVVVVVVVVVVVV',
428 cursor: 13,
429 current: 'optionValue',
430 status: 'VALID',
431 predictions: [ ],
432 unassigned: [ ],
433 args: {
434 command: { name: 'tsv' },
435 optionType: {
436 value: 'string',
437 arg: ' option1',
438 status: 'VALID',
439 message: ''
440 },
441 optionValue: {
442 arg: ' 6',
443 status: 'VALID',
444 message: ''
445 }
446 }
447 }
448 },
449 {
450 setup: 'tsv option2 6',
451 check: {
452 input: 'tsv option2 6',
453 hints: '',
454 markup: 'VVVVVVVVVVVVV',
455 cursor: 13,
456 current: 'optionValue',
457 status: 'VALID',
458 predictions: [ ],
459 unassigned: [ ],
460 args: {
461 command: { name: 'tsv' },
462 optionType: {
463 value: 'number',
464 arg: ' option2',
465 status: 'VALID',
466 message: ''
467 },
468 optionValue: {
469 arg: ' 6',
470 status: 'VALID',
471 message: ''
472 }
473 }
474 }
475 },
476 // Delegated remote types can't transfer value types so we only test for
477 // the value of 'value' when we're local
478 {
479 skipIf: options.isRemote,
480 setup: 'tsv option1 6',
481 check: {
482 args: {
483 optionValue: { value: '6' }
484 }
485 }
486 },
487 {
488 skipIf: options.isRemote,
489 setup: 'tsv option2 6',
490 check: {
491 args: {
492 optionValue: { value: 6 }
493 }
494 }
495 }
496 ]);
497 };
499 exports.testInvalid = function(options) {
500 return helpers.audit(options, [
501 {
502 setup: 'zxjq',
503 check: {
504 input: 'zxjq',
505 hints: '',
506 markup: 'EEEE',
507 cursor: 4,
508 current: '__command',
509 status: 'ERROR',
510 predictions: [ ],
511 unassigned: [ ],
512 tooltipState: 'true:isError'
513 }
514 },
515 {
516 setup: 'zxjq ',
517 check: {
518 input: 'zxjq ',
519 hints: '',
520 markup: 'EEEEV',
521 cursor: 5,
522 current: '__command',
523 status: 'ERROR',
524 predictions: [ ],
525 unassigned: [ ],
526 tooltipState: 'true:isError'
527 }
528 },
529 {
530 setup: 'zxjq one',
531 check: {
532 input: 'zxjq one',
533 hints: '',
534 markup: 'EEEEVEEE',
535 cursor: 8,
536 current: '__unassigned',
537 status: 'ERROR',
538 predictions: [ ],
539 unassigned: [ ' one' ],
540 tooltipState: 'true:isError'
541 }
542 }
543 ]);
544 };