browser/devtools/commandline/test/browser_gcli_file.js

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:46f903f42b44
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 */
16
17 'use strict';
18 // <INJECTED SOURCE:START>
19
20 // THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
21 // DO NOT EDIT IT DIRECTLY
22
23 var exports = {};
24
25 var TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testFile.js</p>";
26
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);
32
33 yield helpers.runTests(options, exports);
34
35 gcli.removeItems(mockCommands.items);
36 yield helpers.closeToolbar(options);
37 yield helpers.closeTab(options);
38 }).then(finish, helpers.handleError);
39 }
40
41 // <INJECTED SOURCE:END>
42
43 // var helpers = require('./helpers');
44
45 var local = false;
46
47 exports.testBasic = function(options) {
48 return helpers.audit(options, [
49 {
50 // These tests require us to be using node directly or to be in
51 // PhantomJS connected to an execute enabled node server or to be in
52 // firefox.
53 skipRemainingIf: options.isPhantomjs || options.isFirefox,
54 setup: 'tsfile open /',
55 check: {
56 input: 'tsfile open /',
57 hints: '',
58 markup: 'VVVVVVVVVVVVI',
59 cursor: 13,
60 current: 'p1',
61 status: 'ERROR',
62 message: '\'/\' is not a file',
63 args: {
64 command: { name: 'tsfile open' },
65 p1: {
66 value: undefined,
67 arg: ' /',
68 status: 'INCOMPLETE',
69 message: '\'/\' is not a file'
70 }
71 }
72 }
73 },
74 {
75 setup: 'tsfile open /zxcv',
76 check: {
77 input: 'tsfile open /zxcv',
78 // hints: ' -> /etc/',
79 markup: 'VVVVVVVVVVVVIIIII',
80 cursor: 17,
81 current: 'p1',
82 status: 'ERROR',
83 message: '\'/zxcv\' doesn\'t exist',
84 args: {
85 command: { name: 'tsfile open' },
86 p1: {
87 value: undefined,
88 arg: ' /zxcv',
89 status: 'INCOMPLETE',
90 message: '\'/zxcv\' doesn\'t exist'
91 }
92 }
93 }
94 },
95 {
96 skipIf: !local,
97 setup: 'tsfile open /mach_kernel',
98 check: {
99 input: 'tsfile open /mach_kernel',
100 hints: '',
101 markup: 'VVVVVVVVVVVVVVVVVVVVVVVV',
102 cursor: 24,
103 current: 'p1',
104 status: 'VALID',
105 message: '',
106 args: {
107 command: { name: 'tsfile open' },
108 p1: {
109 value: '/mach_kernel',
110 arg: ' /mach_kernel',
111 status: 'VALID',
112 message: ''
113 }
114 }
115 }
116 },
117 {
118 setup: 'tsfile saveas /',
119 check: {
120 input: 'tsfile saveas /',
121 hints: '',
122 markup: 'VVVVVVVVVVVVVVI',
123 cursor: 15,
124 current: 'p1',
125 status: 'ERROR',
126 message: '\'/\' already exists',
127 args: {
128 command: { name: 'tsfile saveas' },
129 p1: {
130 value: undefined,
131 arg: ' /',
132 status: 'INCOMPLETE',
133 message: '\'/\' already exists'
134 }
135 }
136 }
137 },
138 {
139 setup: 'tsfile saveas /zxcv',
140 check: {
141 input: 'tsfile saveas /zxcv',
142 // hints: ' -> /etc/',
143 markup: 'VVVVVVVVVVVVVVVVVVV',
144 cursor: 19,
145 current: 'p1',
146 status: 'VALID',
147 message: '',
148 args: {
149 command: { name: 'tsfile saveas' },
150 p1: {
151 value: '/zxcv',
152 arg: ' /zxcv',
153 status: 'VALID',
154 message: ''
155 }
156 }
157 }
158 },
159 {
160 skipIf: !local,
161 setup: 'tsfile saveas /mach_kernel',
162 check: {
163 input: 'tsfile saveas /mach_kernel',
164 hints: '',
165 markup: 'VVVVVVVVVVVVVVIIIIIIIIIIII',
166 cursor: 26,
167 current: 'p1',
168 status: 'ERROR',
169 message: '\'/mach_kernel\' already exists',
170 args: {
171 command: { name: 'tsfile saveas' },
172 p1: {
173 value: undefined,
174 arg: ' /mach_kernel',
175 status: 'INCOMPLETE',
176 message: '\'/mach_kernel\' already exists'
177 }
178 }
179 }
180 },
181 {
182 setup: 'tsfile save /',
183 check: {
184 input: 'tsfile save /',
185 hints: '',
186 markup: 'VVVVVVVVVVVVI',
187 cursor: 13,
188 current: 'p1',
189 status: 'ERROR',
190 message: '\'/\' is not a file',
191 args: {
192 command: { name: 'tsfile save' },
193 p1: {
194 value: undefined,
195 arg: ' /',
196 status: 'INCOMPLETE',
197 message: '\'/\' is not a file'
198 }
199 }
200 }
201 },
202 {
203 setup: 'tsfile save /zxcv',
204 check: {
205 input: 'tsfile save /zxcv',
206 // hints: ' -> /etc/',
207 markup: 'VVVVVVVVVVVVVVVVV',
208 cursor: 17,
209 current: 'p1',
210 status: 'VALID',
211 message: '',
212 args: {
213 command: { name: 'tsfile save' },
214 p1: {
215 value: '/zxcv',
216 arg: ' /zxcv',
217 status: 'VALID',
218 message: ''
219 }
220 }
221 }
222 },
223 {
224 skipIf: !local,
225 setup: 'tsfile save /mach_kernel',
226 check: {
227 input: 'tsfile save /mach_kernel',
228 hints: '',
229 markup: 'VVVVVVVVVVVVVVVVVVVVVVVV',
230 cursor: 24,
231 current: 'p1',
232 status: 'VALID',
233 message: '',
234 args: {
235 command: { name: 'tsfile save' },
236 p1: {
237 value: '/mach_kernel',
238 arg: ' /mach_kernel',
239 status: 'VALID',
240 message: ''
241 }
242 }
243 }
244 },
245 {
246 setup: 'tsfile cd /',
247 check: {
248 input: 'tsfile cd /',
249 hints: '',
250 markup: 'VVVVVVVVVVV',
251 cursor: 11,
252 current: 'p1',
253 status: 'VALID',
254 message: '',
255 args: {
256 command: { name: 'tsfile cd' },
257 p1: {
258 value: '/',
259 arg: ' /',
260 status: 'VALID',
261 message: ''
262 }
263 }
264 }
265 },
266 {
267 setup: 'tsfile cd /zxcv',
268 check: {
269 input: 'tsfile cd /zxcv',
270 // hints: ' -> /dev/',
271 markup: 'VVVVVVVVVVIIIII',
272 cursor: 15,
273 current: 'p1',
274 status: 'ERROR',
275 message: '\'/zxcv\' doesn\'t exist',
276 args: {
277 command: { name: 'tsfile cd' },
278 p1: {
279 value: undefined,
280 arg: ' /zxcv',
281 status: 'INCOMPLETE',
282 message: '\'/zxcv\' doesn\'t exist'
283 }
284 }
285 }
286 },
287 {
288 skipIf: true || !local,
289 setup: 'tsfile cd /etc/passwd',
290 check: {
291 input: 'tsfile cd /etc/passwd',
292 hints: ' -> /etc/pam.d/',
293 markup: 'VVVVVVVVVVIIIIIIIIIII',
294 cursor: 21,
295 current: 'p1',
296 status: 'ERROR',
297 message: '\'/etc/passwd\' is not a directory',
298 args: {
299 command: { name: 'tsfile cd' },
300 p1: {
301 value: undefined,
302 arg: ' /etc/passwd',
303 status: 'INCOMPLETE',
304 message: '\'/etc/passwd\' is not a directory'
305 }
306 }
307 }
308 },
309 {
310 setup: 'tsfile mkdir /',
311 check: {
312 input: 'tsfile mkdir /',
313 hints: '',
314 markup: 'VVVVVVVVVVVVVI',
315 cursor: 14,
316 current: 'p1',
317 status: 'ERROR',
318 message: ''/' already exists',
319 args: {
320 command: { name: 'tsfile mkdir' },
321 p1: {
322 value: undefined,
323 arg: ' /',
324 status: 'INCOMPLETE',
325 message: '\'/\' already exists'
326 }
327 }
328 }
329 },
330 {
331 setup: 'tsfile mkdir /zxcv',
332 check: {
333 input: 'tsfile mkdir /zxcv',
334 // hints: ' -> /dev/',
335 markup: 'VVVVVVVVVVVVVVVVVV',
336 cursor: 18,
337 current: 'p1',
338 status: 'VALID',
339 message: '',
340 args: {
341 command: { name: 'tsfile mkdir' },
342 p1: {
343 value: '/zxcv',
344 arg: ' /zxcv',
345 status: 'VALID',
346 message: ''
347 }
348 }
349 }
350 },
351 {
352 skipIf: !local,
353 setup: 'tsfile mkdir /mach_kernel',
354 check: {
355 input: 'tsfile mkdir /mach_kernel',
356 hints: '',
357 markup: 'VVVVVVVVVVVVVIIIIIIIIIIII',
358 cursor: 25,
359 current: 'p1',
360 status: 'ERROR',
361 message: '\'/mach_kernel\' already exists',
362 args: {
363 command: { name: 'tsfile mkdir' },
364 p1: {
365 value: undefined,
366 arg: ' /mach_kernel',
367 status: 'INCOMPLETE',
368 message: '\'/mach_kernel\' already exists'
369 }
370 }
371 }
372 },
373 {
374 setup: 'tsfile rm /',
375 check: {
376 input: 'tsfile rm /',
377 hints: '',
378 markup: 'VVVVVVVVVVV',
379 cursor: 11,
380 current: 'p1',
381 status: 'VALID',
382 message: '',
383 args: {
384 command: { name: 'tsfile rm' },
385 p1: {
386 value: '/',
387 arg: ' /',
388 status: 'VALID',
389 message: ''
390 }
391 }
392 }
393 },
394 {
395 setup: 'tsfile rm /zxcv',
396 check: {
397 input: 'tsfile rm /zxcv',
398 // hints: ' -> /etc/',
399 markup: 'VVVVVVVVVVIIIII',
400 cursor: 15,
401 current: 'p1',
402 status: 'ERROR',
403 message: '\'/zxcv\' doesn\'t exist',
404 args: {
405 command: { name: 'tsfile rm' },
406 p1: {
407 value: undefined,
408 arg: ' /zxcv',
409 status: 'INCOMPLETE',
410 message: '\'/zxcv\' doesn\'t exist'
411 }
412 }
413 }
414 },
415 {
416 skipIf: !local,
417 setup: 'tsfile rm /mach_kernel',
418 check: {
419 input: 'tsfile rm /mach_kernel',
420 hints: '',
421 markup: 'VVVVVVVVVVVVVVVVVVVVVV',
422 cursor: 22,
423 current: 'p1',
424 status: 'VALID',
425 message: '',
426 args: {
427 command: { name: 'tsfile rm' },
428 p1: {
429 value: '/mach_kernel',
430 arg: ' /mach_kernel',
431 status: 'VALID',
432 message: ''
433 }
434 }
435 }
436 }
437 ]);
438 };
439
440 exports.testFirefoxBasic = function(options) {
441 return helpers.audit(options, [
442 {
443 // These tests are just like the ones above tailored for running in
444 // Firefox
445 skipRemainingIf: true,
446 // skipRemainingIf: !options.isFirefox,
447 skipIf: true,
448 setup: 'tsfile open /',
449 check: {
450 input: 'tsfile open /',
451 hints: '',
452 markup: 'VVVVVVVVVVVVI',
453 cursor: 13,
454 current: 'p1',
455 status: 'ERROR',
456 message: '\'/\' is not a file',
457 args: {
458 command: { name: 'tsfile open' },
459 p1: {
460 value: undefined,
461 arg: ' /',
462 status: 'INCOMPLETE',
463 message: '\'/\' is not a file'
464 }
465 }
466 }
467 },
468 {
469 skipIf: true,
470 setup: 'tsfile open /zxcv',
471 check: {
472 input: 'tsfile open /zxcv',
473 // hints: ' -> /etc/',
474 markup: 'VVVVVVVVVVVVIIIII',
475 cursor: 17,
476 current: 'p1',
477 status: 'ERROR',
478 message: '\'/zxcv\' doesn\'t exist',
479 args: {
480 command: { name: 'tsfile open' },
481 p1: {
482 value: undefined,
483 arg: ' /zxcv',
484 status: 'INCOMPLETE',
485 message: '\'/zxcv\' doesn\'t exist'
486 }
487 }
488 }
489 },
490 {
491 skipIf: !local,
492 setup: 'tsfile open /mach_kernel',
493 check: {
494 input: 'tsfile open /mach_kernel',
495 hints: '',
496 markup: 'VVVVVVVVVVVVVVVVVVVVVVVV',
497 cursor: 24,
498 current: 'p1',
499 status: 'VALID',
500 message: '',
501 args: {
502 command: { name: 'tsfile open' },
503 p1: {
504 value: '/mach_kernel',
505 arg: ' /mach_kernel',
506 status: 'VALID',
507 message: ''
508 }
509 }
510 }
511 },
512 {
513 skipIf: true,
514 setup: 'tsfile saveas /',
515 check: {
516 input: 'tsfile saveas /',
517 hints: '',
518 markup: 'VVVVVVVVVVVVVVI',
519 cursor: 15,
520 current: 'p1',
521 status: 'ERROR',
522 message: '\'/\' already exists',
523 args: {
524 command: { name: 'tsfile saveas' },
525 p1: {
526 value: undefined,
527 arg: ' /',
528 status: 'INCOMPLETE',
529 message: '\'/\' already exists'
530 }
531 }
532 }
533 },
534 {
535 skipIf: true,
536 setup: 'tsfile saveas /zxcv',
537 check: {
538 input: 'tsfile saveas /zxcv',
539 // hints: ' -> /etc/',
540 markup: 'VVVVVVVVVVVVVVVVVVV',
541 cursor: 19,
542 current: 'p1',
543 status: 'VALID',
544 message: '',
545 args: {
546 command: { name: 'tsfile saveas' },
547 p1: {
548 value: '/zxcv',
549 arg: ' /zxcv',
550 status: 'VALID',
551 message: ''
552 }
553 }
554 }
555 },
556 {
557 skipIf: !local,
558 setup: 'tsfile saveas /mach_kernel',
559 check: {
560 input: 'tsfile saveas /mach_kernel',
561 hints: '',
562 markup: 'VVVVVVVVVVVVVVIIIIIIIIIIII',
563 cursor: 26,
564 current: 'p1',
565 status: 'ERROR',
566 message: '\'/mach_kernel\' already exists',
567 args: {
568 command: { name: 'tsfile saveas' },
569 p1: {
570 value: undefined,
571 arg: ' /mach_kernel',
572 status: 'INCOMPLETE',
573 message: '\'/mach_kernel\' already exists'
574 }
575 }
576 }
577 },
578 {
579 skipIf: true,
580 setup: 'tsfile save /',
581 check: {
582 input: 'tsfile save /',
583 hints: '',
584 markup: 'VVVVVVVVVVVVI',
585 cursor: 13,
586 current: 'p1',
587 status: 'ERROR',
588 message: '\'/\' is not a file',
589 args: {
590 command: { name: 'tsfile save' },
591 p1: {
592 value: undefined,
593 arg: ' /',
594 status: 'INCOMPLETE',
595 message: '\'/\' is not a file'
596 }
597 }
598 }
599 },
600 {
601 skipIf: true,
602 setup: 'tsfile save /zxcv',
603 check: {
604 input: 'tsfile save /zxcv',
605 // hints: ' -> /etc/',
606 markup: 'VVVVVVVVVVVVVVVVV',
607 cursor: 17,
608 current: 'p1',
609 status: 'VALID',
610 message: '',
611 args: {
612 command: { name: 'tsfile save' },
613 p1: {
614 value: '/zxcv',
615 arg: ' /zxcv',
616 status: 'VALID',
617 message: ''
618 }
619 }
620 }
621 },
622 {
623 skipIf: !local,
624 setup: 'tsfile save /mach_kernel',
625 check: {
626 input: 'tsfile save /mach_kernel',
627 hints: '',
628 markup: 'VVVVVVVVVVVVVVVVVVVVVVVV',
629 cursor: 24,
630 current: 'p1',
631 status: 'VALID',
632 message: '',
633 args: {
634 command: { name: 'tsfile save' },
635 p1: {
636 value: '/mach_kernel',
637 arg: ' /mach_kernel',
638 status: 'VALID',
639 message: ''
640 }
641 }
642 }
643 },
644 {
645 setup: 'tsfile cd /',
646 check: {
647 input: 'tsfile cd /',
648 hints: '',
649 markup: 'VVVVVVVVVVV',
650 cursor: 11,
651 current: 'p1',
652 status: 'VALID',
653 message: '',
654 args: {
655 command: { name: 'tsfile cd' },
656 p1: {
657 value: '/',
658 arg: ' /',
659 status: 'VALID',
660 message: ''
661 }
662 }
663 }
664 },
665 {
666 setup: 'tsfile cd /zxcv',
667 check: {
668 input: 'tsfile cd /zxcv',
669 // hints: ' -> /dev/',
670 // markup: 'VVVVVVVVVVIIIII',
671 cursor: 15,
672 current: 'p1',
673 // status: 'ERROR',
674 message: '\'/zxcv\' doesn\'t exist',
675 args: {
676 command: { name: 'tsfile cd' },
677 p1: {
678 value: undefined,
679 arg: ' /zxcv',
680 // status: 'INCOMPLETE',
681 message: '\'/zxcv\' doesn\'t exist'
682 }
683 }
684 }
685 },
686 {
687 skipIf: true || !local,
688 setup: 'tsfile cd /etc/passwd',
689 check: {
690 input: 'tsfile cd /etc/passwd',
691 hints: ' -> /etc/pam.d/',
692 markup: 'VVVVVVVVVVIIIIIIIIIII',
693 cursor: 21,
694 current: 'p1',
695 status: 'ERROR',
696 message: '\'/etc/passwd\' is not a directory',
697 args: {
698 command: { name: 'tsfile cd' },
699 p1: {
700 value: undefined,
701 arg: ' /etc/passwd',
702 status: 'INCOMPLETE',
703 message: '\'/etc/passwd\' is not a directory'
704 }
705 }
706 }
707 },
708 {
709 setup: 'tsfile mkdir /',
710 check: {
711 input: 'tsfile mkdir /',
712 hints: '',
713 markup: 'VVVVVVVVVVVVVI',
714 cursor: 14,
715 current: 'p1',
716 status: 'ERROR',
717 message: ''/' already exists',
718 args: {
719 command: { name: 'tsfile mkdir' },
720 p1: {
721 value: undefined,
722 arg: ' /',
723 status: 'INCOMPLETE',
724 message: '\'/\' already exists'
725 }
726 }
727 }
728 },
729 {
730 setup: 'tsfile mkdir /zxcv',
731 check: {
732 input: 'tsfile mkdir /zxcv',
733 // hints: ' -> /dev/',
734 markup: 'VVVVVVVVVVVVVVVVVV',
735 cursor: 18,
736 current: 'p1',
737 status: 'VALID',
738 message: '',
739 args: {
740 command: { name: 'tsfile mkdir' },
741 p1: {
742 value: '/zxcv',
743 arg: ' /zxcv',
744 status: 'VALID',
745 message: ''
746 }
747 }
748 }
749 },
750 {
751 skipIf: !local,
752 setup: 'tsfile mkdir /mach_kernel',
753 check: {
754 input: 'tsfile mkdir /mach_kernel',
755 hints: '',
756 markup: 'VVVVVVVVVVVVVIIIIIIIIIIII',
757 cursor: 25,
758 current: 'p1',
759 status: 'ERROR',
760 message: '\'/mach_kernel\' already exists',
761 args: {
762 command: { name: 'tsfile mkdir' },
763 p1: {
764 value: undefined,
765 arg: ' /mach_kernel',
766 status: 'INCOMPLETE',
767 message: '\'/mach_kernel\' already exists'
768 }
769 }
770 }
771 },
772 {
773 skipIf: true,
774 setup: 'tsfile rm /',
775 check: {
776 input: 'tsfile rm /',
777 hints: '',
778 markup: 'VVVVVVVVVVV',
779 cursor: 11,
780 current: 'p1',
781 status: 'VALID',
782 message: '',
783 args: {
784 command: { name: 'tsfile rm' },
785 p1: {
786 value: '/',
787 arg: ' /',
788 status: 'VALID',
789 message: ''
790 }
791 }
792 }
793 },
794 {
795 skipIf: true,
796 setup: 'tsfile rm /zxcv',
797 check: {
798 input: 'tsfile rm /zxcv',
799 // hints: ' -> /etc/',
800 markup: 'VVVVVVVVVVIIIII',
801 cursor: 15,
802 current: 'p1',
803 status: 'ERROR',
804 message: '\'/zxcv\' doesn\'t exist',
805 args: {
806 command: { name: 'tsfile rm' },
807 p1: {
808 value: undefined,
809 arg: ' /zxcv',
810 status: 'INCOMPLETE',
811 message: '\'/zxcv\' doesn\'t exist'
812 }
813 }
814 }
815 },
816 {
817 skipIf: !local,
818 setup: 'tsfile rm /mach_kernel',
819 check: {
820 input: 'tsfile rm /mach_kernel',
821 hints: '',
822 markup: 'VVVVVVVVVVVVVVVVVVVVVV',
823 cursor: 22,
824 current: 'p1',
825 status: 'VALID',
826 message: '',
827 args: {
828 command: { name: 'tsfile rm' },
829 p1: {
830 value: '/mach_kernel',
831 arg: ' /mach_kernel',
832 status: 'VALID',
833 message: ''
834 }
835 }
836 }
837 }
838 ]);
839 };

mercurial