Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Unified Diff: tools/perf/profile_creators/profile_extender.py

Issue 1491183003: [Telemetry] Move WPR life cycle from browser to platform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: work in progress Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/telemetry/telemetry/core/network_controller.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/profile_creators/profile_extender.py
diff --git a/tools/perf/profile_creators/profile_extender.py b/tools/perf/profile_creators/profile_extender.py
index 292afa736524b276e8e443ec69fa6e716bec6c1f..072e9b7d1d0d02df69b6ae69eb7f2bf4e47a9574 100644
--- a/tools/perf/profile_creators/profile_extender.py
+++ b/tools/perf/profile_creators/profile_extender.py
@@ -35,7 +35,8 @@ class ProfileExtender(object):
# A reference to the browser that will be performing all of the tab
# navigations.
- # This member is initialized during SetUpBrowser().
+ # These members are initialized during SetUpBrowser().
+ self._possible_browser = None
self._browser = None
def Run(self):
@@ -88,18 +89,18 @@ class ProfileExtender(object):
if the subclass needs to start a browser. If a subclass does call this
method, the subclass must also call TearDownBrowser().
"""
- possible_browser = self._GetPossibleBrowser(self.finder_options)
+ self._possible_browser = self._GetPossibleBrowser(self.finder_options)
enabled_os_list = self.EnabledOSList()
if self._os_name not in enabled_os_list:
raise NotImplementedError(
'This profile extender on %s is not yet supported'
% self._os_name)
- if possible_browser.IsRemote():
+ if self._possible_browser.IsRemote():
raise NotImplementedError(
'Profile extenders are not yet supported on remote platforms.')
- assert possible_browser.supports_tab_control
+ assert self._possible_browser.supports_tab_control
- self._SetUpWebPageReplay(self.finder_options, possible_browser)
+ self._SetUpWebPageReplay(self.finder_options)
self._browser = possible_browser.Create(self.finder_options)
def TearDownBrowser(self):
@@ -111,6 +112,8 @@ class ProfileExtender(object):
if self._browser:
self._browser.Close()
self._browser = None
+ if self._possible_browser:
+ self._possible_browser.platform.network_controller.Close()
def FetchWebPageReplayArchives(self):
"""Fetches the web page replay archives.
@@ -119,7 +122,7 @@ class ProfileExtender(object):
"""
pass
- def _SetUpWebPageReplay(self, finder_options, possible_browser):
+ def _SetUpWebPageReplay(self, finder_options):
"""Sets up Web Page Replay, if necessary."""
wpr_archive_path = self.WebPageReplayArchivePath()
@@ -128,20 +131,17 @@ class ProfileExtender(object):
self.FetchWebPageReplayArchives()
- # The browser options needs to be passed to both the network controller
- # as well as the browser backend.
browser_options = finder_options.browser_options
if finder_options.use_live_sites:
- browser_options.wpr_mode = wpr_modes.WPR_OFF
+ wpr_mode = wpr_modes.WPR_OFF
else:
- browser_options.wpr_mode = wpr_modes.WPR_REPLAY
+ wpr_mode = wpr_modes.WPR_REPLAY
- network_controller = possible_browser.platform.network_controller
- make_javascript_deterministic = True
-
- network_controller.SetReplayArgs(
- wpr_archive_path, browser_options.wpr_mode, browser_options.netsim,
- browser_options.extra_wpr_args, make_javascript_deterministic)
+ network_controller = self._possible_browser.platform.network_controller
+ network_controller.Open(
+ wpr_mode, browser_options.netsim, browser_options.extra_wpr_args)
+ network_controller.StartReplay(
+ wpr_archive_path, make_javascript_deterministic=True)
def _GetPossibleBrowser(self, finder_options):
"""Return a possible_browser with the given options."""
@@ -154,4 +154,3 @@ class ProfileExtender(object):
possible_browser.browser_type)
return possible_browser
-
« no previous file with comments | « no previous file | tools/telemetry/telemetry/core/network_controller.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698