chrome/test/chromedriver/test/run_java_tests.py
def _Run(java_tests_src_dir, test_filter, ready_to_run_tests,
         chromedriver_path, chrome_path, log_path, android_package_key,
         debug, tests_report_file):
  """Run the WebDriver Java tests and return the test results.

  Args:
    java_tests_src_dir: the java test source code directory.
    test_filter: the filter to use when choosing tests to run. Format is same
        as Google C++ Test format.
    readyToRunTests: tests that need to run regardless of
        @NotYetImplemented annotation
    chromedriver_path: path to ChromeDriver exe.
    chrome_path: path to Chrome exe.
    log_path: path to server log.
    android_package_key: name of Chrome's Android package.
    debug: whether the tests should wait until attached by a debugger.
  """

  sys_props = ['selenium.browser=chrome',
               'webdriver.chrome.driver=' + os.path.abspath(chromedriver_path)]
  if chrome_path:
    if util.IsLinux() and android_package_key is None:
      # Workaround for crbug.com/611886 and
      # https://bugs.chromium.org/p/chromedriver/issues/detail?id=1695
      chrome_wrapper_path = os.path.join(java_tests_src_dir,
                                         'chrome-wrapper-no-sandbox')
      with open(chrome_wrapper_path, 'w') as f:
        f.write('#!/bin/sh\n')
        f.write('exec "%s" --no-sandbox --disable-gpu "$@"\n' %
            os.path.abspath(chrome_path))
      st = os.stat(chrome_wrapper_path)
      os.chmod(chrome_wrapper_path, st.st_mode | stat.S_IEXEC)
    elif util.IsMac():
      # Use srgb color profile, otherwise the default color profile on Mac
      # causes some color adjustments, so screenshots have unexpected colors.
      chrome_wrapper_path = os.path.join(java_tests_src_dir, 'chrome-wrapper')
      with open(chrome_wrapper_path, 'w') as f:
        f.write('#!/bin/sh\n')
        f.write('exec "%s" --force-color-profile=srgb "$@"\n' %
            os.path.abspath(chrome_path))
      st = os.stat(chrome_wrapper_path)
      os.chmod(chrome_wrapper_path, st.st_mode | stat.S_IEXEC)
    else:
      chrome_wrapper_path = os.path.abspath(chrome_path)
    sys_props += ['webdriver.chrome.binary=' + chrome_wrapper_path]
  if log_path:
    sys_props += ['webdriver.chrome.logfile=' + log_path]
  if android_package_key:
    android_package = constants.PACKAGE_INFO[android_package_key].package
    sys_props += ['webdriver.chrome.android_package=' + android_package]
    if android_package_key == 'chromedriver_webview_shell':
      android_activity = constants.PACKAGE_INFO[android_package_key].activity
      android_process = '%s:main' % android_package
      sys_props += ['webdriver.chrome.android_activity=' + android_activity]
      sys_props += ['webdriver.chrome.android_process=' + android_process]
  if test_filter:
    # Test jar actually takes a regex. Convert from glob.
    test_filter = test_filter.replace('*', '.*')
    sys_props += ['filter=' + test_filter]
  if ready_to_run_tests:
    sys_props += ['readyToRun=' + ready_to_run_tests]

  jvm_args = []
  if debug:
    transport = 'dt_socket'
    if util.IsWindows():
      transport = 'dt_shmem'
    jvm_args += ['-agentlib:jdwp=transport=%s,server=y,suspend=y,'
                 'address=33081' % transport]

  _RunTest(java_tests_src_dir, jvm_args, sys_props, tests_report_file)
Run the WebDriver Java tests and return the test results.

  Args:
    java_tests_src_dir: the java test source code directory.
    test_filter: the filter to use when choosing tests to run. Format is same
        as Google C++ Test format.
    readyToRunTests: tests that need to run regardless of
        @NotYetImplemented annotation
    chromedriver_path: path to ChromeDriver exe.
    chrome_path: path to Chrome exe.
    log_path: path to server log.
    android_package_key: name of Chrome's Android package.
    debug: whether the tests should wait until attached by a debugger.
  
Run the WebDriver Java tests and return the test results.
Run the WebDriver Java tests and return the test results .
def _Run(java_tests_src_dir, test_filter, ready_to_run_tests,
         chromedriver_path, chrome_path, log_path, android_package_key,
         debug, tests_report_file):
  sys_props = ['selenium.browser=chrome',
               'webdriver.chrome.driver=' + os.path.abspath(chromedriver_path)]
  if chrome_path:
    if util.IsLinux() and android_package_key is None:
      chrome_wrapper_path = os.path.join(java_tests_src_dir,
                                         'chrome-wrapper-no-sandbox')
      with open(chrome_wrapper_path, 'w') as f:
        f.write('#!/bin/sh\n')
        f.write('exec "%s" --no-sandbox --disable-gpu "$@"\n' %
            os.path.abspath(chrome_path))
      st = os.stat(chrome_wrapper_path)
      os.chmod(chrome_wrapper_path, st.st_mode | stat.S_IEXEC)
    elif util.IsMac():
      chrome_wrapper_path = os.path.join(java_tests_src_dir, 'chrome-wrapper')
      with open(chrome_wrapper_path, 'w') as f:
        f.write('#!/bin/sh\n')
        f.write('exec "%s" --force-color-profile=srgb "$@"\n' %
            os.path.abspath(chrome_path))
      st = os.stat(chrome_wrapper_path)
      os.chmod(chrome_wrapper_path, st.st_mode | stat.S_IEXEC)
    else:
      chrome_wrapper_path = os.path.abspath(chrome_path)
    sys_props += ['webdriver.chrome.binary=' + chrome_wrapper_path]
  if log_path:
    sys_props += ['webdriver.chrome.logfile=' + log_path]
  if android_package_key:
    android_package = constants.PACKAGE_INFO[android_package_key].package
    sys_props += ['webdriver.chrome.android_package=' + android_package]
    if android_package_key == 'chromedriver_webview_shell':
      android_activity = constants.PACKAGE_INFO[android_package_key].activity
      android_process = '%s:main' % android_package
      sys_props += ['webdriver.chrome.android_activity=' + android_activity]
      sys_props += ['webdriver.chrome.android_process=' + android_process]
  if test_filter:
    test_filter = test_filter.replace('*', '.*')
    sys_props += ['filter=' + test_filter]
  if ready_to_run_tests:
    sys_props += ['readyToRun=' + ready_to_run_tests]
  jvm_args = []
  if debug:
    transport = 'dt_socket'
    if util.IsWindows():
      transport = 'dt_shmem'
    jvm_args += ['-agentlib:jdwp=transport=%s,server=y,suspend=y,'
                 'address=33081' % transport]
  _RunTest(java_tests_src_dir, jvm_args, sys_props, tests_report_file)
def _Run ( java_tests_src_dir , test_filter , ready_to_run_tests , chromedriver_path , chrome_path , log_path , android_package_key , debug , tests_report_file ) : sys_props = [ 'selenium.browser=chrome' , 'webdriver.chrome.driver=' + os . path . abspath ( chromedriver_path ) ] if chrome_path : if util . IsLinux ( ) and android_package_key is None : chrome_wrapper_path = os . path . join ( java_tests_src_dir , 'chrome-wrapper-no-sandbox' ) with open ( chrome_wrapper_path , 'w' ) as f : f . write ( '#!/bin/sh\n' ) f . write ( 'exec "%s" --no-sandbox --disable-gpu "$@"\n' % os . path . abspath ( chrome_path ) ) st = os . stat ( chrome_wrapper_path ) os . chmod ( chrome_wrapper_path , st . st_mode | stat . S_IEXEC ) elif util . IsMac ( ) : chrome_wrapper_path = os . path . join ( java_tests_src_dir , 'chrome-wrapper' ) with open ( chrome_wrapper_path , 'w' ) as f : f . write ( '#!/bin/sh\n' ) f . write ( 'exec "%s" --force-color-profile=srgb "$@"\n' % os . path . abspath ( chrome_path ) ) st = os . stat ( chrome_wrapper_path ) os . chmod ( chrome_wrapper_path , st . st_mode | stat . S_IEXEC ) else : chrome_wrapper_path = os . path . abspath ( chrome_path ) sys_props += [ 'webdriver.chrome.binary=' + chrome_wrapper_path ] if log_path : sys_props += [ 'webdriver.chrome.logfile=' + log_path ] if android_package_key : android_package = constants . PACKAGE_INFO [ android_package_key ] . package sys_props += [ 'webdriver.chrome.android_package=' + android_package ] if android_package_key == 'chromedriver_webview_shell' : android_activity = constants . PACKAGE_INFO [ android_package_key ] . activity android_process = '%s:main' % android_package sys_props += [ 'webdriver.chrome.android_activity=' + android_activity ] sys_props += [ 'webdriver.chrome.android_process=' + android_process ] if test_filter : test_filter = test_filter . replace ( '*' , '.*' ) sys_props += [ 'filter=' + test_filter ] if ready_to_run_tests : sys_props += [ 'readyToRun=' + ready_to_run_tests ] jvm_args = [ ] if debug : transport = 'dt_socket' if util . IsWindows ( ) : transport = 'dt_shmem' jvm_args += [ '-agentlib:jdwp=transport=%s,server=y,suspend=y,' 'address=33081' % transport ] _RunTest ( java_tests_src_dir , jvm_args , sys_props , tests_report_file )
Run the WebDriver Java tests and return the test results.
Run the WebDriver Java tests and return the test results .
"""Run the WebDriver Java tests and return the test results.

  Args:
    java_tests_src_dir: the java test source code directory.
    test_filter: the filter to use when choosing tests to run. Format is same
        as Google C++ Test format.
    readyToRunTests: tests that need to run regardless of
        @NotYetImplemented annotation
    chromedriver_path: path to ChromeDriver exe.
    chrome_path: path to Chrome exe.
    log_path: path to server log.
    android_package_key: name of Chrome's Android package.
    debug: whether the tests should wait until attached by a debugger.
  """ # Workaround for crbug.com/611886 and # https://bugs.chromium.org/p/chromedriver/issues/detail?id=1695 # Use srgb color profile, otherwise the default color profile on Mac # causes some color adjustments, so screenshots have unexpected colors. # Test jar actually takes a regex. Convert from glob.
java_tests_src_dir
the java test source code directory.
the java test source code directory .
test_filter
the filter to use when choosing tests to run. Format is same
as Google C++ Test format.
the filter to use when choosing tests to run . Format is same as Google C ++ Test format .
ready_to_run_tests
chromedriver_path
path to ChromeDriver exe.
path to ChromeDriver exe .
chrome_path
path to Chrome exe.
path to Chrome exe .
log_path
path to server log.
path to server log .
android_package_key
name of Chrome's Android package.
name of Chrome ' s Android package .
debug
whether the tests should wait until attached by a debugger.
whether the tests should wait until attached by a debugger .
tests_report_file
readyToRunTests
tests that need to run regardless of
@NotYetImplemented annotation
tests that need to run regardless of @NotYetImplemented annotation