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 json | 7 import json |
8 import logging | 8 import logging |
9 import os | 9 import os |
10 import pickle | 10 import pickle |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 self._excluded_annotations = [] | 635 self._excluded_annotations = [] |
636 | 636 |
637 requested_annotations = set(a[0] for a in self._annotations) | 637 requested_annotations = set(a[0] for a in self._annotations) |
638 if not args.run_disabled: | 638 if not args.run_disabled: |
639 self._excluded_annotations.extend( | 639 self._excluded_annotations.extend( |
640 annotation_element(a) for a in _EXCLUDE_UNLESS_REQUESTED_ANNOTATIONS | 640 annotation_element(a) for a in _EXCLUDE_UNLESS_REQUESTED_ANNOTATIONS |
641 if a not in requested_annotations) | 641 if a not in requested_annotations) |
642 | 642 |
643 def _initializeFlagAttributes(self, args): | 643 def _initializeFlagAttributes(self, args): |
644 self._flags = ['--enable-test-intents'] | 644 self._flags = ['--enable-test-intents'] |
645 # TODO(jbudorick): Transition "--device-flags" to "--device-flags-file" | 645 if args.command_line_flags: |
646 if hasattr(args, 'device_flags') and args.device_flags: | 646 self._flags.extend(args.command_line_flags) |
647 with open(args.device_flags) as device_flags_file: | 647 if args.device_flags_file: |
648 stripped_lines = (l.strip() for l in device_flags_file) | |
649 self._flags.extend([flag for flag in stripped_lines if flag]) | |
650 if hasattr(args, 'device_flags_file') and args.device_flags_file: | |
651 with open(args.device_flags_file) as device_flags_file: | 648 with open(args.device_flags_file) as device_flags_file: |
652 stripped_lines = (l.strip() for l in device_flags_file) | 649 stripped_lines = (l.strip() for l in device_flags_file) |
653 self._flags.extend([flag for flag in stripped_lines if flag]) | 650 self._flags.extend(flag for flag in stripped_lines if flag) |
654 if (hasattr(args, 'strict_mode') and | 651 if args.strict_mode and args.strict_mode != 'off': |
655 args.strict_mode and | |
656 args.strict_mode != 'off'): | |
657 self._flags.append('--strict-mode=' + args.strict_mode) | 652 self._flags.append('--strict-mode=' + args.strict_mode) |
658 if hasattr(args, 'regenerate_goldens') and args.regenerate_goldens: | 653 if args.regenerate_goldens: |
659 self._flags.append('--regenerate-goldens') | 654 self._flags.append('--regenerate-goldens') |
660 | 655 |
| 656 if args.test_arguments: |
| 657 # --test-arguments is deprecated for gtests and is in the process of |
| 658 # being removed. |
| 659 raise Exception( |
| 660 '--test-arguments is not supported for instrumentation ' |
| 661 'tests. Pass command-line flags directly instead.') |
| 662 |
661 def _initializeDriverAttributes(self): | 663 def _initializeDriverAttributes(self): |
662 self._driver_apk = os.path.join( | 664 self._driver_apk = os.path.join( |
663 constants.GetOutDirectory(), constants.SDK_BUILD_APKS_DIR, | 665 constants.GetOutDirectory(), constants.SDK_BUILD_APKS_DIR, |
664 'OnDeviceInstrumentationDriver.apk') | 666 'OnDeviceInstrumentationDriver.apk') |
665 if os.path.exists(self._driver_apk): | 667 if os.path.exists(self._driver_apk): |
666 driver_apk = apk_helper.ApkHelper(self._driver_apk) | 668 driver_apk = apk_helper.ApkHelper(self._driver_apk) |
667 self._driver_package = driver_apk.GetPackageName() | 669 self._driver_package = driver_apk.GetPackageName() |
668 self._driver_name = driver_apk.GetInstrumentationName() | 670 self._driver_name = driver_apk.GetInstrumentationName() |
669 else: | 671 else: |
670 self._driver_apk = None | 672 self._driver_apk = None |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 | 882 |
881 @staticmethod | 883 @staticmethod |
882 def GenerateTestResults( | 884 def GenerateTestResults( |
883 result_code, result_bundle, statuses, start_ms, duration_ms): | 885 result_code, result_bundle, statuses, start_ms, duration_ms): |
884 return GenerateTestResults(result_code, result_bundle, statuses, | 886 return GenerateTestResults(result_code, result_bundle, statuses, |
885 start_ms, duration_ms) | 887 start_ms, duration_ms) |
886 | 888 |
887 #override | 889 #override |
888 def TearDown(self): | 890 def TearDown(self): |
889 pass | 891 pass |
OLD | NEW |