| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import logging | 5 import logging |
| 6 import os | 6 import os |
| 7 import shutil | 7 import shutil |
| 8 import sys | 8 import sys |
| 9 import tempfile | 9 import tempfile |
| 10 import zipfile | 10 import zipfile |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 222 |
| 223 def WillRunStory(self, page): | 223 def WillRunStory(self, page): |
| 224 if self._ShouldDownloadPregeneratedProfileArchive(): | 224 if self._ShouldDownloadPregeneratedProfileArchive(): |
| 225 self._DownloadPregeneratedProfileArchive() | 225 self._DownloadPregeneratedProfileArchive() |
| 226 | 226 |
| 227 if self._ShouldMigrateProfile(): | 227 if self._ShouldMigrateProfile(): |
| 228 self._MigratePregeneratedProfile() | 228 self._MigratePregeneratedProfile() |
| 229 | 229 |
| 230 page_set = page.page_set | 230 page_set = page.page_set |
| 231 self._current_page = page | 231 self._current_page = page |
| 232 if self._test.RestartBrowserBeforeEachPage() or page.startup_url: | 232 if self._browser and (self._test.RestartBrowserBeforeEachPage() |
| 233 or page.startup_url): |
| 234 assert not self.platform.tracing_controller.is_tracing_running, ( |
| 235 'Should not restart browser when tracing is already running. For ' |
| 236 'TimelineBasedMeasurement (TBM) benchmarks, you should not use ' |
| 237 'startup_url. Use benchmark.ShouldTearDownStateAfterEachStoryRun ' |
| 238 'instead.') |
| 233 self._StopBrowser() | 239 self._StopBrowser() |
| 234 started_browser = not self.browser | 240 started_browser = not self.browser |
| 235 | 241 |
| 236 archive_path = page_set.WprFilePathForStory(page) | 242 archive_path = page_set.WprFilePathForStory(page) |
| 237 # TODO(nednguyen, perezju): Ideally we should just let the network | 243 # TODO(nednguyen, perezju): Ideally we should just let the network |
| 238 # controller raise an exception when the archive_path is not found. | 244 # controller raise an exception when the archive_path is not found. |
| 239 if archive_path is not None and not os.path.isfile(archive_path): | 245 if archive_path is not None and not os.path.isfile(archive_path): |
| 240 logging.warning('WPR archive missing: %s', archive_path) | 246 logging.warning('WPR archive missing: %s', archive_path) |
| 241 archive_path = None | 247 archive_path = None |
| 242 self.platform.network_controller.StartReplay( | 248 self.platform.network_controller.StartReplay( |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 class SharedDesktopPageState(SharedPageState): | 516 class SharedDesktopPageState(SharedPageState): |
| 511 _device_type = 'desktop' | 517 _device_type = 'desktop' |
| 512 | 518 |
| 513 | 519 |
| 514 class SharedTabletPageState(SharedPageState): | 520 class SharedTabletPageState(SharedPageState): |
| 515 _device_type = 'tablet' | 521 _device_type = 'tablet' |
| 516 | 522 |
| 517 | 523 |
| 518 class Shared10InchTabletPageState(SharedPageState): | 524 class Shared10InchTabletPageState(SharedPageState): |
| 519 _device_type = 'tablet_10_inch' | 525 _device_type = 'tablet_10_inch' |
| OLD | NEW |