Ejemplo n.º 1
0
    def testReplayOffGivesEmptyArgs(self):
        network_backend = mock.Mock()
        network_backend.is_open = False
        network_backend.forwarder = None

        self.assertEqual([],
                         chrome_startup_args.GetReplayArgs(network_backend))
Ejemplo n.º 2
0
  def GetBrowserStartupArgs(self, browser_options):
    startup_args = chrome_startup_args.GetFromBrowserOptions(browser_options)
    # use the flag `--ignore-certificate-errors` if in compatibility mode
    supports_spki_list = (
        self._backend_settings.supports_spki_list and
        compat_mode_options.IGNORE_CERTIFICATE_ERROR
        not in browser_options.compatibility_mode)
    startup_args.extend(chrome_startup_args.GetReplayArgs(
        self._platform_backend.network_controller_backend,
        supports_spki_list=supports_spki_list))
    startup_args.append('--enable-remote-debugging')
    startup_args.append('--disable-fre')
    startup_args.append('--disable-external-intent-requests')

    # Need to specify the user profile directory for
    # --ignore-certificate-errors-spki-list to work.
    startup_args.append('--user-data-dir=' + self.profile_directory)

    # Needed so that non-browser-process crashes avoid automatic dump upload
    # and subsequent deletion. The extra "Crashpad" is necessary because
    # crashpad_stackwalker.py is hard-coded to look for a "Crashpad" directory
    # in the dump directory that it is provided.
    startup_args.append('--breakpad-dump-location=' + posixpath.join(
        self._platform_backend.GetDumpLocation(self._backend_settings.package),
        'Crashpad'))

    return startup_args
Ejemplo n.º 3
0
 def GetBrowserStartupArgs(self, browser_options):
     startup_args = chrome_startup_args.GetFromBrowserOptions(
         browser_options)
     startup_args.extend(
         chrome_startup_args.GetReplayArgs(
             self._platform_backend.network_controller_backend))
     return startup_args
Ejemplo n.º 4
0
  def GetBrowserStartupArgs(self, browser_options):
    startup_args = chrome_startup_args.GetFromBrowserOptions(browser_options)
    startup_args.extend(chrome_startup_args.GetReplayArgs(
        self._platform_backend.network_controller_backend))

    # Setting port=0 allows the browser to choose a suitable port.
    startup_args.append('--remote-debugging-port=0')
    startup_args.append('--enable-crash-reporter-for-testing')
    startup_args.append('--disable-component-update')

    if not self._is_content_shell:
      startup_args.append('--window-size=1280,1024')
      if self._flash_path:
        startup_args.append('--ppapi-flash-path=%s' % self._flash_path)
        # Also specify the version of Flash as a large version, so that it is
        # not overridden by the bundled or component-updated version of Flash.
        startup_args.append('--ppapi-flash-version=99.9.999.999')

    if self.profile_directory is not None:
      if self._is_content_shell:
        startup_args.append('--data-path=%s' % self.profile_directory)
      else:
        startup_args.append('--user-data-dir=%s' % self.profile_directory)

    trace_config_file = (self._platform_backend.tracing_controller_backend
                         .GetChromeTraceConfigFile())
    if trace_config_file:
      startup_args.append('--trace-config-file=%s' % trace_config_file)

    startup_args.extend(
        [a for a in self.extra_browser_args if a not in startup_args])

    return startup_args
Ejemplo n.º 5
0
  def GetBrowserStartupArgs(self, browser_options):
    startup_args = chrome_startup_args.GetFromBrowserOptions(browser_options)

    # The setup for remote ChromeOS uses direct connections to the
    # port-forwarded server rather than the SOCKS proxy
    # (done in Platform.SetHTTPServerDirectories()).
    #
    # This was probably done because of the inability to proxy
    # localhost/127.0.0.1 on ChromeOS. Once crbug.com/902579 is resolved
    # can just proxy like on other platforms.
    use_socks_proxy = not self._platform_backend.IsRemoteDevice()

    startup_args.extend(chrome_startup_args.GetReplayArgs(
        self._platform_backend.network_controller_backend,
        use_socks_proxy=use_socks_proxy))

    vmodule = ','.join('%s=2' % pattern for pattern in [
        '*/chromeos/net/*',
        '*/chromeos/login/*',
        'chrome_browser_main_posix'])

    startup_args.extend([
        '--enable-smooth-scrolling',
        '--enable-threaded-compositing',
        # Allow devtools to connect to chrome.
        '--remote-debugging-port=0',
        # Open a maximized window.
        '--start-maximized',
        # Disable sounds.
        '--ash-disable-system-sounds',
        '--mute-audio',
        # Skip user image selection screen, and post login screens.
        '--oobe-skip-postlogin',
        # Disable chrome logging redirect. crbug.com/724273.
        '--disable-logging-redirect',
        # Debug logging.
        '--vmodule=%s' % vmodule,
    ])

    if not browser_options.expect_policy_fetch:
      startup_args.append('--allow-failed-policy-fetch-for-test')

    # If we're using GAIA, skip to login screen, and do not disable GAIA
    # services.
    if browser_options.gaia_login:
      startup_args.append('--oobe-skip-to-login')
    elif browser_options.disable_gaia_services:
      startup_args.append('--disable-gaia-services')

    trace_config_file = (self._platform_backend.tracing_controller_backend
                         .GetChromeTraceConfigFile())
    if trace_config_file:
      startup_args.append('--trace-config-file=%s' % trace_config_file)

    return startup_args
Ejemplo n.º 6
0
    def testReplayArgsUseLiveTrafficWithSpkiSupport(self):
        network_backend = mock.Mock()
        network_backend.is_open = True
        network_backend.use_live_traffic = True
        network_backend.forwarder.remote_port = 789

        expected_args = ['--proxy-server=socks://localhost:789']
        self.assertItemsEqual(
            expected_args,
            chrome_startup_args.GetReplayArgs(network_backend,
                                              supports_spki_list=True))
Ejemplo n.º 7
0
    def testReplayArgsNoSpkiSupportWithoutProxy(self):
        network_backend = mock.Mock()
        network_backend.is_open = True
        network_backend.use_live_traffic = False

        expected_args = ['--ignore-certificate-errors']
        self.assertItemsEqual(
            expected_args,
            chrome_startup_args.GetReplayArgs(network_backend,
                                              supports_spki_list=False,
                                              use_socks_proxy=False))
Ejemplo n.º 8
0
    def GetBrowserStartupArgs(self, browser_options):
        startup_args = chrome_startup_args.GetFromBrowserOptions(
            browser_options)

        startup_args.extend(
            chrome_startup_args.GetReplayArgs(
                self._platform_backend.network_controller_backend))

        vmodule = ','.join('%s=2' % pattern for pattern in [
            '*/chromeos/net/*', '*/chromeos/login/*',
            'chrome_browser_main_posix'
        ])

        startup_args.extend([
            '--enable-smooth-scrolling',
            '--enable-threaded-compositing',
            # Allow devtools to connect to chrome.
            '--remote-debugging-port=0',
            # Open a maximized window.
            '--start-maximized',
            # Disable sounds.
            '--ash-disable-system-sounds',
            # Skip user image selection screen, and post login screens.
            '--oobe-skip-postlogin',
            # Debug logging.
            '--vmodule=%s' % vmodule,
            # Enable crash dumping.
            '--enable-crash-reporter-for-testing',
        ])

        if self._app_type == 'lacros-chrome':
            startup_args.extend(
                ['--lacros-mojo-socket-for-testing=/tmp/lacros.sock'])

        if browser_options.mute_audio:
            startup_args.append('--mute-audio')

        if not browser_options.expect_policy_fetch:
            startup_args.append('--allow-failed-policy-fetch-for-test')

        # If we're using GAIA, skip to login screen, enable GaiaActionButtons
        # feature, and do not disable GAIA services.
        if browser_options.gaia_login:
            startup_args.append('--oobe-skip-to-login')
            startup_args.append('--enable-features=GaiaActionButtons')
        elif browser_options.disable_gaia_services:
            startup_args.append('--disable-gaia-services')

        trace_config_file = (self._platform_backend.tracing_controller_backend.
                             GetChromeTraceConfigFile())
        if trace_config_file:
            startup_args.append('--trace-config-file=%s' % trace_config_file)

        return startup_args
Ejemplo n.º 9
0
    def testReplayArgsBasic(self):
        network_backend = mock.Mock()
        network_backend.is_open = True
        network_backend.forwarder.remote_port = 789

        expected_args = [
            '--proxy-server=socks://localhost:789',
            '--ignore-certificate-errors-spki-list='
            'PhrPvGIaAMmd29hj8BCZOq096yj7uMpRNHpn5PDxI6I='
        ]
        self.assertItemsEqual(
            expected_args, chrome_startup_args.GetReplayArgs(network_backend))
Ejemplo n.º 10
0
    def testReplayArgsNoSpkiSupport(self):
        network_backend = mock.Mock()
        network_backend.is_open = True
        network_backend.forwarder.remote_port = 789

        expected_args = [
            '--proxy-server=socks://localhost:789',
            '--ignore-certificate-errors'
        ]
        self.assertItemsEqual(
            expected_args,
            chrome_startup_args.GetReplayArgs(network_backend, False))
Ejemplo n.º 11
0
    def testReplayArgsNoSpkiSupport(self):
        network_backend = mock.Mock()
        network_backend.is_open = True
        network_backend.use_live_traffic = False
        network_backend.forwarder.remote_port = 789

        expected_args = [
            '--proxy-server=socks://127.0.0.1:789',
            '--proxy-bypass-list=<-loopback>', '--ignore-certificate-errors'
        ]
        self.assertItemsEqual(
            expected_args,
            chrome_startup_args.GetReplayArgs(network_backend, False))
    def GetBrowserStartupArgs(self, browser_options):
        startup_args = chrome_startup_args.GetFromBrowserOptions(
            browser_options)
        startup_args.extend(
            chrome_startup_args.GetReplayArgs(
                self._platform_backend.network_controller_backend))

        # Setting port=0 allows the browser to choose a suitable port.
        startup_args.append('--remote-debugging-port=0')
        startup_args.append('--enable-crash-reporter-for-testing')
        startup_args.append('--disable-component-update')

        if not self._is_content_shell:
            window_sizes = [
                arg for arg in browser_options.extra_browser_args
                if arg.startswith('--window-size=')
            ]
            if len(window_sizes) == 0:
                startup_args.append('--window-size=1280,1024')
            if self._flash_path:
                startup_args.append('--ppapi-flash-path=%s' % self._flash_path)
                # Also specify the version of Flash as a large version, so that it is
                # not overridden by the bundled or component-updated version of Flash.
                startup_args.append('--ppapi-flash-version=99.9.999.999')

        if self.profile_directory is not None:
            if self._is_content_shell:
                startup_args.append('--data-path=%s' % self.profile_directory)
            else:
                startup_args.append('--user-data-dir=%s' %
                                    self.profile_directory)

        trace_config_file = (self._platform_backend.tracing_controller_backend.
                             GetChromeTraceConfigFile())
        if trace_config_file:
            startup_args.append('--trace-config-file=%s' % trace_config_file)

        if sys.platform.startswith('linux'):
            # All linux tests should use the --password-store=basic
            # flag, which stops Chrome from reaching the system's Keyring or
            # KWallet. These are stateful system libraries, which can hurt tests
            # by reducing isolation, reducing speed and introducing flakiness due
            # to their own bugs.
            # See crbug.com/991424.
            startup_args.append('--password-store=basic')

        startup_args.extend(
            [a for a in self.extra_browser_args if a not in startup_args])

        return startup_args
Ejemplo n.º 13
0
    def testReplayArgsUseLiveTrafficWithNoSpkiSupport(self):
        network_backend = mock.Mock()
        network_backend.is_open = True
        network_backend.use_live_traffic = True
        network_backend.forwarder.remote_port = 123

        expected_args = [
            '--proxy-server=socks://127.0.0.1:123',
            '--proxy-bypass-list=<-loopback>'
        ]
        self.assertItemsEqual(
            expected_args,
            chrome_startup_args.GetReplayArgs(network_backend,
                                              supports_spki_list=False))
Ejemplo n.º 14
0
    def GetBrowserStartupArgs(self, browser_options):
        startup_args = chrome_startup_args.GetFromBrowserOptions(
            browser_options)
        startup_args.extend(
            chrome_startup_args.GetReplayArgs(
                self._platform_backend.network_controller_backend,
                supports_spki_list=self._backend_settings.supports_spki_list))
        startup_args.append('--enable-remote-debugging')
        startup_args.append('--disable-fre')
        startup_args.append('--disable-external-intent-requests')

        # Need to specify the user profile directory for
        # --ignore-certificate-errors-spki-list to work.
        startup_args.append('--user-data-dir=' + self.profile_directory)

        return startup_args
Ejemplo n.º 15
0
    def GetBrowserStartupArgs(self, browser_options):
        startup_args = chrome_startup_args.GetFromBrowserOptions(
            browser_options)
        startup_args.extend(
            chrome_startup_args.GetReplayArgs(
                self._platform_backend.network_controller_backend))

        vmodule = ','.join('%s=2' % pattern for pattern in [
            '*/chromeos/net/*', '*/chromeos/login/*',
            'chrome_browser_main_posix'
        ])

        startup_args.extend([
            '--enable-smooth-scrolling',
            '--enable-threaded-compositing',
            # Allow devtools to connect to chrome.
            '--remote-debugging-port=0',
            # Open a maximized window.
            '--start-maximized',
            # Disable system startup sound.
            '--ash-disable-system-sounds',
            # Skip user image selection screen, and post login screens.
            '--oobe-skip-postlogin',
            # Disable chrome logging redirect. crbug.com/724273.
            '--disable-logging-redirect',
            # Debug logging.
            '--vmodule=%s' % vmodule,
        ])

        if not browser_options.expect_policy_fetch:
            startup_args.append('--allow-failed-policy-fetch-for-test')

        # If we're using GAIA, skip to login screen, and do not disable GAIA
        # services.
        if browser_options.gaia_login:
            startup_args.append('--oobe-skip-to-login')
        elif browser_options.disable_gaia_services:
            startup_args.append('--disable-gaia-services')

        trace_config_file = (self._platform_backend.tracing_controller_backend.
                             GetChromeTraceConfigFile())
        if trace_config_file:
            startup_args.append('--trace-config-file=%s' % trace_config_file)

        return startup_args
Ejemplo n.º 16
0
  def GetBrowserStartupArgs(self, browser_options):
    startup_args = chrome_startup_args.GetFromBrowserOptions(browser_options)
    # use the flag `--ignore-certificate-errors` if in compatibility mode
    supports_spki_list = (
        self._backend_settings.supports_spki_list and
        compat_mode_options.IGNORE_CERTIFICATE_ERROR
        not in browser_options.compatibility_mode)
    startup_args.extend(chrome_startup_args.GetReplayArgs(
        self._platform_backend.network_controller_backend,
        supports_spki_list=supports_spki_list))
    startup_args.append('--enable-remote-debugging')
    startup_args.append('--disable-fre')
    startup_args.append('--disable-external-intent-requests')

    # Need to specify the user profile directory for
    # --ignore-certificate-errors-spki-list to work.
    startup_args.append('--user-data-dir=' + self.profile_directory)

    return startup_args
  def GetBrowserStartupArgs(self, browser_options):
    startup_args = chrome_startup_args.GetFromBrowserOptions(browser_options)

    # TODO(crbug.com/753948): spki-list is not yet supported on WebView,
    # make this True when support is implemented.
    supports_spki_list = not isinstance(
        self._backend_settings,
        android_browser_backend_settings.WebviewBackendSettings)
    startup_args.extend(chrome_startup_args.GetReplayArgs(
        self._platform_backend.network_controller_backend,
        supports_spki_list=supports_spki_list))

    startup_args.append('--enable-remote-debugging')
    startup_args.append('--disable-fre')
    startup_args.append('--disable-external-intent-requests')

    # Need to specify the user profile directory for
    # --ignore-certificate-errors-spki-list to work.
    startup_args.append('--user-data-dir=' + self.profile_directory)

    return startup_args