OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import json | 6 import json |
7 import os | 7 import os |
8 import unittest | 8 import unittest |
9 | 9 |
10 from jsc_view import GetEventByNameFromEvents | 10 from jsc_view import GetEventByNameFromEvents |
(...skipping 13 matching lines...) Expand all Loading... |
24 from test_data.api_data_source.canned_trunk_fs import CANNED_TRUNK_FS_DATA | 24 from test_data.api_data_source.canned_trunk_fs import CANNED_TRUNK_FS_DATA |
25 from test_data.canned_data import CANNED_API_FILE_SYSTEM_DATA | 25 from test_data.canned_data import CANNED_API_FILE_SYSTEM_DATA |
26 from test_data.object_level_availability.tabs import TABS_SCHEMA_BRANCHES | 26 from test_data.object_level_availability.tabs import TABS_SCHEMA_BRANCHES |
27 from test_file_system import TestFileSystem | 27 from test_file_system import TestFileSystem |
28 from test_util import Server2Path | 28 from test_util import Server2Path |
29 | 29 |
30 | 30 |
31 class _FakeTemplateCache(object): | 31 class _FakeTemplateCache(object): |
32 | 32 |
33 def GetFromFile(self, key): | 33 def GetFromFile(self, key): |
34 return Future(value='handlebar %s' % key) | 34 return Future(value='motemplate %s' % key) |
35 | 35 |
36 | 36 |
37 class _FakeFeaturesBundle(object): | 37 class _FakeFeaturesBundle(object): |
38 def GetAPIFeatures(self): | 38 def GetAPIFeatures(self): |
39 return Future(value={ | 39 return Future(value={ |
40 'bluetooth': {'value': True}, | 40 'bluetooth': {'value': True}, |
41 'contextMenus': {'value': True}, | 41 'contextMenus': {'value': True}, |
42 'jsonStableAPI': {'value': True}, | 42 'jsonStableAPI': {'value': True}, |
43 'idle': {'value': True}, | 43 'idle': {'value': True}, |
44 'input.ime': {'value': True}, | 44 'input.ime': {'value': True}, |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 None, | 182 None, |
183 'extensions') | 183 'extensions') |
184 expected_list = [ | 184 expected_list = [ |
185 { 'title': 'Description', | 185 { 'title': 'Description', |
186 'content': [ | 186 'content': [ |
187 { 'text': 'a test api' } | 187 { 'text': 'a test api' } |
188 ] | 188 ] |
189 }, | 189 }, |
190 { 'title': 'Availability', | 190 { 'title': 'Availability', |
191 'content': [ | 191 'content': [ |
192 { 'partial': 'handlebar chrome/common/extensions/docs/' + | 192 { 'partial': 'motemplate chrome/common/extensions/docs/' + |
193 'templates/private/intro_tables/stable_message.html', | 193 'templates/private/intro_tables/stable_message.html', |
194 'version': 5, | 194 'version': 5, |
195 'scheduled': None | 195 'scheduled': None |
196 } | 196 } |
197 ] | 197 ] |
198 }, | 198 }, |
199 { 'title': 'Permissions', | 199 { 'title': 'Permissions', |
200 'content': [ | 200 'content': [ |
201 { 'class': 'override', | 201 { 'class': 'override', |
202 'text': '"tester"' | 202 'text': '"tester"' |
203 }, | 203 }, |
204 { 'text': 'is an API for testing things.' } | 204 { 'text': 'is an API for testing things.' } |
205 ] | 205 ] |
206 }, | 206 }, |
207 { 'title': 'Manifest', | 207 { 'title': 'Manifest', |
208 'content': [ | 208 'content': [ |
209 { 'class': 'code', | 209 { 'class': 'code', |
210 'text': '"tester": {...}' | 210 'text': '"tester": {...}' |
211 } | 211 } |
212 ] | 212 ] |
213 }, | 213 }, |
214 { 'title': 'Content Scripts', | 214 { 'title': 'Content Scripts', |
215 'content': [ | 215 'content': [ |
216 { | 216 { |
217 'partial': 'handlebar chrome/common/extensions/docs' + | 217 'partial': 'motemplate chrome/common/extensions/docs' + |
218 '/templates/private/intro_tables/content_scripts.html', | 218 '/templates/private/intro_tables/content_scripts.html', |
219 'contentScriptSupport': { | 219 'contentScriptSupport': { |
220 'name': 'tester', | 220 'name': 'tester', |
221 'restrictedTo': None | 221 'restrictedTo': None |
222 } | 222 } |
223 } | 223 } |
224 ] | 224 ] |
225 }, | 225 }, |
226 { 'title': 'Learn More', | 226 { 'title': 'Learn More', |
227 'content': [ | 227 'content': [ |
(...skipping 12 matching lines...) Expand all Loading... |
240 self._api_models.GetModel('tester').Get(), | 240 self._api_models.GetModel('tester').Get(), |
241 fake_avail_finder, | 241 fake_avail_finder, |
242 self._json_cache, | 242 self._json_cache, |
243 _FakeTemplateCache(), | 243 _FakeTemplateCache(), |
244 self._features_bundle, | 244 self._features_bundle, |
245 None, | 245 None, |
246 'extensions') | 246 'extensions') |
247 expected_list[1] = { | 247 expected_list[1] = { |
248 'title': 'Availability', | 248 'title': 'Availability', |
249 'content': [ | 249 'content': [ |
250 { 'partial': 'handlebar chrome/common/extensions/docs/' + | 250 { 'partial': 'motemplate chrome/common/extensions/docs/' + |
251 'templates/private/intro_tables/beta_message.html', | 251 'templates/private/intro_tables/beta_message.html', |
252 'version': 27, | 252 'version': 27, |
253 'scheduled': 28 | 253 'scheduled': 28 |
254 } | 254 } |
255 ] | 255 ] |
256 } | 256 } |
257 self.assertEquals(model._GetIntroTableList(), expected_list) | 257 self.assertEquals(model._GetIntroTableList(), expected_list) |
258 | 258 |
259 | 259 |
260 class JSCViewWithoutNodeAvailabilityTest(unittest.TestCase): | 260 class JSCViewWithoutNodeAvailabilityTest(unittest.TestCase): |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 assertEquals('tabs.getCurrent', | 389 assertEquals('tabs.getCurrent', |
390 model_dict['functions'][0]['availability']['version']) | 390 model_dict['functions'][0]['availability']['version']) |
391 # Test event. | 391 # Test event. |
392 assertEquals('tabs.onActivated', | 392 assertEquals('tabs.onActivated', |
393 model_dict['events'][0]['availability']['version']) | 393 model_dict['events'][0]['availability']['version']) |
394 | 394 |
395 # Test a node that became deprecated. | 395 # Test a node that became deprecated. |
396 self.assertEquals({ | 396 self.assertEquals({ |
397 'scheduled': None, | 397 'scheduled': None, |
398 'version': 26, | 398 'version': 26, |
399 'partial': 'handlebar chrome/common/extensions/docs/templates/' + | 399 'partial': 'motemplate chrome/common/extensions/docs/templates/' + |
400 'private/intro_tables/deprecated_message.html' | 400 'private/intro_tables/deprecated_message.html' |
401 }, model_dict['types'][2]['availability']) | 401 }, model_dict['types'][2]['availability']) |
402 | 402 |
403 if __name__ == '__main__': | 403 if __name__ == '__main__': |
404 unittest.main() | 404 unittest.main() |
OLD | NEW |