Chromium Code Reviews| Index: tools/telemetry/telemetry/page/page_test.py |
| diff --git a/tools/telemetry/telemetry/page/page_test.py b/tools/telemetry/telemetry/page/page_test.py |
| index 368aa894706c1fb48d66ebe8a54bbd8ada56cebc..d1100db1a3c51c0a7fab16ae16837295f38ed51f 100644 |
| --- a/tools/telemetry/telemetry/page/page_test.py |
| +++ b/tools/telemetry/telemetry/page/page_test.py |
| @@ -107,10 +107,28 @@ class PageTest(object): |
| def close_tabs_before_run(self, close_tabs): |
| self._close_tabs_before_run = close_tabs |
| - def NeedsBrowserRestartAfterEachRun(self, browser): # pylint: disable=W0613 |
| - """Override to specify browser restart after each run.""" |
| + def AlwaysRestartBrowserForEachPage(self): |
|
jeremy
2013/12/17 11:29:44
Any reason not to name this: RestartBrowserForEach
aberent
2013/12/17 17:31:27
Done.
|
| + """ Should the browser be restarted for each page? |
| + |
| + This returns true if the test needs to unconditionally restart the |
| + browser for each page. It may be called before the browser is started. |
| + |
| + This must return the same result every time it is called within a single |
| + run of a page set. |
| + """ |
| return self._needs_browser_restart_after_each_run |
| + def NeedsBrowserRestartBeforeNextPage(self, browser): # pylint: disable=W0613 |
|
jeremy
2013/12/17 11:29:44
nit: rename to RestartBrowserBeforeNextPage() ?
aberent
2013/12/17 17:31:27
Done.
|
| + """Should be restarted before the next page? |
| + |
| + This is called after a page is run to decide whether the browser needs to |
| + be restarted. A test that wants to check the state of the browser before |
| + deciding whether to restart the browser should override this. |
| + |
| + This may return a different result each time it is called. |
| + """ |
| + return self.AlwaysRestartBrowserForEachPage() |
| + |
| def AddCommandLineOptions(self, parser): |
| """Override to expose command-line options for this test. |
| @@ -124,7 +142,15 @@ class PageTest(object): |
| pass |
| def CustomizeBrowserOptionsForPage(self, page, options): |
| - """Add options specific to the test and the given page.""" |
| + """Add options specific to the test and the given page. |
| + |
| + This will be used differently depending on the value returned by |
| + AlwaysRestartBrowserBeforeEachPage. If that function returns True then this |
| + this function will be called for each page individually before the browser |
|
jeremy
2013/12/17 11:29:44
nit:this this
|
| + is started for that page. If it returns False then this function will be |
| + called for every page in the page set before the browser is started for any |
| + page. |
| + """ |
| if not self.CanRunForPage(page): |
| return |
| interactive = options and options.interactive |