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 import sys | |
12 | 11 |
13 from devil.android import apk_helper | 12 from devil.android import apk_helper |
14 from devil.android import md5sum | 13 from devil.android import md5sum |
15 from pylib import constants | 14 from pylib import constants |
16 from pylib.base import base_test_result | 15 from pylib.base import base_test_result |
17 from pylib.base import test_instance | 16 from pylib.base import test_instance |
| 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 proguard | 20 from pylib.utils import proguard |
21 | 21 |
22 sys.path.append( | 22 with host_paths.SysPath(host_paths.BUILD_COMMON_PATH): |
23 os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib', 'common')) | 23 import unittest_util # pylint: disable=import-error |
24 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' |
31 _DEFAULT_ANNOTATIONS = [ | 30 _DEFAULT_ANNOTATIONS = [ |
32 'Smoke', 'SmallTest', 'MediumTest', 'LargeTest', | 31 'Smoke', 'SmallTest', 'MediumTest', 'LargeTest', |
33 'EnormousTest', 'IntegrationTest'] | 32 'EnormousTest', 'IntegrationTest'] |
34 _EXCLUDE_UNLESS_REQUESTED_ANNOTATIONS = [ | 33 _EXCLUDE_UNLESS_REQUESTED_ANNOTATIONS = [ |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 self._isolate_delegate.Remap( | 433 self._isolate_delegate.Remap( |
435 self._isolate_abs_path, self._isolated_abs_path) | 434 self._isolate_abs_path, self._isolated_abs_path) |
436 self._isolate_delegate.MoveOutputDeps() | 435 self._isolate_delegate.MoveOutputDeps() |
437 self._data_deps.extend([(self._isolate_delegate.isolate_deps_dir, None)]) | 436 self._data_deps.extend([(self._isolate_delegate.isolate_deps_dir, None)]) |
438 | 437 |
439 # TODO(jbudorick): Convert existing tests that depend on the --test-data | 438 # TODO(jbudorick): Convert existing tests that depend on the --test-data |
440 # mechanism to isolate, then remove this. | 439 # mechanism to isolate, then remove this. |
441 if self._test_data: | 440 if self._test_data: |
442 for t in self._test_data: | 441 for t in self._test_data: |
443 device_rel_path, host_rel_path = t.split(':') | 442 device_rel_path, host_rel_path = t.split(':') |
444 host_abs_path = os.path.join(constants.DIR_SOURCE_ROOT, host_rel_path) | 443 host_abs_path = os.path.join(host_paths.DIR_SOURCE_ROOT, host_rel_path) |
445 self._data_deps.extend( | 444 self._data_deps.extend( |
446 [(host_abs_path, | 445 [(host_abs_path, |
447 [None, 'chrome', 'test', 'data', device_rel_path])]) | 446 [None, 'chrome', 'test', 'data', device_rel_path])]) |
448 | 447 |
449 def GetDataDependencies(self): | 448 def GetDataDependencies(self): |
450 return self._data_deps | 449 return self._data_deps |
451 | 450 |
452 def GetTests(self): | 451 def GetTests(self): |
453 pickle_path = '%s-proguard.pickle' % self.test_jar | 452 pickle_path = '%s-proguard.pickle' % self.test_jar |
454 try: | 453 try: |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 def GenerateTestResults( | 619 def GenerateTestResults( |
621 result_code, result_bundle, statuses, start_ms, duration_ms): | 620 result_code, result_bundle, statuses, start_ms, duration_ms): |
622 return GenerateTestResults(result_code, result_bundle, statuses, | 621 return GenerateTestResults(result_code, result_bundle, statuses, |
623 start_ms, duration_ms) | 622 start_ms, duration_ms) |
624 | 623 |
625 #override | 624 #override |
626 def TearDown(self): | 625 def TearDown(self): |
627 if self._isolate_delegate: | 626 if self._isolate_delegate: |
628 self._isolate_delegate.Clear() | 627 self._isolate_delegate.Clear() |
629 | 628 |
OLD | NEW |