Пример #1
0
def update_shell_command(args):
  """Update the shell command of arc_metadata in the CRX manifest."""
  parsed_args = launch_chrome_options.parse_args(args)
  shell_command = _generate_shell_command(parsed_args)
  if not shell_command:
    return
  update_arc_metadata({'shell': shell_command},
                      args)
Пример #2
0
 def finalize(self, test_methods_to_run):
     # Use the args as those of prepare to run remove_crx_at_exit_if_needed in
     # the same condition.
     args = self._build_launch_chrome_command(test_methods_to_run)
     parsed_args = launch_chrome_options.parse_args(args)
     # Removing the CRX is deferred in case this is running for the remote
     # execution, which needs to copy all the CRXs after all the suite runners
     # in the local host have finished.
     prep_launch_chrome.remove_crx_at_exit_if_needed(parsed_args)
Пример #3
0
 def finalize(self, test_methods_to_run):
   # Use the args as those of prepare to run remove_crx_at_exit_if_needed in
   # the same condition.
   args = self._build_launch_chrome_command(test_methods_to_run)
   parsed_args = launch_chrome_options.parse_args(args)
   # Removing the CRX is deferred in case this is running for the remote
   # execution, which needs to copy all the CRXs after all the suite runners
   # in the local host have finished.
   prep_launch_chrome.remove_crx_at_exit_if_needed(parsed_args)
Пример #4
0
def update_arc_metadata(additional_metadata, args):
  """Update arc_metadata in the CRX manifest using additional_metadata."""
  parsed_args = launch_chrome_options.parse_args(args)
  manifest_path = os.path.join(parsed_args.arc_data_dir, 'manifest.json')
  with open(manifest_path) as f:
    manifest = json.load(f)
  arc_metadata = manifest['arc_metadata']
  arc_metadata.update(additional_metadata)
  with open(manifest_path, 'w') as f:
    json.dump(manifest, f,
              sort_keys=True, indent=2, separators=(',', ': '))
Пример #5
0
def main():
  signal_util.setup()

  OPTIONS.parse_configure_file()

  parsed_args = launch_chrome_options.parse_args(sys.argv)
  logging_util.setup(
      level=logging.DEBUG if parsed_args.verbose else logging.INFO)

  _prepare_chrome_user_data_dir(parsed_args)
  global _CHROME_PID_PATH
  _CHROME_PID_PATH = os.path.join(_USER_DATA_DIR, 'chrome.pid')

  # If there is an X server at :0.0 and GPU is enabled, set it as the
  # current display.
  if parsed_args.display:
    os.environ['DISPLAY'] = parsed_args.display

  os.chdir(_ROOT_DIR)

  if not parsed_args.remote:
    _kill_running_chrome()

  if parsed_args.run_ninja:
    build_common.run_ninja()

  ld_library_path = os.environ.get('LD_LIBRARY_PATH')
  lib_paths = ld_library_path.split(':') if ld_library_path else []
  lib_paths.append(build_common.get_load_library_path())
  # Add the directory of the chrome binary so that .so files in the directory
  # can be loaded. This is needed for loading libudev.so.0.
  # TODO(crbug.com/375609): Remove the hack once it becomes no longer needed.
  lib_paths.append(os.path.dirname(_get_chrome_path(parsed_args)))
  os.environ['LD_LIBRARY_PATH'] = ':'.join(lib_paths)
  launch_chrome_util.set_environment_for_chrome()

  if not platform_util.is_running_on_remote_host():
    _check_apk_existence(parsed_args)

  if not platform_util.is_running_on_remote_host():
    prep_launch_chrome.prepare_crx(parsed_args)
  prep_launch_chrome.remove_crx_at_exit_if_needed(parsed_args)

  if parsed_args.remote:
    remote_executor.launch_remote_chrome(parsed_args, sys.argv[1:])
  else:
    platform_util.assert_machine(OPTIONS.target())
    _check_crx_existence(parsed_args)
    _run_chrome_iterations(parsed_args)

  return 0
Пример #6
0
 def metadata_from_command_line(self, command):
   args = launch_chrome_options.parse_args(command.split(' '))
   metadata = (prep_launch_chrome.
               _convert_launch_chrome_options_to_external_metadata(args))
   del metadata['isDebugCodeEnabled']
   return metadata
Пример #7
0
def prepare_crx_with_raw_args(args):
  parsed_args = launch_chrome_options.parse_args(args)
  return prepare_crx(parsed_args)
Пример #8
0
 def metadata_from_command_line(self, command):
     args = launch_chrome_options.parse_args(command.split(' '))
     metadata = (prep_launch_chrome.
                 _convert_launch_chrome_options_to_external_metadata(args))
     del metadata['isDebugCodeEnabled']
     return metadata