Exemple #1
0
    def __init__(self, desktop_platform_backend, browser_options, executable,
                 flash_path, is_content_shell, browser_directory,
                 output_profile_path, extensions_to_load):
        super(DesktopBrowserBackend,
              self).__init__(desktop_platform_backend,
                             supports_tab_control=not is_content_shell,
                             supports_extensions=not is_content_shell,
                             browser_options=browser_options,
                             output_profile_path=output_profile_path,
                             extensions_to_load=extensions_to_load)

        # Initialize fields so that an explosion during init doesn't break in Close.
        self._proc = None
        self._tmp_profile_dir = None
        self._tmp_output_file = None

        self._executable = executable
        if not self._executable:
            raise Exception('Cannot create browser, no executable found!')

        assert not flash_path or os.path.exists(flash_path)
        self._flash_path = flash_path

        self._is_content_shell = is_content_shell

        if len(extensions_to_load) > 0 and is_content_shell:
            raise browser_backend.ExtensionsNotSupportedException(
                'Content shell does not support extensions.')

        self._browser_directory = browser_directory
        self._port = None
        self._tmp_minidump_dir = tempfile.mkdtemp()
        self._crash_service = None
        if self.browser_options.enable_logging:
            self._log_file_path = os.path.join(tempfile.mkdtemp(),
                                               'chrome.log')
        else:
            self._log_file_path = None

        self._SetupProfile()
    def __init__(self, android_platform_backend, browser_options,
                 backend_settings):
        assert isinstance(
            android_platform_backend,
            android_platform_backend_module.AndroidPlatformBackend)
        super(AndroidBrowserBackend, self).__init__(
            android_platform_backend,
            supports_tab_control=backend_settings.supports_tab_control,
            supports_extensions=False,
            browser_options=browser_options)

        self._port_keeper = util.PortKeeper()
        # Use the port hold by _port_keeper by default.
        self._port = self._port_keeper.port

        extensions_to_load = browser_options.extensions_to_load

        if len(extensions_to_load) > 0:
            raise browser_backend.ExtensionsNotSupportedException(
                'Android browser does not support extensions.')

        # Initialize fields so that an explosion during init doesn't break in Close.
        self._backend_settings = backend_settings
        self._saved_sslflag = ''

        # Stop old browser, if any.
        self._StopBrowser()

        if self.device.HasRoot() or self.device.NeedsSU():
            if self.browser_options.profile_dir:
                self.platform_backend.PushProfile(
                    self._backend_settings.package,
                    self.browser_options.profile_dir)
            elif not self.browser_options.dont_override_profile:
                self.platform_backend.RemoveProfile(
                    self._backend_settings.package,
                    self._backend_settings.profile_ignore_list)

        # Set the debug app if needed.
        self.platform_backend.SetDebugApp(self._backend_settings.package)
Exemple #3
0
    def __init__(self, platform_backend, browser_options, browser_directory,
                 profile_directory, supports_extensions, supports_tab_control):
        super(ChromeBrowserBackend,
              self).__init__(platform_backend=platform_backend,
                             browser_options=browser_options,
                             supports_extensions=supports_extensions,
                             tab_list_backend=tab_list_backend.TabListBackend)
        self._browser_directory = browser_directory
        self._profile_directory = profile_directory
        self._supports_tab_control = supports_tab_control

        self._devtools_client = None

        self._extensions_to_load = browser_options.extensions_to_load
        if not supports_extensions and len(self._extensions_to_load) > 0:
            raise browser_backend.ExtensionsNotSupportedException(
                'Extensions are not supported on the selected browser')

        if self.browser_options.dont_override_profile:
            logging.warning(
                'Not overriding profile. This can cause unexpected '
                'effects due to profile-specific settings, such as '
                'about:flags settings, cookies, and extensions.')
    def __init__(self, android_platform_backend, browser_options,
                 backend_settings):
        assert isinstance(
            android_platform_backend,
            android_platform_backend_module.AndroidPlatformBackend)
        super(AndroidBrowserBackend, self).__init__(
            android_platform_backend,
            supports_tab_control=backend_settings.supports_tab_control,
            supports_extensions=False,
            browser_options=browser_options)

        extensions_to_load = browser_options.extensions_to_load

        if len(extensions_to_load) > 0:
            raise browser_backend.ExtensionsNotSupportedException(
                'Android browser does not support extensions.')

        # Initialize fields so that an explosion during init doesn't break in Close.
        self._backend_settings = backend_settings
        self._saved_sslflag = ''
        self._app_ui = None

        # Set the debug app if needed.
        self.platform_backend.SetDebugApp(self._backend_settings.package)
Exemple #5
0
 def extensions(self):
   if not self.supports_extensions:
     raise browser_backend.ExtensionsNotSupportedException(
         'Extensions not supported')
   return extension_dict.ExtensionDict(self._browser_backend.extension_backend)