Index: tools/telemetry/telemetry/core/browser.py |
diff --git a/tools/telemetry/telemetry/core/browser.py b/tools/telemetry/telemetry/core/browser.py |
index 2d290a9b79ecb662bac2f73420623270391d25f7..3f75fbaab5b165e2644caef77374df1b801425bd 100644 |
--- a/tools/telemetry/telemetry/core/browser.py |
+++ b/tools/telemetry/telemetry/core/browser.py |
@@ -27,7 +27,9 @@ class Browser(object): |
with browser_to_create.Create() as browser: |
... do all your operations on browser here |
""" |
- def __init__(self, backend, platform_backend): |
+ def __init__(self, backend, platform_backend, archive_path, |
+ append_to_existing_wpr, make_javascript_deterministic, |
+ credentials_path): |
assert platform_backend.platform != None |
self._browser_backend = backend |
@@ -36,10 +38,29 @@ class Browser(object): |
self._local_server_controller = local_server.LocalServerController(backend) |
self._tabs = tab_list.TabList(backend.tab_list_backend) |
self.credentials = browser_credentials.BrowserCredentials() |
+ self.credentials.credentials_path = credentials_path |
self._platform_backend.DidCreateBrowser(self, self._browser_backend) |
+ self.SetReplayArchivePath(archive_path, |
+ append_to_existing_wpr, |
+ make_javascript_deterministic) |
+ |
+ browser_options = self._browser_backend.browser_options |
+ self.platform.FlushDnsCache() |
+ if browser_options.clear_sytem_cache_for_browser_and_profile_on_start: |
+ if self.platform.CanFlushIndividualFilesFromSystemCache(): |
+ self.platform.FlushSystemCacheForDirectory( |
+ self._browser_backend.profile_directory) |
+ self.platform.FlushSystemCacheForDirectory( |
+ self._browser_backend.browser_directory) |
+ else: |
+ self.platform.FlushEntireSystemCache() |
+ |
+ self._browser_backend.SetBrowser(self) |
+ self._browser_backend.Start() |
+ self._platform_backend.DidStartBrowser(self, self._browser_backend) |
+ |
def __enter__(self): |
- self.Start() |
return self |
def __exit__(self, *args): |
@@ -230,22 +251,6 @@ class Browser(object): |
del result['ProcessCount'] |
return result |
- def Start(self): |
- browser_options = self._browser_backend.browser_options |
- self.platform.FlushDnsCache() |
- if browser_options.clear_sytem_cache_for_browser_and_profile_on_start: |
- if self.platform.CanFlushIndividualFilesFromSystemCache(): |
- self.platform.FlushSystemCacheForDirectory( |
- self._browser_backend.profile_directory) |
- self.platform.FlushSystemCacheForDirectory( |
- self._browser_backend.browser_directory) |
- else: |
- self.platform.FlushEntireSystemCache() |
- |
- self._browser_backend.SetBrowser(self) |
- self._browser_backend.Start() |
- self._platform_backend.DidStartBrowser(self, self._browser_backend) |
- |
def Close(self): |
"""Closes this browser.""" |
if self._browser_backend.IsBrowserRunning(): |
@@ -343,3 +348,8 @@ class Browser(object): |
See the documentation of the SystemInfo class for more details.""" |
return self._browser_backend.GetSystemInfo() |
+ |
+ # TODO: Remove after call to Start() has been removed from |
+ # related authotest files. |
+ def Start(self): |
+ pass |