Example #1
0
 def _runChecks(self, files, exists=lambda f: True):
     input_api = MockInputApi()
     input_api.os_path.exists = exists
     input_api.files = [MockFile(f, '') for f in files]
     output_api = MockOutputApi()
     checker = ExternsChecker(input_api, output_api, self.API_PAIRS)
     return checker.RunChecks()
Example #2
0
def _CheckExterns(input_api, output_api):
  original_sys_path = sys.path

  join = input_api.os_path.join
  api_root = input_api.PresubmitLocalPath()
  src_root = join(api_root, '..', '..', '..', '..')
  try:
    sys.path.append(join(src_root, 'extensions', 'common', 'api'))
    from externs_checker import ExternsChecker
  finally:
    sys.path = original_sys_path

  externs_root = join(src_root, 'third_party', 'closure_compiler', 'externs')

  api_pair_names = {
    'autofill_private.idl': 'autofill_private.js',
    'developer_private.idl': 'developer_private.js',
    'bookmark_manager_private.json': 'bookmark_manager_private.js',
    'command_line_private.json': 'command_line_private.js',
    'file_manager_private.idl': 'file_manager_private.js',
    'language_settings_private.idl': 'language_settings_private.js',
    'metrics_private.json': 'metrics_private.js',
    'passwords_private.idl': 'passwords_private.js',
    'system_private.json': 'system_private.js',
    'users_private.idl': 'users_private.js',
    # TODO(rdevlin.cronin): Add more!
  }
  normpath = input_api.os_path.normpath
  api_pairs = {
      normpath(join(api_root, k)):
          normpath(join(externs_root, v)) for k, v in api_pair_names.items()
  }

  return ExternsChecker(input_api, output_api, api_pairs).RunChecks()
Example #3
0
def _CheckExterns(input_api, output_api):
    original_sys_path = sys.path

    try:
        sys.path.append(input_api.PresubmitLocalPath())
        from externs_checker import ExternsChecker
    finally:
        sys.path = original_sys_path

    join = input_api.os_path.join
    api_root = input_api.PresubmitLocalPath()
    externs_root = join(api_root, '..', '..', '..', 'third_party',
                        'closure_compiler', 'externs')

    api_pairs = {
        join(api_root, 'bluetooth.idl'):
        join(externs_root, 'bluetooth.js'),
        join(api_root, 'metrics_private.json'):
        join(externs_root, 'metrics_private.js'),
        join(api_root, 'mime_handler_private.idl'):
        join(externs_root, 'mime_handler_private.js'),
        # TODO(rdevlin.cronin): Add more!
    }

    return ExternsChecker(input_api, output_api, api_pairs).RunChecks()
Example #4
0
def _CheckExterns(input_api, output_api):
    original_sys_path = sys.path
    try:
        sys.path.append(input_api.PresubmitLocalPath())
        from externs_checker import ExternsChecker
    finally:
        sys.path = original_sys_path

    return ExternsChecker(input_api, output_api).RunChecks()
Example #5
0
def _CheckExterns(input_api, output_api):
    original_sys_path = sys.path
    join = input_api.os_path.join
    src_root = input_api.change.RepositoryRoot()
    try:
        sys.path.append(join(src_root, 'extensions', 'common', 'api'))
        from externs_checker import ExternsChecker
    finally:
        sys.path = original_sys_path

    return ExternsChecker(input_api, output_api).RunChecks()
 def _runChecks(self, files):
     input_api = MockInputApi()
     input_api.files = [MockFile(f, '') for f in files]
     output_api = MockOutputApi()
     checker = ExternsChecker(input_api, output_api, self.API_PAIRS)
     return checker.RunChecks()