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

Side by Side Diff: tools/perf/profile_creators/profile_extender.py

Issue 1240703003: Extension profile generator + benchmark for startup with profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments added to extension_set.csv and small style fixes. Created 5 years, 5 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 unified diff | Download patch
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from telemetry.core import platform 5 from telemetry.core import platform
6 from telemetry.util import wpr_modes 6 from telemetry.util import wpr_modes
7 from telemetry.internal.browser import browser_finder 7 from telemetry.internal.browser import browser_finder
8 from telemetry.internal.browser import browser_finder_exceptions 8 from telemetry.internal.browser import browser_finder_exceptions
9 9
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 @property 52 @property
53 def profile_path(self): 53 def profile_path(self):
54 """The path of the profile that the browser will use while it's running.""" 54 """The path of the profile that the browser will use while it's running."""
55 return self.finder_options.output_profile_path 55 return self.finder_options.output_profile_path
56 56
57 @property 57 @property
58 def browser(self): 58 def browser(self):
59 return self._browser 59 return self._browser
60 60
61 def EnabledOSList(self):
62 """Returns a list of OSes that this extender can run on.
63
64 Can be overridden by subclasses.
65
66 Returns:
67 List of OS ('win', 'mac', or 'linux') that this extender can run on.
68 None if this extender can run on all platforms.
69 """
70 return None
71
robliao 2015/07/21 19:49:52 Style: In Python classes, defs get one space. Yeah
sydli 2015/07/21 20:33:04 Done.
72
61 def SetUpBrowser(self): 73 def SetUpBrowser(self):
62 """Finds and starts the browser. 74 """Finds and starts the browser.
63 75
64 Can be overridden by subclasses. The subclass implementation must call the 76 Can be overridden by subclasses. The subclass implementation must call the
65 super class implementation. 77 super class implementation.
66 78
67 Subclasses do not need to call this method. This method is only necessary 79 Subclasses do not need to call this method. This method is only necessary
68 if the subclass needs to start a browser. If a subclass does call this 80 if the subclass needs to start a browser. If a subclass does call this
69 method, the subclass must also call TearDownBrowser(). 81 method, the subclass must also call TearDownBrowser().
70 """ 82 """
71 possible_browser = self._GetPossibleBrowser(self.finder_options) 83 possible_browser = self._GetPossibleBrowser(self.finder_options)
72 84
85 os_name = possible_browser.platform.GetOSName()
86 enabled_os_list = self.EnabledOSList()
87 if enabled_os_list is not None and os_name not in enabled_os_list:
88 raise NotImplementedError(
89 'This profile extender on %s is not yet supported'
90 % os_name)
91
73 assert possible_browser.supports_tab_control 92 assert possible_browser.supports_tab_control
74 assert (platform.GetHostPlatform().GetOSName() in 93 assert (platform.GetHostPlatform().GetOSName() in
75 ["win", "mac", "linux"]) 94 ["win", "mac", "linux"])
76 95
77 self._SetUpWebPageReplay(self.finder_options, possible_browser) 96 self._SetUpWebPageReplay(self.finder_options, possible_browser)
78 self._browser = possible_browser.Create(self.finder_options) 97 self._browser = possible_browser.Create(self.finder_options)
79 98
80 def TearDownBrowser(self): 99 def TearDownBrowser(self):
81 """Tears down the browser. 100 """Tears down the browser.
82 101
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 possible_browser = browser_finder.FindBrowser(finder_options) 142 possible_browser = browser_finder.FindBrowser(finder_options)
124 if not possible_browser: 143 if not possible_browser:
125 raise browser_finder_exceptions.BrowserFinderException( 144 raise browser_finder_exceptions.BrowserFinderException(
126 'No browser found.\n\nAvailable browsers:\n%s\n' % 145 'No browser found.\n\nAvailable browsers:\n%s\n' %
127 '\n'.join(browser_finder.GetAllAvailableBrowserTypes(finder_options))) 146 '\n'.join(browser_finder.GetAllAvailableBrowserTypes(finder_options)))
128 finder_options.browser_options.browser_type = ( 147 finder_options.browser_options.browser_type = (
129 possible_browser.browser_type) 148 possible_browser.browser_type)
130 149
131 return possible_browser 150 return possible_browser
132 151
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698