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 """Run specific test on specific environment.""" | 5 """Run specific test on specific environment.""" |
6 | 6 |
7 import json | 7 import json |
8 import logging | 8 import logging |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 223 |
224 def _AmInstrumentTestSetup(self, app_path, test_path, runner_package, | 224 def _AmInstrumentTestSetup(self, app_path, test_path, runner_package, |
225 environment_variables, extra_apks=None): | 225 environment_variables, extra_apks=None): |
226 config = {'runner': runner_package} | 226 config = {'runner': runner_package} |
227 if environment_variables: | 227 if environment_variables: |
228 config['environment_vars'] = ','.join( | 228 config['environment_vars'] = ','.join( |
229 '%s=%s' % (k, v) for k, v in environment_variables.iteritems()) | 229 '%s=%s' % (k, v) for k, v in environment_variables.iteritems()) |
230 | 230 |
231 self._app_id = self._UploadAppToDevice(app_path) | 231 self._app_id = self._UploadAppToDevice(app_path) |
232 | 232 |
| 233 # TODO(agrieve): If AMP is ever ressurected, this needs to be changed to put |
| 234 # test files under /sdcard/gtestdata. http://crbug.com/607169 |
233 data_deps = self._test_instance.GetDataDependencies() | 235 data_deps = self._test_instance.GetDataDependencies() |
234 if data_deps: | 236 if data_deps: |
235 with tempfile.NamedTemporaryFile(suffix='.zip') as test_with_deps: | 237 with tempfile.NamedTemporaryFile(suffix='.zip') as test_with_deps: |
236 sdcard_files = [] | 238 sdcard_files = [] |
237 additional_apks = [] | 239 additional_apks = [] |
238 host_test = os.path.basename(test_path) | 240 host_test = os.path.basename(test_path) |
239 with zipfile.ZipFile(test_with_deps.name, 'w') as zip_file: | 241 with zipfile.ZipFile(test_with_deps.name, 'w') as zip_file: |
240 zip_file.write(test_path, host_test, zipfile.ZIP_DEFLATED) | 242 zip_file.write(test_path, host_test, zipfile.ZIP_DEFLATED) |
241 for h, _ in data_deps: | 243 for h, _ in data_deps: |
242 if os.path.isdir(h): | 244 if os.path.isdir(h): |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 self._LogLogcat() | 383 self._LogLogcat() |
382 self._LogAdbTraceLog() | 384 self._LogAdbTraceLog() |
383 raise remote_device_helper.RemoteDeviceError( | 385 raise remote_device_helper.RemoteDeviceError( |
384 'Remote service unable to reach device.', is_infra_error=True) | 386 'Remote service unable to reach device.', is_infra_error=True) |
385 else: | 387 else: |
386 # Remote service is reporting a failure, but no failure in results obj. | 388 # Remote service is reporting a failure, but no failure in results obj. |
387 if results.DidRunPass(): | 389 if results.DidRunPass(): |
388 results.AddResult(base_test_result.BaseTestResult( | 390 results.AddResult(base_test_result.BaseTestResult( |
389 'Remote service detected error.', | 391 'Remote service detected error.', |
390 base_test_result.ResultType.UNKNOWN)) | 392 base_test_result.ResultType.UNKNOWN)) |
OLD | NEW |