Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: build/android/pylib/instrumentation/instrumentation_test_instance.py

Issue 2752493002: [android] Add support for passing command-line flags directly. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 self._excluded_annotations = [] 632 self._excluded_annotations = []
633 633
634 requested_annotations = set(a[0] for a in self._annotations) 634 requested_annotations = set(a[0] for a in self._annotations)
635 if not args.run_disabled: 635 if not args.run_disabled:
636 self._excluded_annotations.extend( 636 self._excluded_annotations.extend(
637 annotation_element(a) for a in _EXCLUDE_UNLESS_REQUESTED_ANNOTATIONS 637 annotation_element(a) for a in _EXCLUDE_UNLESS_REQUESTED_ANNOTATIONS
638 if a not in requested_annotations) 638 if a not in requested_annotations)
639 639
640 def _initializeFlagAttributes(self, args): 640 def _initializeFlagAttributes(self, args):
641 self._flags = ['--enable-test-intents'] 641 self._flags = ['--enable-test-intents']
642 # TODO(jbudorick): Transition "--device-flags" to "--device-flags-file" 642 if args.command_line_flags:
643 if hasattr(args, 'device_flags') and args.device_flags: 643 self._flags.extend(args.command_line_flags)
644 with open(args.device_flags) as device_flags_file: 644 if args.device_flags_file:
645 stripped_lines = (l.strip() for l in device_flags_file)
646 self._flags.extend([flag for flag in stripped_lines if flag])
647 if hasattr(args, 'device_flags_file') and args.device_flags_file:
648 with open(args.device_flags_file) as device_flags_file: 645 with open(args.device_flags_file) as device_flags_file:
649 stripped_lines = (l.strip() for l in device_flags_file) 646 stripped_lines = (l.strip() for l in device_flags_file)
650 self._flags.extend([flag for flag in stripped_lines if flag]) 647 self._flags.extend(flag for flag in stripped_lines if flag)
651 if (hasattr(args, 'strict_mode') and 648 if args.strict_mode and args.strict_mode != 'off':
652 args.strict_mode and
653 args.strict_mode != 'off'):
654 self._flags.append('--strict-mode=' + args.strict_mode) 649 self._flags.append('--strict-mode=' + args.strict_mode)
655 if hasattr(args, 'regenerate_goldens') and args.regenerate_goldens: 650 if args.regenerate_goldens:
656 self._flags.append('--regenerate-goldens') 651 self._flags.append('--regenerate-goldens')
657 652
658 def _initializeDriverAttributes(self): 653 def _initializeDriverAttributes(self):
659 self._driver_apk = os.path.join( 654 self._driver_apk = os.path.join(
660 constants.GetOutDirectory(), constants.SDK_BUILD_APKS_DIR, 655 constants.GetOutDirectory(), constants.SDK_BUILD_APKS_DIR,
661 'OnDeviceInstrumentationDriver.apk') 656 'OnDeviceInstrumentationDriver.apk')
662 if os.path.exists(self._driver_apk): 657 if os.path.exists(self._driver_apk):
663 driver_apk = apk_helper.ApkHelper(self._driver_apk) 658 driver_apk = apk_helper.ApkHelper(self._driver_apk)
664 self._driver_package = driver_apk.GetPackageName() 659 self._driver_package = driver_apk.GetPackageName()
665 self._driver_name = driver_apk.GetInstrumentationName() 660 self._driver_name = driver_apk.GetInstrumentationName()
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 864
870 @staticmethod 865 @staticmethod
871 def GenerateTestResults( 866 def GenerateTestResults(
872 result_code, result_bundle, statuses, start_ms, duration_ms): 867 result_code, result_bundle, statuses, start_ms, duration_ms):
873 return GenerateTestResults(result_code, result_bundle, statuses, 868 return GenerateTestResults(result_code, result_bundle, statuses,
874 start_ms, duration_ms) 869 start_ms, duration_ms)
875 870
876 #override 871 #override
877 def TearDown(self): 872 def TearDown(self):
878 pass 873 pass
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698