OLD | NEW |
1 # Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2015 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 """Utility library for running a startup profile on an Android device. | 5 """Utility library for running a startup profile on an Android device. |
6 | 6 |
7 Sets up a device for cygprofile, disables sandboxing permissions, and sets up | 7 Sets up a device for cygprofile, disables sandboxing permissions, and sets up |
8 support for web page replay, device forwarding, and fake certificate authority | 8 support for web page replay, device forwarding, and fake certificate authority |
9 to make runs repeatable. | 9 to make runs repeatable. |
10 """ | 10 """ |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 self._is_test_ca_installed = False | 128 self._is_test_ca_installed = False |
129 | 129 |
130 shutil.rmtree(os.path.dirname(self._wpr_ca_cert_path), ignore_errors=True) | 130 shutil.rmtree(os.path.dirname(self._wpr_ca_cert_path), ignore_errors=True) |
131 self._wpr_ca_cert_path = None | 131 self._wpr_ca_cert_path = None |
132 self._device_cert_util = None | 132 self._device_cert_util = None |
133 | 133 |
134 def _BringUpWpr(self): | 134 def _BringUpWpr(self): |
135 """Start the WPR server on the host and the forwarder on the device.""" | 135 """Start the WPR server on the host and the forwarder on the device.""" |
136 print 'Starting WPR on host...' | 136 print 'Starting WPR on host...' |
137 _DownloadFromCloudStorage(self._WPR_BUCKET, self._wpr_archive_hash) | 137 _DownloadFromCloudStorage(self._WPR_BUCKET, self._wpr_archive_hash) |
138 args = ['--user_closest_match'] | 138 args = ['--use_closest_match'] |
139 if self._is_test_ca_installed: | 139 if self._is_test_ca_installed: |
140 args.extend(['--should_generate_certs', | 140 args.extend(['--should_generate_certs', |
141 '--https_root_ca_cert_path=' + self._wpr_ca_cert_path]) | 141 '--https_root_ca_cert_path=' + self._wpr_ca_cert_path]) |
142 wpr_server = webpagereplay.ReplayServer(self._wpr_archive, | 142 wpr_server = webpagereplay.ReplayServer(self._wpr_archive, |
143 '127.0.0.1', 0, 0, None, args) | 143 '127.0.0.1', 0, 0, None, args) |
144 ports = wpr_server.StartServer()[:-1] | 144 ports = wpr_server.StartServer()[:-1] |
145 self._wpr_server = wpr_server | 145 self._wpr_server = wpr_server |
146 self._host_http_port = ports[0] | 146 self._host_http_port = ports[0] |
147 self._host_https_port = ports[1] | 147 self._host_https_port = ports[1] |
148 | 148 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 print 'Pulling cyglog data...' | 349 print 'Pulling cyglog data...' |
350 self._SetUpHostFolders() | 350 self._SetUpHostFolders() |
351 self._device.old_interface.Adb().Pull( | 351 self._device.old_interface.Adb().Pull( |
352 self._DEVICE_CYGLOG_DIR, self._host_cyglog_dir) | 352 self._DEVICE_CYGLOG_DIR, self._host_cyglog_dir) |
353 files = os.listdir(self._host_cyglog_dir) | 353 files = os.listdir(self._host_cyglog_dir) |
354 | 354 |
355 if len(files) == 0: | 355 if len(files) == 0: |
356 raise NoCyglogDataError('No cyglog data was collected') | 356 raise NoCyglogDataError('No cyglog data was collected') |
357 | 357 |
358 return [os.path.join(self._host_cyglog_dir, x) for x in files] | 358 return [os.path.join(self._host_cyglog_dir, x) for x in files] |
OLD | NEW |