def __init__(self, is_content_shell, supports_extensions, browser_options, output_profile_path, extensions_to_load): super(ChromeBrowserBackend, self).__init__(is_content_shell=is_content_shell, supports_extensions=supports_extensions, browser_options=browser_options, tab_list_backend=tab_list_backend.TabListBackend) self._port = None self._inspector_protocol_version = 0 self._chrome_branch_number = None self._tracing_backend = None self._system_info_backend = None self._output_profile_path = output_profile_path self._extensions_to_load = extensions_to_load self.webpagereplay_local_http_port = util.GetAvailableLocalPort() self.webpagereplay_local_https_port = util.GetAvailableLocalPort() self.webpagereplay_remote_http_port = self.webpagereplay_local_http_port self.webpagereplay_remote_https_port = self.webpagereplay_local_https_port if (self.browser_options.dont_override_profile and not options_for_unittests.AreSet()): sys.stderr.write( 'Warning: Not overriding profile. This can cause ' 'unexpected effects due to profile-specific settings, ' 'such as about:flags settings, cookies, and ' 'extensions.\n') self._misc_web_contents_backend = ( misc_web_contents_backend.MiscWebContentsBackend(self)) self._extension_dict_backend = None if supports_extensions: self._extension_dict_backend = ( extension_dict_backend.ExtensionDictBackend(self))
def __init__(self, supports_tab_control, supports_extensions, browser_options, output_profile_path, extensions_to_load): super(ChromeBrowserBackend, self).__init__( supports_extensions=supports_extensions, browser_options=browser_options, tab_list_backend=tab_list_backend.TabListBackend) self._port = None self._supports_tab_control = supports_tab_control self._tracing_backend = None self._system_info_backend = None self._output_profile_path = output_profile_path self._extensions_to_load = extensions_to_load if browser_options.netsim: self.wpr_port_pairs = forwarders.PortPairs( http=forwarders.PortPair(80, 80), https=forwarders.PortPair(443, 443), dns=forwarders.PortPair(53, 53)) else: self.wpr_port_pairs = forwarders.PortPairs( http=forwarders.PortPair(0, 0), https=forwarders.PortPair(0, 0), dns=None) if (self.browser_options.dont_override_profile and not options_for_unittests.AreSet()): sys.stderr.write('Warning: Not overriding profile. This can cause ' 'unexpected effects due to profile-specific settings, ' 'such as about:flags settings, cookies, and ' 'extensions.\n')
def __init__(self, project): self._project = project self._browser = None self._tab = None self._server = None if telemetry == None: raise Exception( 'Not supported: trace-viewer must be inside a chrome checkout for this to work.' ) # If run in the context of the telemetry test runner, use # telemetry's browser options instead. if telemetry_options_for_unittests.AreSet(): finder_options = telemetry_options_for_unittests.GetCopy() else: finder_options = browser_options.BrowserFinderOptions() parser = finder_options.CreateParser('telemetry_perf_test.py') from tvcm import test_runner finder_options, _ = parser.parse_args( ['--browser', test_runner.BROWSER_TYPE_TO_USE]) finder_options.browser_options.warn_if_no_flash = False browser_to_create = browser_finder.FindBrowser(finder_options) if not browser_to_create: raise Exception('Failed to find the specified browser. ' + ' Its binary is probably broken.') self._browser = browser_to_create.Create() self._tab = None try: self._browser.Start() self._tab = self._browser.tabs[0] # Prevent the project from being mutated from here on out. project.Freeze() self._server = _LocalDevServer(self._project) self._browser.StartLocalServer(self._server) except: self._browser.Close() raise
def __init__(self, is_content_shell, supports_extensions, browser_options, output_profile_path, extensions_to_load): super(ChromeBrowserBackend, self).__init__(is_content_shell=is_content_shell, supports_extensions=supports_extensions, browser_options=browser_options, tab_list_backend=tab_list_backend.TabListBackend) self._port = None self._inspector_protocol_version = 0 self._chrome_branch_number = None self._tracing_backend = None self._system_info_backend = None self._output_profile_path = output_profile_path self._extensions_to_load = extensions_to_load if browser_options.netsim: self.wpr_port_pairs = forwarders.PortPairs( http=forwarders.PortPair(80, 80), https=forwarders.PortPair(443, 443), dns=forwarders.PortPair(53, 53)) else: self.wpr_port_pairs = forwarders.PortPairs( http=forwarders.PortPair(0, 0), https=forwarders.PortPair(0, 0), dns=None) if (self.browser_options.dont_override_profile and not options_for_unittests.AreSet()): sys.stderr.write( 'Warning: Not overriding profile. This can cause ' 'unexpected effects due to profile-specific settings, ' 'such as about:flags settings, cookies, and ' 'extensions.\n') self._misc_web_contents_backend = ( misc_web_contents_backend.MiscWebContentsBackend(self)) self._extension_dict_backend = None if supports_extensions: self._extension_dict_backend = ( extension_dict_backend.ExtensionDictBackend(self))