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

Side by Side Diff: tools/telemetry/telemetry/page/page_test.py

Issue 44883004: [telemetry] Move tab from RunState to PageState. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « tools/telemetry/telemetry/page/page_runner.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 import logging 4 import logging
5 5
6 from telemetry.page import test_expectations 6 from telemetry.page import test_expectations
7 from telemetry.page.actions import all_page_actions 7 from telemetry.page.actions import all_page_actions
8 from telemetry.page.actions import navigate 8 from telemetry.page.actions import navigate
9 from telemetry.page.actions import page_action 9 from telemetry.page.actions import page_action
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 @property 96 @property
97 def close_tabs_before_run(self): 97 def close_tabs_before_run(self):
98 """When set to True, all tabs are closed before running the test for the 98 """When set to True, all tabs are closed before running the test for the
99 first time.""" 99 first time."""
100 return self._close_tabs_before_run 100 return self._close_tabs_before_run
101 101
102 @close_tabs_before_run.setter 102 @close_tabs_before_run.setter
103 def close_tabs_before_run(self, close_tabs): 103 def close_tabs_before_run(self, close_tabs):
104 self._close_tabs_before_run = close_tabs 104 self._close_tabs_before_run = close_tabs
105 105
106 def NeedsBrowserRestartAfterEachRun(self, tab): # pylint: disable=W0613 106 def NeedsBrowserRestartAfterEachRun(self, browser): # pylint: disable=W0613
107 """Override to specify browser restart after each run.""" 107 """Override to specify browser restart after each run."""
108 return self._needs_browser_restart_after_each_run 108 return self._needs_browser_restart_after_each_run
109 109
110 def AddCommandLineOptions(self, parser): 110 def AddCommandLineOptions(self, parser):
111 """Override to expose command-line options for this test. 111 """Override to expose command-line options for this test.
112 112
113 The provided parser is an optparse.OptionParser instance and accepts all 113 The provided parser is an optparse.OptionParser instance and accepts all
114 normal results. The parsed options are available in Run as 114 normal results. The parsed options are available in Run as
115 self.options.""" 115 self.options."""
116 pass 116 pass
(...skipping 14 matching lines...) Expand all
131 pass 131 pass
132 132
133 def DidStartBrowser(self, browser): 133 def DidStartBrowser(self, browser):
134 """Override to customize the browser right after it has launched.""" 134 """Override to customize the browser right after it has launched."""
135 pass 135 pass
136 136
137 def CanRunForPage(self, page): # pylint: disable=W0613 137 def CanRunForPage(self, page): # pylint: disable=W0613
138 """Override to customize if the test can be ran for the given page.""" 138 """Override to customize if the test can be ran for the given page."""
139 return True 139 return True
140 140
141 def WillRunTest(self, tab): 141 def WillRunTest(self):
142 """Override to do operations before the page set(s) are navigated.""" 142 """Override to do operations before the page set(s) are navigated."""
143 pass 143 pass
144 144
145 def DidRunTest(self, tab, results): 145 def DidRunTest(self, browser, results):
146 """Override to do operations after all page set(s) are completed. 146 """Override to do operations after all page set(s) are completed.
147 147
148 This will occur before the browser is torn down. 148 This will occur before the browser is torn down.
149 """ 149 """
150 pass 150 pass
151 151
152 def WillRunPageRepeats(self, page, tab): 152 def WillRunPageRepeats(self, page):
153 """Override to do operations before each page is iterated over.""" 153 """Override to do operations before each page is iterated over."""
154 pass 154 pass
155 155
156 def DidRunPageRepeats(self, page, tab): 156 def DidRunPageRepeats(self, page):
157 """Override to do operations after each page is iterated over.""" 157 """Override to do operations after each page is iterated over."""
158 pass 158 pass
159 159
160 def DidStartHTTPServer(self, tab): 160 def DidStartHTTPServer(self, tab):
161 """Override to do operations after the HTTP server is started.""" 161 """Override to do operations after the HTTP server is started."""
162 pass 162 pass
163 163
164 def WillNavigateToPage(self, page, tab): 164 def WillNavigateToPage(self, page, tab):
165 """Override to do operations before the page is navigated, notably Telemetry 165 """Override to do operations before the page is navigated, notably Telemetry
166 will already have performed the following operations on the browser before 166 will already have performed the following operations on the browser before
(...skipping 18 matching lines...) Expand all
185 def CreatePageSet(self, args, options): # pylint: disable=W0613 185 def CreatePageSet(self, args, options): # pylint: disable=W0613
186 """Override to make this test generate its own page set instead of 186 """Override to make this test generate its own page set instead of
187 allowing arbitrary page sets entered from the command-line.""" 187 allowing arbitrary page sets entered from the command-line."""
188 return None 188 return None
189 189
190 def CreateExpectations(self, page_set): # pylint: disable=W0613 190 def CreateExpectations(self, page_set): # pylint: disable=W0613
191 """Override to make this test generate its own expectations instead of 191 """Override to make this test generate its own expectations instead of
192 any that may have been defined in the page set.""" 192 any that may have been defined in the page set."""
193 return test_expectations.TestExpectations() 193 return test_expectations.TestExpectations()
194 194
195 def TabForPage(self, page, tab): # pylint: disable=W0613 195 def TabForPage(self, page, browser): # pylint: disable=W0613
196 """Override to select a different tab for the page. For instance, to 196 """Override to select a different tab for the page. For instance, to
197 create a new tab for every page, return tab.browser.tabs.New().""" 197 create a new tab for every page, return tab.browser.tabs.New()."""
Luigi Semenzato 2013/10/26 05:11:49 The comment is out of sync.
dtu 2013/10/28 19:26:55 Done.
198 return tab 198 return browser.tabs[0]
199 199
200 def ValidatePageSet(self, page_set): 200 def ValidatePageSet(self, page_set):
201 """Override to examine the page set before the test run. Useful for 201 """Override to examine the page set before the test run. Useful for
202 example to validate that the pageset can be used with the test.""" 202 example to validate that the pageset can be used with the test."""
203 pass 203 pass
204 204
205 def Run(self, options, page, tab, results): 205 def Run(self, options, page, tab, results):
206 self.options = options 206 self.options = options
207 compound_action = GetCompoundActionFromPage(page, self._action_name_to_run) 207 compound_action = GetCompoundActionFromPage(page, self._action_name_to_run)
208 self._RunCompoundAction(page, tab, compound_action) 208 self._RunCompoundAction(page, tab, compound_action)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 251
252 def IsExiting(self): 252 def IsExiting(self):
253 return self._exit_requested 253 return self._exit_requested
254 254
255 def RequestExit(self): 255 def RequestExit(self):
256 self._exit_requested = True 256 self._exit_requested = True
257 257
258 @property 258 @property
259 def action_name_to_run(self): 259 def action_name_to_run(self):
260 return self._action_name_to_run 260 return self._action_name_to_run
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/page/page_runner.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698