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 json | 5 import json |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 import platform | 8 import platform |
9 import shutil | 9 import shutil |
10 import socket | 10 import socket |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 199 |
200 def CanRunForPage(self, page): | 200 def CanRunForPage(self, page): |
201 # No matter how many pages in the pageset, just perform two test iterations. | 201 # No matter how many pages in the pageset, just perform two test iterations. |
202 return page.page_set.pages.index(page) < 2 | 202 return page.page_set.pages.index(page) < 2 |
203 | 203 |
204 def ValidateAndMeasurePage(self, _, tab, results): | 204 def ValidateAndMeasurePage(self, _, tab, results): |
205 # Profile setup works in 2 phases: | 205 # Profile setup works in 2 phases: |
206 # Phase 1: When the first page is loaded: we wait for a timeout to allow | 206 # Phase 1: When the first page is loaded: we wait for a timeout to allow |
207 # all extensions to install and to prime safe browsing and other | 207 # all extensions to install and to prime safe browsing and other |
208 # caches. Extensions may open tabs as part of the install process. | 208 # caches. Extensions may open tabs as part of the install process. |
209 # Phase 2: When the second page loads, page_runner closes all tabs - | 209 # Phase 2: When the second page loads, user_story_runner closes all tabs - |
210 # we are left with one open tab, wait for that to finish loading. | 210 # we are left with one open tab, wait for that to finish loading. |
211 | 211 |
212 # Sleep for a bit to allow safe browsing and other data to load + | 212 # Sleep for a bit to allow safe browsing and other data to load + |
213 # extensions to install. | 213 # extensions to install. |
214 if not self._extensions_installed: | 214 if not self._extensions_installed: |
215 sleep_seconds = 5 * 60 | 215 sleep_seconds = 5 * 60 |
216 logging.info("Sleeping for %d seconds." % sleep_seconds) | 216 logging.info("Sleeping for %d seconds." % sleep_seconds) |
217 time.sleep(sleep_seconds) | 217 time.sleep(sleep_seconds) |
218 self._extensions_installed = True | 218 self._extensions_installed = True |
219 else: | 219 else: |
220 # Phase 2: Wait for tab to finish loading. | 220 # Phase 2: Wait for tab to finish loading. |
221 for i in xrange(len(tab.browser.tabs)): | 221 for i in xrange(len(tab.browser.tabs)): |
222 t = tab.browser.tabs[i] | 222 t = tab.browser.tabs[i] |
223 t.WaitForDocumentReadyStateToBeComplete() | 223 t.WaitForDocumentReadyStateToBeComplete() |
OLD | NEW |