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