Home | History | Annotate | Download | only in api_data_source
      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 
      5 import json
      6 
      7 
      8 CANNED_MASTER_FS_DATA = {
      9   'api': {
     10     '_api_features.json': json.dumps({
     11       'add_rules_tester': { 'dependencies': ['permission:add_rules_tester'] },
     12       'ref_test': { 'dependencies': ['permission:ref_test'] },
     13       'tester': {
     14         'dependencies': ['permission:tester', 'manifest:tester'],
     15         'contexts': ['content_script']
     16       },
     17       'tester.test1': {'contexts': ['content_script']},
     18       'tester.test2': {}
     19     }),
     20     '_manifest_features.json': json.dumps({'tester': {}, 'ref_test': {}}),
     21     '_permission_features.json': json.dumps({
     22       'tester': {},
     23       'ref_test': {},
     24       'add_rules_tester': {}
     25     }),
     26     'add_rules_tester.json': json.dumps([{
     27       'namespace': 'add_rules_tester',
     28       'description': ('A test api with a couple of events which support or '
     29                       'do not support rules.'),
     30       'types': [],
     31       'functions': [],
     32       'events': [
     33         {
     34           'name': 'rules',
     35           'options': {
     36             'supportsRules': True,
     37             'conditions': [],
     38             'actions': []
     39           }
     40         },
     41         {
     42           'name': 'noRules',
     43           'type': 'function',
     44           'description': 'Listeners can be registered with this event.',
     45           'parameters': []
     46         }
     47       ]
     48     }]),
     49     'events.json': json.dumps([{
     50       'namespace': 'events',
     51       'description': 'These are events.',
     52       'types': [
     53         {
     54           'id': 'Event',
     55           'type': 'object',
     56           'description': 'An Event object.',
     57           'functions': [
     58             {
     59               'name': 'addListener',
     60               'type': 'function',
     61               'description': 'Adds a listener.'
     62             }
     63           ],
     64         }
     65       ]
     66     }]),
     67     'tester.json': json.dumps([{
     68       'namespace': 'tester',
     69       'description': 'a test api',
     70       'types': [
     71         {
     72           'id': 'TypeA',
     73           'type': 'object',
     74           'description': 'A cool thing.',
     75           'properties': {
     76             'a': {'nodoc': True, 'type': 'string', 'minimum': 0},
     77             'b': {'type': 'array', 'optional': True, 'items': {'$ref': 'TypeA'},
     78                   'description': 'List of TypeA.'}
     79           }
     80         }
     81       ],
     82       'functions': [
     83         {
     84           'name': 'get',
     85           'type': 'function',
     86           'description': 'Gets stuff.',
     87           'parameters': [
     88             {
     89               'name': 'a',
     90               'description': 'a param',
     91               'choices': [
     92                 {'type': 'string'},
     93                 {'type': 'array', 'items': {'type': 'string'}, 'minItems': 1}
     94               ]
     95             },
     96             {
     97               'type': 'function',
     98               'name': 'callback',
     99               'parameters': [
    100                 {'name': 'results', 'type': 'array', 'items': {'$ref': 'TypeA'}}
    101               ]
    102             }
    103           ]
    104         }
    105       ],
    106       'events': [
    107         {
    108           'name': 'EventA',
    109           'type': 'function',
    110           'description': 'A cool event.',
    111           'parameters': [
    112             {'type': 'string', 'name': 'id'},
    113             {
    114               '$ref': 'TypeA',
    115               'name': 'bookmark'
    116             }
    117           ]
    118         }
    119       ]
    120     }]),
    121     'ref_test.json': json.dumps([{
    122       'namespace': 'ref_test',
    123       'description': 'An API for testing ref\'s',
    124       'types': [
    125         {
    126           'id': 'type1',
    127           'type': 'string',
    128           'description': '$ref:type2'
    129         },
    130         {
    131           'id': 'type2',
    132           'type': 'string',
    133           'description': 'A $ref:type3, or $ref:type2'
    134         },
    135         {
    136           'id': 'type3',
    137           'type': 'string',
    138           'description': '$ref:other.type2 != $ref:ref_test.type2'
    139         }
    140       ],
    141       'events': [
    142         {
    143           'name': 'event1',
    144           'type': 'function',
    145           'description': 'We like $ref:type1',
    146           'parameters': [
    147             {
    148               'name': 'param1',
    149               'type': 'string'
    150             }
    151           ]
    152         }
    153       ],
    154       'properties': {
    155         'prop1': {
    156           '$ref': 'type3'
    157         }
    158       },
    159       'functions': [
    160         {
    161           'name': 'func1',
    162           'type': 'function',
    163           'parameters': [
    164             {
    165               'name': 'param1',
    166               'type': 'string'
    167             }
    168           ]
    169         }
    170       ]
    171     }])
    172   },
    173   'docs': {
    174     'templates': {
    175       'intros': {
    176         'test.html': '<h1>hi</h1>you<h2>first</h2><h3>inner</h3><h2>second</h2>'
    177       },
    178       'json': {
    179         'api_availabilities.json': json.dumps({
    180           'master_api': {
    181             'channel': 'master'
    182           },
    183           'dev_api': {
    184             'channel': 'dev'
    185           },
    186           'beta_api': {
    187             'channel': 'beta'
    188           },
    189           'stable_api': {
    190             'channel': 'stable',
    191             'version': 20
    192           }
    193         }),
    194         'intro_tables.json': json.dumps({
    195           'tester': {
    196             'Permissions': [
    197               {
    198                 'class': 'override',
    199                 'text': '"tester"'
    200               },
    201               {
    202                 'text': 'is an API for testing things.'
    203               }
    204             ],
    205             'Learn More': [
    206               {
    207                 'link': 'https://tester.test.com/welcome.html',
    208                 'text': 'Welcome!'
    209               }
    210             ]
    211           }
    212         }),
    213         'manifest.json': '{}',
    214         'permissions.json': '{}'
    215       },
    216       'private': {
    217         'intro_tables': {
    218           'master_message.html': 'available on master',
    219           'stable_message.html': 'Since {{content.version}}.',
    220           'content_scripts.html': 'Content Scripts'
    221         }
    222       }
    223     }
    224   }
    225 }
    226