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

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

Issue 2854823007: Move screenshot capture to Java-side. (Closed)
Patch Set: Move screenshot capture to Java-side. Created 3 years, 7 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 _EXTRA_TIMEOUT_SCALE = ( 47 _EXTRA_TIMEOUT_SCALE = (
48 'org.chromium.test.driver.OnDeviceInstrumentationDriver.TimeoutScale') 48 'org.chromium.test.driver.OnDeviceInstrumentationDriver.TimeoutScale')
49 49
50 _PARAMETERIZED_TEST_ANNOTATION = 'ParameterizedTest' 50 _PARAMETERIZED_TEST_ANNOTATION = 'ParameterizedTest'
51 _PARAMETERIZED_TEST_SET_ANNOTATION = 'ParameterizedTest$Set' 51 _PARAMETERIZED_TEST_SET_ANNOTATION = 'ParameterizedTest$Set'
52 _NATIVE_CRASH_RE = re.compile('(process|native) crash', re.IGNORECASE) 52 _NATIVE_CRASH_RE = re.compile('(process|native) crash', re.IGNORECASE)
53 _CMDLINE_NAME_SEGMENT_RE = re.compile( 53 _CMDLINE_NAME_SEGMENT_RE = re.compile(
54 r' with(?:out)? \{[^\}]*\}') 54 r' with(?:out)? \{[^\}]*\}')
55 _PICKLE_FORMAT_VERSION = 11 55 _PICKLE_FORMAT_VERSION = 11
56 56
57 FAILURE_SCREENSHOT_FILE = 'screenshots/test_failure.png'
57 58
58 class MissingSizeAnnotationError(test_exception.TestException): 59 class MissingSizeAnnotationError(test_exception.TestException):
59 def __init__(self, class_name): 60 def __init__(self, class_name):
60 super(MissingSizeAnnotationError, self).__init__(class_name + 61 super(MissingSizeAnnotationError, self).__init__(class_name +
61 ': Test method is missing required size annotation. Add one of: ' + 62 ': Test method is missing required size annotation. Add one of: ' +
62 ', '.join('@' + a for a in _VALID_ANNOTATIONS)) 63 ', '.join('@' + a for a in _VALID_ANNOTATIONS))
63 64
64 65
65 class TestListPickleException(test_exception.TestException): 66 class TestListPickleException(test_exception.TestException):
66 pass 67 pass
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 if args.command_line_flags: 647 if args.command_line_flags:
647 self._flags.extend(args.command_line_flags) 648 self._flags.extend(args.command_line_flags)
648 if args.device_flags_file: 649 if args.device_flags_file:
649 with open(args.device_flags_file) as device_flags_file: 650 with open(args.device_flags_file) as device_flags_file:
650 stripped_lines = (l.strip() for l in device_flags_file) 651 stripped_lines = (l.strip() for l in device_flags_file)
651 self._flags.extend(flag for flag in stripped_lines if flag) 652 self._flags.extend(flag for flag in stripped_lines if flag)
652 if args.strict_mode and args.strict_mode != 'off': 653 if args.strict_mode and args.strict_mode != 'off':
653 self._flags.append('--strict-mode=' + args.strict_mode) 654 self._flags.append('--strict-mode=' + args.strict_mode)
654 if args.regenerate_goldens: 655 if args.regenerate_goldens:
655 self._flags.append('--regenerate-goldens') 656 self._flags.append('--regenerate-goldens')
657 if args.gs_results_bucket:
mikecase (-- gone --) 2017/05/05 18:19:30 I think I actually have to change this to "args.gs
mikecase (-- gone --) 2017/05/05 18:44:16 Fixed! And tested running with --screenshot-dir lo
658 self._flags.append('--screenshot-file=%s' % FAILURE_SCREENSHOT_FILE)
656 659
657 if args.test_arguments: 660 if args.test_arguments:
658 # --test-arguments is deprecated for gtests and is in the process of 661 # --test-arguments is deprecated for gtests and is in the process of
659 # being removed. 662 # being removed.
660 raise Exception( 663 raise Exception(
661 '--test-arguments is not supported for instrumentation ' 664 '--test-arguments is not supported for instrumentation '
662 'tests. Pass command-line flags directly instead.') 665 'tests. Pass command-line flags directly instead.')
663 666
664 def _initializeDriverAttributes(self): 667 def _initializeDriverAttributes(self):
665 self._driver_apk = os.path.join( 668 self._driver_apk = os.path.join(
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 891
889 @staticmethod 892 @staticmethod
890 def GenerateTestResults( 893 def GenerateTestResults(
891 result_code, result_bundle, statuses, start_ms, duration_ms): 894 result_code, result_bundle, statuses, start_ms, duration_ms):
892 return GenerateTestResults(result_code, result_bundle, statuses, 895 return GenerateTestResults(result_code, result_bundle, statuses,
893 start_ms, duration_ms) 896 start_ms, duration_ms)
894 897
895 #override 898 #override
896 def TearDown(self): 899 def TearDown(self):
897 pass 900 pass
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698