• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2013 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import json
6
7from extensions_paths import EXTENSIONS
8from third_party.json_schema_compiler.json_parse import OrderedDict
9from test_file_system import MoveAllTo, MoveTo
10
11
12CANNED_CHANNELS = OrderedDict([
13  ('trunk', 'trunk'),
14  ('dev', 28),
15  ('beta', 27),
16  ('stable', 26)
17])
18
19
20CANNED_BRANCHES = OrderedDict([
21  ('trunk', 'trunk'),
22  (28, '1500'),
23  (27, '1453'),
24  (26, '1410'),
25  (25, '1364'),
26  (24, '1312'),
27  (23, '1271'),
28  (22, '1229'),
29  (21, '1180'),
30  (20, '1132'),
31  (19, '1084'),
32  (18, '1025'),
33  (17, '963'),
34  (16, '912'),
35  (15, '874'),
36  (14, '835'),
37  (13, '782'),
38  (12, '742'),
39  (11, '696'),
40  (10, '648'),
41  ( 9, '597'),
42  ( 8, '552'),
43  ( 7, '544'),
44  ( 6, '495'),
45  ( 5, '396'),
46])
47
48
49CANNED_TEST_FILE_SYSTEM_DATA = MoveTo(EXTENSIONS, {
50  'api': {
51    '_api_features.json': json.dumps({
52      'ref_test': { 'dependencies': ['permission:ref_test'] },
53      'tester': { 'dependencies': ['permission:tester', 'manifest:tester'] }
54    }),
55    '_manifest_features.json': '{}',
56    '_permission_features.json': '{}'
57  },
58  'docs': {
59    'templates': {
60      'articles': {
61        'test_article.html':
62            '<h1>hi</h1>you<h2>first</h2><h3>inner</h3><h2>second</h2>'
63      },
64      'intros': {
65        'test_intro.html':
66            'you<h2>first</h2><h3>inner</h3><h2>second</h2>'
67      },
68      'json': {
69        'api_availabilities.json': json.dumps({
70          'trunk_api': {
71            'channel': 'trunk'
72          },
73          'dev_api': {
74            'channel': 'dev'
75          },
76          'beta_api': {
77            'channel': 'beta'
78          },
79          'stable_api': {
80            'channel': 'stable',
81            'version': 20
82          }
83        }),
84        'intro_tables.json': json.dumps({
85          'tester': {
86            'Permissions': [
87              {
88                'class': 'override',
89                'text': '"tester"'
90              },
91              {
92                'text': 'is an API for testing things.'
93              }
94            ],
95            'Learn More': [
96              {
97                'link': 'https://tester.test.com/welcome.html',
98                'text': 'Welcome!'
99              }
100            ]
101          }
102        })
103      },
104      'private': {
105        'intro_tables': {
106          'trunk_message.html': 'available on trunk'
107        }
108      }
109    }
110  }
111})
112
113
114CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(EXTENSIONS, {
115  'trunk': {
116    'api': {
117      '_api_features.json': json.dumps({
118        'contextMenus': {
119          'channel': 'stable'
120        },
121        'events': {
122          'channel': 'stable'
123        },
124        'extension': {
125          'channel': 'stable'
126        },
127        'systemInfo.cpu': {
128          'channel': 'stable'
129        },
130        'systemInfo.stuff': {
131          'channel': 'dev'
132        }
133      }),
134      '_manifest_features.json': json.dumps({
135        'history': {
136          'channel': 'beta'
137        },
138        'notifications': {
139          'channel': 'beta'
140        },
141        'page_action': {
142          'channel': 'stable'
143        },
144        'runtime': {
145          'channel': 'stable'
146        },
147        'storage': {
148          'channel': 'beta'
149        },
150        'sync': {
151          'channel': 'trunk'
152        },
153        'web_request': {
154          'channel': 'stable'
155        }
156      }),
157      '_permission_features.json': json.dumps({
158        'alarms': {
159          'channel': 'stable'
160        },
161        'bluetooth': {
162          'channel': 'dev'
163        },
164        'bookmarks': {
165          'channel': 'stable'
166        },
167        'cookies': {
168          'channel': 'dev'
169        },
170        'declarativeContent': {
171          'channel': 'trunk'
172        },
173        'declarativeWebRequest': [
174          { 'channel': 'beta' },
175          # whitelist
176          { 'channel': 'stable'}
177        ],
178        'falseBetaAPI': {
179          'channel': 'beta'
180        },
181        'systemInfo.display': {
182          'channel': 'stable'
183        },
184        'trunkAPI': {
185          'channel': 'trunk'
186        }
187      }),
188      'bluetooth.idl': '\n'.join(('//Copyleft Schmopyright',
189                                  '',
190                                  '//An IDL description, oh my!',
191                                  'namespace bluetooth {',
192                                  '  dictionary Socket {',
193                                  '    long id;',
194                                  '  };',
195                                  '};')),
196      'context_menus.json': json.dumps([{
197        'namespace': 'contextMenus',
198        'description': ''
199      }]),
200      'json_stable_api.json': json.dumps([{
201        'namespace': 'jsonStableAPI',
202        'description': 'An API with a predetermined availability.'
203      }]),
204      'idle.json': json.dumps([{'namespace': 'idle', 'description': ''}]),
205      'input_ime.json': json.dumps([{
206        'namespace': 'input.ime',
207        'description': 'An API that has the potential to cause some trouble.'
208      }]),
209      'menus.json': json.dumps([{'namespace': 'menus', 'description': ''}]),
210      'tabs.json': json.dumps([{'namespace': 'tabs', 'description': ''}]),
211      'windows.json': json.dumps([{'namespace': 'windows', 'description': ''}])
212    },
213    'docs': {
214      'templates': {
215        'json': {
216          'api_availabilities.json': json.dumps({
217            'jsonTrunkAPI': {
218              'channel': 'trunk'
219            },
220            'jsonDevAPI': {
221              'channel': 'dev'
222            },
223            'jsonBetaAPI': {
224              'channel': 'beta'
225            },
226            'jsonStableAPI': {
227              'channel': 'stable',
228              'version': 20
229            }
230          }),
231          'intro_tables.json': json.dumps({
232            'test': [
233              {
234                'Permissions': 'probably none'
235              }
236            ]
237          })
238        }
239      }
240    }
241  },
242  '1500': {
243    'api': {
244      '_api_features.json': json.dumps({
245        'events': {
246          'channel': 'trunk'
247        },
248        'extension': {
249          'channel': 'stable'
250        },
251        'systemInfo.cpu': {
252          'channel': 'stable'
253        },
254        'systemInfo.stuff': {
255          'channel': 'dev'
256        }
257      }),
258      '_manifest_features.json': json.dumps({
259        'contextMenus': {
260          'channel': 'trunk'
261        },
262        'notifications': {
263          'channel': 'beta'
264        },
265        'page_action': {
266          'channel': 'stable'
267        },
268        'runtime': {
269          'channel': 'stable'
270        },
271        'storage': {
272          'channel': 'dev'
273        },
274        'sync': {
275          'channel': 'trunk'
276        },
277        'system_info_display': {
278          'channel': 'stable'
279        },
280        'web_request': {
281          'channel': 'stable'
282        }
283      }),
284      '_permission_features.json': json.dumps({
285        'alarms': {
286          'channel': 'stable'
287        },
288        'bluetooth': {
289          'channel': 'dev'
290        },
291        'bookmarks': {
292          'channel': 'stable'
293        },
294        'cookies': {
295          'channel': 'dev'
296        },
297        'declarativeContent': {
298          'channel': 'trunk'
299        },
300        'declarativeWebRequest': [
301          { 'channel': 'beta' },
302          # whitelist
303          { 'channel': 'stable'}
304        ],
305        'downloads': {
306          'channel': 'beta'
307        }
308      }),
309      'idle.json': json.dumps([{'namespace': 'idle'}]),
310      'input_ime.json': json.dumps([{'namespace': 'input.ime'}]),
311      'menus.json': json.dumps([{'namespace': 'menus'}]),
312      'tabs.json': json.dumps([{'namespace': 'tabs'}]),
313      'windows.json': json.dumps([{'namespace': 'windows'}])
314    }
315  },
316  '1453': {
317    'api': {
318      '_api_features.json': json.dumps({
319        'events': {
320          'channel': 'dev'
321        },
322        'extension': {
323          'channel': 'stable'
324        },
325        'systemInfo.cpu': {
326          'channel': 'stable'
327        },
328        'systemInfo.stuff': {
329          'channel': 'dev'
330        }
331      }),
332      '_manifest_features.json': json.dumps({
333        'notifications': {
334          'channel': 'dev'
335        },
336        'page_action': {
337          'channel': 'stable'
338        },
339        'runtime': {
340          'channel': 'stable'
341        },
342        'storage': {
343          'channel': 'dev'
344        },
345        'system_info_display': {
346          'channel': 'stable'
347        },
348        'web_request': {
349          'channel': 'stable'
350        }
351      }),
352      '_permission_features.json': json.dumps({
353        'alarms': {
354          'channel': 'stable'
355        },
356        'bluetooth': {
357          'channel': 'dev'
358        },
359        'bookmarks': {
360          'channel': 'stable'
361        },
362        'context_menus': {
363          'channel': 'trunk'
364        },
365        'declarativeContent': {
366          'channel': 'trunk'
367        },
368        'declarativeWebRequest': [
369          { 'channel': 'beta' },
370          # whitelist
371          { 'channel': 'stable'}
372        ],
373        'downloads': {
374          'channel': 'dev'
375        }
376      }),
377      'idle.json': json.dumps([{'namespace': 'idle'}]),
378      'input_ime.json': json.dumps([{'namespace': 'input.ime'}]),
379      'menus.json': json.dumps([{'namespace': 'menus'}]),
380      'tabs.json': json.dumps([{'namespace': 'tabs'}]),
381      'windows.json': json.dumps([{'namespace': 'windows'}])
382    }
383  },
384  '1410': {
385    'api': {
386      '_manifest_features.json': json.dumps({
387        'events': {
388          'channel': 'beta'
389        },
390        'notifications': {
391          'channel': 'dev'
392        },
393        'page_action': {
394          'channel': 'stable'
395        },
396        'runtime': {
397          'channel': 'stable'
398        },
399        'web_request': {
400          'channel': 'stable'
401        }
402      }),
403      '_permission_features.json': json.dumps({
404        'alarms': {
405          'channel': 'stable'
406        },
407        'bluetooth': {
408          'channel': 'dev'
409        },
410        'bookmarks': {
411          'channel': 'stable'
412        },
413        'context_menus': {
414          'channel': 'trunk'
415        },
416        'declarativeContent': {
417          'channel': 'trunk'
418        },
419        'declarativeWebRequest': [
420          { 'channel': 'beta' },
421          # whitelist
422          { 'channel': 'stable'}
423        ],
424        'systemInfo.display': {
425          'channel': 'stable'
426        }
427      }),
428      'idle.json': json.dumps([{'namespace': 'idle'}]),
429      'input_ime.json': json.dumps([{'namespace': 'input.ime'}]),
430      'menus.json': json.dumps([{'namespace': 'menus'}]),
431      'tabs.json': json.dumps([{'namespace': 'tabs'}]),
432      'windows.json': json.dumps([{'namespace': 'windows'}])
433    }
434  },
435  '1364': {
436    'api': {
437      '_manifest_features.json': json.dumps({
438        'page_action': {
439          'channel': 'stable'
440        },
441        'runtime': {
442          'channel': 'stable'
443        }
444      }),
445      '_permission_features.json': json.dumps({
446        'alarms': {
447          'channel': 'stable'
448        },
449        'bookmarks': {
450          'channel': 'stable'
451        },
452        'systemInfo.display': {
453          'channel': 'stable'
454        },
455        'webRequest': {
456          'channel': 'stable'
457        }
458      }),
459      'idle.json': json.dumps([{'namespace': 'idle'}]),
460      'input_ime.json': json.dumps([{'namespace': 'input.ime'}]),
461      'menus.json': json.dumps([{'namespace': 'menus'}]),
462      'tabs.json': json.dumps([{'namespace': 'tabs'}]),
463      'windows.json': json.dumps([{'namespace': 'windows'}])
464    }
465  },
466  '1312': {
467    'api': {
468      '_manifest_features.json': json.dumps({
469        'page_action': {
470          'channel': 'stable'
471        },
472        'runtime': {
473          'channel': 'stable'
474        },
475        'web_request': {
476          'channel': 'stable'
477        }
478      }),
479      '_permission_features.json': json.dumps({
480        'alarms': {
481          'channel': 'stable'
482        },
483        'bookmarks': {
484          'channel': 'stable'
485        },
486        'systemInfo.display': {
487          'channel': 'stable'
488        }
489      }),
490      'idle.json': json.dumps([{'namespace': 'idle'}]),
491      'input_ime.json': json.dumps([{'namespace': 'input.ime'}]),
492      'menus.json': json.dumps([{'namespace': 'menus'}]),
493      'tabs.json': json.dumps([{'namespace': 'tabs'}]),
494      'windows.json': json.dumps([{'namespace': 'windows'}])
495    }
496  },
497  '1271': {
498    'api': {
499      '_manifest_features.json': json.dumps({
500        'page_action': {
501          'channel': 'stable'
502        },
503        'runtime': {
504          'channel': 'stable'
505        },
506        'system_info_display': {
507          'channel': 'stable'
508        }
509      }),
510      '_permission_features.json': json.dumps({
511        'alarms': {
512          'channel': 'beta'
513        },
514        'bookmarks': {
515          'channel': 'stable'
516        },
517        'webRequest': {
518          'channel': 'stable'
519        }
520      }),
521      'alarms.idl': '//copy\n\n//desc\nnamespace alarms {}',
522      'idle.json': json.dumps([{'namespace': 'idle'}]),
523      'input_ime.json': json.dumps([{'namespace': 'input.ime'}]),
524      'menus.json': json.dumps([{'namespace': 'menus'}]),
525      'tabs.json': json.dumps([{'namespace': 'tabs'}]),
526      'windows.json': json.dumps([{'namespace': 'windows'}])
527    }
528  },
529  '1229': {
530    'api': {
531      '_manifest_features.json': json.dumps({
532        'page_action': {
533          'channel': 'stable'
534        },
535        'runtime': {
536          'channel': 'stable'
537        },
538        'web_request': {
539          'channel': 'stable'
540        }
541      }),
542      '_permission_features.json': json.dumps({
543        'bookmarks': {
544          'channel': 'stable'
545        },
546        'systemInfo.display': {
547          'channel': 'beta'
548        }
549      }),
550      'alarms.idl': '//copy\n\n//desc\nnamespace alarms {}',
551      'idle.json': json.dumps([{'namespace': 'idle'}]),
552      'input_ime.json': json.dumps([{'namespace': 'input.ime'}]),
553      'menus.json': json.dumps([{'namespace': 'menus'}]),
554      'tabs.json': json.dumps([{'namespace': 'tabs'}]),
555    }
556  },
557  '1180': {
558    'api': {
559      '_manifest_features.json': json.dumps({
560        'page_action': {
561          'channel': 'stable'
562        },
563        'runtime': {
564          'channel': 'stable'
565        }
566      }),
567      '_permission_features.json': json.dumps({
568        'bookmarks': {
569          'channel': 'stable'
570        },
571        'webRequest': {
572          'channel': 'stable'
573        }
574      }),
575      'bookmarks.json': json.dumps([{'namespace': 'bookmarks'}]),
576      'idle.json': json.dumps([{'namespace': 'idle'}]),
577      'input_ime.json': json.dumps([{'namespace': 'input.ime'}]),
578      'menus.json': json.dumps([{'namespace': 'menus'}]),
579      'tabs.json': json.dumps([{'namespace': 'tabs'}]),
580    }
581  },
582  '1132': {
583    'api': {
584      '_manifest_features.json': json.dumps({
585        'bookmarks': {
586          'channel': 'trunk'
587        },
588        'page_action': {
589          'channel': 'stable'
590        }
591      }),
592      '_permission_features.json': json.dumps({
593        'webRequest': {
594          'channel': 'stable'
595        }
596      }),
597      'bookmarks.json': json.dumps([{'namespace': 'bookmarks'}]),
598      'idle.json': json.dumps([{'namespace': 'idle'}]),
599      'input.ime.json': json.dumps([{'namespace': 'input.ime'}]),
600      'menus.json': json.dumps([{'namespace': 'menus'}]),
601      'tabs.json': json.dumps([{'namespace': 'tabs'}]),
602    }
603  },
604  '1084': {
605    'api': {
606      '_manifest_features.json': json.dumps({
607        'contents': 'nothing of interest here,really'
608      }),
609      'bookmarks.json': json.dumps([{'namespace': 'bookmarks'}]),
610      'idle.json': json.dumps([{'namespace': 'idle'}]),
611      'input.ime.json': json.dumps([{'namespace': 'input.ime'}]),
612      'menus.json': json.dumps([{'namespace': 'menus'}]),
613      'tabs.json': json.dumps([{'namespace': 'tabs'}]),
614      'pageAction.json': json.dumps([{'namespace': 'pageAction'}]),
615      'webRequest.json': json.dumps([{'namespace': 'webRequest'}])
616    }
617  },
618  '1025': {
619    'api': {
620      'bookmarks.json': json.dumps([{'namespace': 'bookmarks'}]),
621      'idle.json': json.dumps([{'namespace': 'idle'}]),
622      'input.ime.json': json.dumps([{'namespace': 'input.ime'}]),
623      'menus.json': json.dumps([{'namespace': 'menus'}]),
624      'tabs.json': json.dumps([{'namespace': 'tabs'}]),
625      'pageAction.json': json.dumps([{'namespace': 'pageAction'}]),
626      'webRequest.json': json.dumps([{'namespace': 'webRequest'}])
627    }
628  },
629  '963': {
630    'api': {
631      'extension_api.json': json.dumps([
632        {
633          'namespace': 'idle'
634        },
635        {
636          'namespace': 'menus'
637        },
638        {
639          'namespace': 'pageAction'
640        },
641        {
642          'namespace': 'webRequest'
643        }
644      ])
645    }
646  },
647  '912': {
648    'api': {
649      'extension_api.json': json.dumps([
650        {
651          'namespace': 'idle'
652        },
653        {
654          'namespace': 'menus'
655        },
656        {
657          'namespace': 'pageAction'
658        },
659        {
660          'namespace': 'experimental.webRequest'
661        }
662      ])
663    }
664  },
665  '874': {
666    'api': {
667      'extension_api.json': json.dumps([
668        {
669          'namespace': 'idle'
670        },
671        {
672          'namespace': 'menus'
673        },
674        {
675          'namespace': 'pageAction'
676        }
677      ])
678    }
679  },
680  '835': {
681    'api': {
682      'extension_api.json': json.dumps([
683        {
684          'namespace': 'idle'
685        },
686        {
687          'namespace': 'menus'
688        },
689        {
690          'namespace': 'pageAction'
691        }
692      ])
693    }
694  },
695  '782': {
696    'api': {
697      'extension_api.json': json.dumps([
698        {
699          'namespace': 'idle'
700        },
701        {
702          'namespace': 'menus'
703        },
704        {
705          'namespace': 'pageAction'
706        }
707      ])
708    }
709  },
710  '742': {
711    'api': {
712      'extension_api.json': json.dumps([
713        {
714          'namespace': 'idle'
715        },
716        {
717          'namespace': 'menus'
718        },
719        {
720          'namespace': 'pageAction'
721        }
722      ])
723    }
724  },
725  '696': {
726    'api': {
727      'extension_api.json': json.dumps([
728        {
729          'namespace': 'idle'
730        },
731        {
732          'namespace': 'menus'
733        },
734        {
735          'namespace': 'pageAction'
736        }
737      ])
738    }
739  },
740  '648': {
741    'api': {
742      'extension_api.json': json.dumps([
743        {
744          'namespace': 'idle'
745        },
746        {
747          'namespace': 'menus'
748        },
749        {
750          'namespace': 'pageAction'
751        }
752      ])
753    }
754  },
755  '597': {
756    'api': {
757      'extension_api.json': json.dumps([
758        {
759          'namespace': 'idle'
760        },
761        {
762          'namespace': 'menus'
763        },
764        {
765          'namespace': 'pageAction'
766        }
767      ])
768    }
769  },
770  '552': {
771    'api': {
772      'extension_api.json': json.dumps([
773        {
774          'namespace': 'idle'
775        },
776        {
777          'namespace': 'menus'
778        },
779        {
780          'namespace': 'pageAction'
781        }
782      ])
783    }
784  },
785  '544': {
786    'api': {
787      'extension_api.json': json.dumps([
788        {
789          'namespace': 'idle'
790        },
791        {
792          'namespace': 'menus'
793        }
794      ])
795    }
796  },
797  '495': {
798    'api': {
799      'extension_api.json': json.dumps([
800        {
801          'namespace': 'idle'
802        },
803        {
804          'namespace': 'menus'
805        }
806      ])
807    }
808  },
809  '396': {
810    'api': {
811      'extension_api.json': json.dumps([
812        {
813          'namespace': 'idle'
814        },
815        {
816          'namespace': 'experimental.menus'
817        }
818      ])
819    }
820  }
821})
822