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

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

Issue 2743033002: [android] Add support for providing flags to instrumentation tests 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"
643 if hasattr(args, 'device_flags') and args.device_flags: 642 if hasattr(args, 'device_flags') and args.device_flags:
644 with open(args.device_flags) as device_flags_file: 643 self._flags.extend(args.device_flags.split())
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: 644 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 (hasattr(args, 'strict_mode') and
652 args.strict_mode and 649 args.strict_mode and
653 args.strict_mode != 'off'): 650 args.strict_mode != 'off'):
654 self._flags.append('--strict-mode=' + args.strict_mode) 651 self._flags.append('--strict-mode=' + args.strict_mode)
655 if hasattr(args, 'regenerate_goldens') and args.regenerate_goldens: 652 if hasattr(args, 'regenerate_goldens') and args.regenerate_goldens:
656 self._flags.append('--regenerate-goldens') 653 self._flags.append('--regenerate-goldens')
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 866
870 @staticmethod 867 @staticmethod
871 def GenerateTestResults( 868 def GenerateTestResults(
872 result_code, result_bundle, statuses, start_ms, duration_ms): 869 result_code, result_bundle, statuses, start_ms, duration_ms):
873 return GenerateTestResults(result_code, result_bundle, statuses, 870 return GenerateTestResults(result_code, result_bundle, statuses,
874 start_ms, duration_ms) 871 start_ms, duration_ms)
875 872
876 #override 873 #override
877 def TearDown(self): 874 def TearDown(self):
878 pass 875 pass
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/instrumentation/instrumentation_test_instance_test.py » ('j') | build/android/test_runner.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698