OLD | NEW |
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 import json | 4 import json |
5 import logging | 5 import logging |
6 import os | 6 import os |
7 import platform | 7 import platform |
8 import shutil | 8 import shutil |
9 import socket | 9 import socket |
10 import sys | 10 import sys |
11 import tempfile | 11 import tempfile |
12 import time | 12 import time |
13 import urllib2 | 13 import urllib2 |
14 import zipfile | 14 import zipfile |
15 | 15 |
16 from telemetry.core import util | |
17 from telemetry.page import page_set | |
18 from telemetry.page import profile_creator | 16 from telemetry.page import profile_creator |
19 | 17 |
| 18 import page_sets |
| 19 |
20 | 20 |
21 def _ExternalExtensionsPath(): | 21 def _ExternalExtensionsPath(): |
22 """Returns the OS-dependent path at which to install the extension deployment | 22 """Returns the OS-dependent path at which to install the extension deployment |
23 files""" | 23 files""" |
24 if platform.system() == 'Darwin': | 24 if platform.system() == 'Darwin': |
25 return os.path.join('/Library', 'Application Support', 'Google', 'Chrome', | 25 return os.path.join('/Library', 'Application Support', 'Google', 'Chrome', |
26 'External Extensions') | 26 'External Extensions') |
27 elif platform.system() == 'Linux': | 27 elif platform.system() == 'Linux': |
28 return os.path.join('/opt', 'google', 'chrome', 'extensions' ) | 28 return os.path.join('/opt', 'google', 'chrome', 'extensions' ) |
29 else: | 29 else: |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 """Virtual base class for profile creators that install extensions. | 77 """Virtual base class for profile creators that install extensions. |
78 | 78 |
79 Extensions are installed using the mechanism described in | 79 Extensions are installed using the mechanism described in |
80 https://developer.chrome.com/extensions/external_extensions.html . | 80 https://developer.chrome.com/extensions/external_extensions.html . |
81 | 81 |
82 Subclasses are meant to be run interactively. | 82 Subclasses are meant to be run interactively. |
83 """ | 83 """ |
84 | 84 |
85 def __init__(self): | 85 def __init__(self): |
86 super(ExtensionsProfileCreator, self).__init__() | 86 super(ExtensionsProfileCreator, self).__init__() |
87 typical_25 = os.path.join(util.GetBaseDir(), 'page_sets', 'typical_25.py') | 87 self._page_set = page_sets.Typical25() |
88 self._page_set = page_set.PageSet.FromFile(typical_25) | |
89 | 88 |
90 # Directory into which the output profile is written. | 89 # Directory into which the output profile is written. |
91 self._output_profile_path = None | 90 self._output_profile_path = None |
92 | 91 |
93 # List of extensions to install. | 92 # List of extensions to install. |
94 self._extensions_to_install = [] | 93 self._extensions_to_install = [] |
95 | 94 |
96 # Theme to install (if any). | 95 # Theme to install (if any). |
97 self._theme_to_install = None | 96 self._theme_to_install = None |
98 | 97 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 if not self._extensions_installed: | 213 if not self._extensions_installed: |
215 sleep_seconds = 5 * 60 | 214 sleep_seconds = 5 * 60 |
216 logging.info("Sleeping for %d seconds." % sleep_seconds) | 215 logging.info("Sleeping for %d seconds." % sleep_seconds) |
217 time.sleep(sleep_seconds) | 216 time.sleep(sleep_seconds) |
218 self._extensions_installed = True | 217 self._extensions_installed = True |
219 else: | 218 else: |
220 # Phase 2: Wait for tab to finish loading. | 219 # Phase 2: Wait for tab to finish loading. |
221 for i in xrange(len(tab.browser.tabs)): | 220 for i in xrange(len(tab.browser.tabs)): |
222 t = tab.browser.tabs[i] | 221 t = tab.browser.tabs[i] |
223 t.WaitForDocumentReadyStateToBeComplete() | 222 t.WaitForDocumentReadyStateToBeComplete() |
OLD | NEW |