コード例 #1
0
 def setUp(self):
   self.model = model.Model()
   self.permissions_json = CachedLoad('test/permissions.json')
   self.model.AddNamespace(self.permissions_json[0],
       'path/to/permissions.json')
   self.permissions = self.model.namespaces.get('permissions')
   self.windows_json = CachedLoad('test/windows.json')
   self.model.AddNamespace(self.windows_json[0],
       'path/to/window.json')
   self.windows = self.model.namespaces.get('windows')
   self.tabs_json = CachedLoad('test/tabs.json')
   self.model.AddNamespace(self.tabs_json[0],
       'path/to/tabs.json')
   self.tabs = self.model.namespaces.get('tabs')
   self.idl_chromeos = Load('test/idl_namespace_chromeos.idl')
   self.model.AddNamespace(self.idl_chromeos[0],
       'path/to/idl_namespace_chromeos.idl')
   self.idl_namespace_chromeos = self.model.namespaces.get(
       'idl_namespace_chromeos')
   self.idl_all_platforms = Load('test/idl_namespace_all_platforms.idl')
   self.model.AddNamespace(self.idl_all_platforms[0],
       'path/to/idl_namespace_all_platforms.idl')
   self.idl_namespace_all_platforms = self.model.namespaces.get(
       'idl_namespace_all_platforms')
   self.idl_non_specific_platforms = Load(
       'test/idl_namespace_non_specific_platforms.idl')
   self.model.AddNamespace(self.idl_non_specific_platforms[0],
       'path/to/idl_namespace_non_specific_platforms.idl')
   self.idl_namespace_non_specific_platforms = self.model.namespaces.get(
       'idl_namespace_non_specific_platforms')
コード例 #2
0
 def setUp(self):
     self.model = model.Model()
     self.permissions_json = CachedLoad('test/permissions.json')
     self.model.AddNamespace(self.permissions_json[0],
                             'path/to/permissions.json')
     self.permissions = self.model.namespaces.get('permissions')
     self.windows_json = CachedLoad('test/windows.json')
     self.model.AddNamespace(self.windows_json[0], 'path/to/window.json')
     self.windows = self.model.namespaces.get('windows')
     self.tabs_json = CachedLoad('test/tabs.json')
     self.model.AddNamespace(self.tabs_json[0], 'path/to/tabs.json')
     self.tabs = self.model.namespaces.get('tabs')
コード例 #3
0
  def setUp(self):
    self.models = defaultdict(model.Model)

    self.forbidden_json = CachedLoad('test/forbidden.json')
    self.forbidden = self.models['forbidden'].AddNamespace(
        self.forbidden_json[0], 'path/to/forbidden.json')
    self.permissions_json = CachedLoad('test/permissions.json')
    self.permissions = self.models['permissions'].AddNamespace(
        self.permissions_json[0], 'path/to/permissions.json')
    self.windows_json = CachedLoad('test/windows.json')
    self.windows = self.models['windows'].AddNamespace(self.windows_json[0],
                                                       'path/to/window.json')
    self.tabs_json = CachedLoad('test/tabs.json')
    self.tabs = self.models['tabs'].AddNamespace(self.tabs_json[0],
                                                 'path/to/tabs.json')
    self.browser_action_json = CachedLoad('test/browser_action.json')
    self.browser_action = self.models['browser_action'].AddNamespace(
        self.browser_action_json[0], 'path/to/browser_action.json')
    self.font_settings_json = CachedLoad('test/font_settings.json')
    self.font_settings = self.models['font_settings'].AddNamespace(
        self.font_settings_json[0], 'path/to/font_settings.json')
    self.dependency_tester_json = CachedLoad('test/dependency_tester.json')
    self.dependency_tester = self.models['dependency_tester'].AddNamespace(
        self.dependency_tester_json[0], 'path/to/dependency_tester.json')
    self.content_settings_json = CachedLoad('test/content_settings.json')
    self.content_settings = self.models['content_settings'].AddNamespace(
        self.content_settings_json[0], 'path/to/content_settings.json')
コード例 #4
0
    def setUp(self):
        self.models = defaultdict(model.Model)

        self.forbidden_json = CachedLoad('test/forbidden.json')
        self.forbidden = self.models['forbidden'].AddNamespace(
            self.forbidden_json[0], 'path/to/forbidden.json')
        self.permissions_json = CachedLoad('test/permissions.json')
        self.permissions = self.models['permissions'].AddNamespace(
            self.permissions_json[0], 'path/to/permissions.json')
        self.windows_json = CachedLoad('test/windows.json')
        self.windows = self.models['windows'].AddNamespace(
            self.windows_json[0], 'path/to/window.json')
        self.tabs_json = CachedLoad('test/tabs.json')
        self.tabs = self.models['tabs'].AddNamespace(self.tabs_json[0],
                                                     'path/to/tabs.json')
        self.browser_action_json = CachedLoad('test/browser_action.json')
        self.browser_action = self.models['browser_action'].AddNamespace(
            self.browser_action_json[0], 'path/to/browser_action.json')
        self.font_settings_json = CachedLoad('test/font_settings.json')
        self.font_settings = self.models['font_settings'].AddNamespace(
            self.font_settings_json[0], 'path/to/font_settings.json')
        self.dependency_tester_json = CachedLoad('test/dependency_tester.json')
        self.dependency_tester = self.models['dependency_tester'].AddNamespace(
            self.dependency_tester_json[0], 'path/to/dependency_tester.json')
        self.content_settings_json = CachedLoad('test/content_settings.json')
        self.content_settings = self.models['content_settings'].AddNamespace(
            self.content_settings_json[0], 'path/to/content_settings.json')
        self.objects_movable_idl = idl_schema.Load('test/objects_movable.idl')
        self.objects_movable = self.models['objects_movable'].AddNamespace(
            self.objects_movable_idl[0],
            'path/to/objects_movable.idl',
            include_compiler_options=True)
コード例 #5
0
 def setUp(self):
   self.model = model.Model()
   self.forbidden_json = CachedLoad('test/forbidden.json')
   self.model.AddNamespace(self.forbidden_json[0],
                           'path/to/forbidden.json')
   self.forbidden = self.model.namespaces.get('forbidden')
   self.permissions_json = CachedLoad('test/permissions.json')
   self.model.AddNamespace(self.permissions_json[0],
                           'path/to/permissions.json')
   self.permissions = self.model.namespaces.get('permissions')
   self.windows_json = CachedLoad('test/windows.json')
   self.model.AddNamespace(self.windows_json[0],
                           'path/to/window.json')
   self.windows = self.model.namespaces.get('windows')
   self.tabs_json = CachedLoad('test/tabs.json')
   self.model.AddNamespace(self.tabs_json[0],
                           'path/to/tabs.json')
   self.tabs = self.model.namespaces.get('tabs')
   self.browser_action_json = CachedLoad('test/browser_action.json')
   self.model.AddNamespace(self.browser_action_json[0],
                           'path/to/browser_action.json')
   self.browser_action = self.model.namespaces.get('browserAction')
   self.font_settings_json = CachedLoad('test/font_settings.json')
   self.model.AddNamespace(self.font_settings_json[0],
                           'path/to/font_settings.json')
   self.font_settings = self.model.namespaces.get('fontSettings')
   self.dependency_tester_json = CachedLoad('test/dependency_tester.json')
   self.model.AddNamespace(self.dependency_tester_json[0],
                           'path/to/dependency_tester.json')
   self.dependency_tester = self.model.namespaces.get('dependencyTester')
   self.content_settings_json = CachedLoad('test/content_settings.json')
   self.model.AddNamespace(self.content_settings_json[0],
                           'path/to/content_settings.json')
   self.content_settings = self.model.namespaces.get('contentSettings')
コード例 #6
0
ファイル: model_test.py プロジェクト: luojiguicai/chromium
 def testReturnsAsyncMissingParametersKey(self):
     test_json = CachedLoad(
         'test/returns_async_missing_parameters_key.json')
     self.assertRaisesRegexp(
         ValueError, 'parameters key not specified on returns_async: '
         'returnsAsyncMissingParametersKey.asyncNoParametersKey in '
         'path/to/returns_async_missing_parameters_key.json',
         self.model.AddNamespace, test_json[0],
         'path/to/returns_async_missing_parameters_key.json')
コード例 #7
0
ファイル: model_test.py プロジェクト: vermeerlee/chromium
  def setUp(self):
    self.model = model.Model()
    self.permissions_json = CachedLoad('test/permissions.json')
    self.model.AddNamespace(self.permissions_json[0],
        'path/to/permissions.json')
    self.permissions = self.model.namespaces.get('permissions')
    self.windows_json = CachedLoad('test/windows.json')
    self.model.AddNamespace(self.windows_json[0],
        'path/to/window.json')
    self.windows = self.model.namespaces.get('windows')
    self.tabs_json = CachedLoad('test/tabs.json')
    self.model.AddNamespace(self.tabs_json[0],
        'path/to/tabs.json')
    self.tabs = self.model.namespaces.get('tabs')
    self.idl_chromeos = Load('test/idl_namespace_chromeos.idl')
    self.model.AddNamespace(self.idl_chromeos[0],
        'path/to/idl_namespace_chromeos.idl')
    self.idl_namespace_chromeos = self.model.namespaces.get(
        'idl_namespace_chromeos')
    self.idl_all_platforms = Load('test/idl_namespace_all_platforms.idl')
    self.model.AddNamespace(self.idl_all_platforms[0],
        'path/to/idl_namespace_all_platforms.idl')
    self.idl_namespace_all_platforms = self.model.namespaces.get(
        'idl_namespace_all_platforms')
    self.idl_non_specific_platforms = Load(
        'test/idl_namespace_non_specific_platforms.idl')
    self.model.AddNamespace(self.idl_non_specific_platforms[0],
        'path/to/idl_namespace_non_specific_platforms.idl')
    self.idl_namespace_non_specific_platforms = self.model.namespaces.get(
        'idl_namespace_non_specific_platforms')
    self.returns_async_json = CachedLoad('test/returns_async.json')
    self.model.AddNamespace(self.returns_async_json[0],
        'path/to/returns_async.json')
    self.returns_async = self.model.namespaces.get('returns_async')
    self.idl_returns_async_idl = Load('test/idl_returns_async.idl')
    self.model.AddNamespace(self.idl_returns_async_idl[0],
        'path/to/idl_returns_async.idl')
    self.idl_returns_async = self.model.namespaces.get('idl_returns_async')
    self.nodoc_json = CachedLoad('test/namespace_nodoc.json')
    self.model.AddNamespace(self.nodoc_json[0],
        'path/to/namespace_nodoc.json')
    self.nodoc = self.model.namespaces.get('nodoc')
    self.fakeapi_json = CachedLoad('test/namespace_fakeapi.json')
    self.model.AddNamespace(self.fakeapi_json[0],
        'path/to/namespace_fakeapi.json')
    self.fakeapi = self.model.namespaces.get('fakeapi')

    self.function_platforms_idl = Load('test/function_platforms.idl')
    self.model.AddNamespace(self.function_platforms_idl[0],
      '/path/to/function_platforms.idl')
    self.function_platforms = self.model.namespaces.get('function_platforms')

    self.function_platform_win_linux_json = CachedLoad(
        'test/function_platform_win_linux.json')
    self.model.AddNamespace(self.function_platform_win_linux_json[0],
        'path/to/function_platform_win_linux.json')
    self.function_platform_win_linux = self.model.namespaces.get(
        'function_platform_win_linux')
コード例 #8
0
ファイル: model_test.py プロジェクト: luojiguicai/chromium
 def testDefaultSpecifiedRedundantly(self):
     test_json = CachedLoad('test/redundant_default_attribute.json')
     self.assertRaisesRegexp(
         model.ParseException,
         'Model parse exception at:\nredundantDefaultAttribute\noptionalFalse\n'
         '  in path/to/redundant_default_attribute.json\n'
         'The attribute "optional" is specified as "False", but this is the '
         'default value if the attribute is not included\. It should be '
         'removed\.', self.model.AddNamespace, test_json[0],
         'path/to/redundant_default_attribute.json')
コード例 #9
0
ファイル: json_schema_test.py プロジェクト: rosas/chromium-1
    def testNocompile(self):
        compiled = [{
            "namespace": "compile",
            "functions": [],
            "types": {}
        }, {
            "namespace": "functions",
            "functions": [{
                "id": "two"
            }, {
                "id": "four"
            }],
            "types": {
                "one": {
                    "key": "value"
                }
            }
        }, {
            "namespace": "types",
            "functions": [{
                "id": "one"
            }],
            "types": {
                "two": {
                    "key": "value"
                },
                "four": {
                    "key": "value"
                }
            }
        }, {
            "namespace": "nested",
            "properties": {
                "sync": {
                    "functions": [{
                        "id": "two"
                    }, {
                        "id": "four"
                    }],
                    "types": {
                        "two": {
                            "key": "value"
                        },
                        "four": {
                            "key": "value"
                        }
                    }
                }
            }
        }]

        self.assertEquals(compiled, CachedLoad('test/json_schema_test.json'))