def ProcessInstrumentationOptions(args):
    """Processes options/arguments and populate |options| with defaults.

  Args:
    args: argparse.Namespace object.

  Returns:
    An InstrumentationOptions named tuple which contains all options relevant to
    instrumentation tests.
  """

    ProcessJavaTestOptions(args)

    if not args.host_driven_root:
        args.run_python_tests = False

    args.test_apk_path = os.path.join(constants.GetOutDirectory(),
                                      constants.SDK_BUILD_APKS_DIR,
                                      '%s.apk' % args.test_apk)
    args.test_apk_jar_path = os.path.join(constants.GetOutDirectory(),
                                          constants.SDK_BUILD_TEST_JAVALIB_DIR,
                                          '%s.jar' % args.test_apk)
    args.test_support_apk_path = '%sSupport%s' % (os.path.splitext(
        args.test_apk_path))

    args.test_runner = apk_helper.GetInstrumentationName(args.test_apk_path)

    # TODO(jbudorick): Get rid of InstrumentationOptions.
    return instrumentation_test_options.InstrumentationOptions(
        args.tool, args.annotations, args.exclude_annotations,
        args.test_filter, args.test_data, args.save_perf_json,
        args.screenshot_failures, args.wait_for_debugger, args.coverage_dir,
        args.test_apk, args.test_apk_path, args.test_apk_jar_path,
        args.test_runner, args.test_support_apk_path, args.device_flags,
        args.isolate_file_path, args.set_asserts, args.delete_stale_data)
def ProcessInstrumentationOptions(args):
    """Processes options/arguments and populate |options| with defaults.

  Args:
    args: argparse.Namespace object.

  Returns:
    An InstrumentationOptions named tuple which contains all options relevant to
    instrumentation tests.
  """

    ProcessJavaTestOptions(args)

    if not args.host_driven_root:
        args.run_python_tests = False

    if os.path.exists(args.test_apk):
        args.test_apk_path = args.test_apk
        args.test_apk, _ = os.path.splitext(os.path.basename(args.test_apk))
    else:
        args.test_apk_path = os.path.join(constants.GetOutDirectory(),
                                          constants.SDK_BUILD_APKS_DIR,
                                          '%s.apk' % args.test_apk)

    jar_basename = args.test_apk
    if jar_basename.endswith('_incremental'):
        jar_basename = jar_basename[:-len('_incremental')]

    args.test_apk_jar_path = os.path.join(constants.GetOutDirectory(),
                                          constants.SDK_BUILD_TEST_JAVALIB_DIR,
                                          '%s.jar' % jar_basename)
    args.test_support_apk_path = '%sSupport%s' % (os.path.splitext(
        args.test_apk_path))

    args.test_runner = apk_helper.GetInstrumentationName(args.test_apk_path)

    # TODO(jbudorick): Get rid of InstrumentationOptions.
    return instrumentation_test_options.InstrumentationOptions(
        args.tool, args.annotations, args.exclude_annotations,
        args.test_filter, args.test_data, args.save_perf_json,
        args.screenshot_failures, args.wait_for_debugger, args.coverage_dir,
        args.test_apk, args.test_apk_path, args.test_apk_jar_path,
        args.test_runner, args.test_support_apk_path, args.device_flags,
        args.isolate_file_path, args.set_asserts, args.delete_stale_data,
        args.timeout_scale, args.apk_under_test, args.additional_apks,
        args.strict_mode, args.skip_clear_data,
        args.test_apk_incremental_install_script,
        args.apk_under_test_incremental_install_script)