2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
8 from api_data_source
import APIDataSource
9 from extensions_paths
import CHROME_EXTENSIONS
10 from servlet
import Request
11 from server_instance
import ServerInstance
12 from test_data
.api_data_source
.canned_master_fs
import CANNED_MASTER_FS_DATA
13 from test_file_system
import TestFileSystem
16 class APIDataSourceTest(unittest
.TestCase
):
18 self
.server_instance
= ServerInstance
.ForTest(
19 TestFileSystem(CANNED_MASTER_FS_DATA
, relative_to
=CHROME_EXTENSIONS
))
22 api_ds
= APIDataSource(self
.server_instance
, Request
.ForTest('/'))
23 jsc_view
= api_ds
.get('extensions').get('tester')
35 'id': 'type-results-resultsType',
39 'ref': 'tester.TypeA',
42 'name': 'resultsType',
48 'id': 'property-callback-results',
54 'parentName': 'callback',
59 'simple_type': 'function'
62 'description': 'Gets stuff.',
72 'id': 'type-a-string',
76 'simple_type': 'string'
84 'id': 'type-strings-stringsType',
86 'name': 'stringsType',
88 'simple_type': 'string'
94 'id': 'type-a-strings',
100 'description': 'a param',
102 'id': 'property-get-a',
117 'availability': None,
121 'id': 'type-results-resultsType',
125 'ref': 'tester.TypeA',
128 'name': 'resultsType',
131 'availability': None,
134 'id': 'property-callback-results',
140 'parentName': 'callback',
145 'simple_type': 'function'
149 'id': 'property-get-callback',
155 'simple_type': 'function'
159 self
.assertEquals(funcs_arr
, jsc_view
['functions'])
161 'availability': None,
162 'description': 'A cool thing.',
170 'availability': None,
174 'id': 'type-b-bType',
178 'ref': 'tester.TypeA',
184 'availability': None,
185 'description': 'List of TypeA.',
187 'id': 'property-TypeA-b',
192 'parentName': 'TypeA',
196 'simple_type': 'object'
198 self
.assertEquals(types_arr
, jsc_view
['types'])
200 if __name__
== '__main__':