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