| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 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 import collections | 5 import collections |
| 6 import copy | 6 import copy |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import pickle | 9 import pickle |
| 10 import re | 10 import re |
| 11 | 11 |
| 12 from devil.android import apk_helper | 12 from devil.android import apk_helper |
| 13 from devil.android import md5sum | 13 from devil.android import md5sum |
| 14 from pylib import constants | 14 from pylib import constants |
| 15 from pylib.base import base_test_result | 15 from pylib.base import base_test_result |
| 16 from pylib.base import test_instance | 16 from pylib.base import test_instance |
| 17 from pylib.constants import host_paths | 17 from pylib.constants import host_paths |
| 18 from pylib.instrumentation import test_result | 18 from pylib.instrumentation import test_result |
| 19 from pylib.instrumentation import instrumentation_parser | 19 from pylib.instrumentation import instrumentation_parser |
| 20 from pylib.utils import isolator |
| 20 from pylib.utils import proguard | 21 from pylib.utils import proguard |
| 21 | 22 |
| 22 with host_paths.SysPath(host_paths.BUILD_COMMON_PATH): | 23 with host_paths.SysPath(host_paths.BUILD_COMMON_PATH): |
| 23 import unittest_util # pylint: disable=import-error | 24 import unittest_util # pylint: disable=import-error |
| 24 | 25 |
| 25 # Ref: http://developer.android.com/reference/android/app/Activity.html | 26 # Ref: http://developer.android.com/reference/android/app/Activity.html |
| 26 _ACTIVITY_RESULT_CANCELED = 0 | 27 _ACTIVITY_RESULT_CANCELED = 0 |
| 27 _ACTIVITY_RESULT_OK = -1 | 28 _ACTIVITY_RESULT_OK = -1 |
| 28 | 29 |
| 29 _COMMAND_LINE_PARAMETER = 'cmdlinearg-parameter' | 30 _COMMAND_LINE_PARAMETER = 'cmdlinearg-parameter' |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 logging.warning('Unable to find package info for %s', self._test_package) | 286 logging.warning('Unable to find package info for %s', self._test_package) |
| 286 | 287 |
| 287 for apk in args.additional_apks: | 288 for apk in args.additional_apks: |
| 288 if not os.path.exists(apk): | 289 if not os.path.exists(apk): |
| 289 error_func('Unable to find additional APK: %s' % apk) | 290 error_func('Unable to find additional APK: %s' % apk) |
| 290 self._additional_apks = ( | 291 self._additional_apks = ( |
| 291 [apk_helper.ToHelper(x) for x in args.additional_apks]) | 292 [apk_helper.ToHelper(x) for x in args.additional_apks]) |
| 292 | 293 |
| 293 def _initializeDataDependencyAttributes(self, args, isolate_delegate): | 294 def _initializeDataDependencyAttributes(self, args, isolate_delegate): |
| 294 self._data_deps = [] | 295 self._data_deps = [] |
| 295 if args.isolate_file_path: | 296 if (args.isolate_file_path and |
| 297 not isolator.IsIsolateEmpty(args.isolate_file_path)): |
| 296 if os.path.isabs(args.isolate_file_path): | 298 if os.path.isabs(args.isolate_file_path): |
| 297 self._isolate_abs_path = args.isolate_file_path | 299 self._isolate_abs_path = args.isolate_file_path |
| 298 else: | 300 else: |
| 299 self._isolate_abs_path = os.path.join( | 301 self._isolate_abs_path = os.path.join( |
| 300 constants.DIR_SOURCE_ROOT, args.isolate_file_path) | 302 constants.DIR_SOURCE_ROOT, args.isolate_file_path) |
| 301 self._isolate_delegate = isolate_delegate | 303 self._isolate_delegate = isolate_delegate |
| 302 self._isolated_abs_path = os.path.join( | 304 self._isolated_abs_path = os.path.join( |
| 303 constants.GetOutDirectory(), '%s.isolated' % self._test_package) | 305 constants.GetOutDirectory(), '%s.isolated' % self._test_package) |
| 304 else: | 306 else: |
| 305 self._isolate_delegate = None | 307 self._isolate_delegate = None |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 def GenerateTestResults( | 639 def GenerateTestResults( |
| 638 result_code, result_bundle, statuses, start_ms, duration_ms): | 640 result_code, result_bundle, statuses, start_ms, duration_ms): |
| 639 return GenerateTestResults(result_code, result_bundle, statuses, | 641 return GenerateTestResults(result_code, result_bundle, statuses, |
| 640 start_ms, duration_ms) | 642 start_ms, duration_ms) |
| 641 | 643 |
| 642 #override | 644 #override |
| 643 def TearDown(self): | 645 def TearDown(self): |
| 644 if self._isolate_delegate: | 646 if self._isolate_delegate: |
| 645 self._isolate_delegate.Clear() | 647 self._isolate_delegate.Clear() |
| 646 | 648 |
| OLD | NEW |