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

Side by Side Diff: build/android/pylib/host_driven/test_case.py

Issue 1047703002: [Android] Clean up old_interface in build/android/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 """Base class for host-driven test cases. 5 """Base class for host-driven test cases.
6 6
7 This test case is intended to serve as the base class for any host-driven 7 This test case is intended to serve as the base class for any host-driven
8 test cases. It is similar to the Python unitttest module in that test cases 8 test cases. It is similar to the Python unitttest module in that test cases
9 inherit from this class and add methods which will be run as tests. 9 inherit from this class and add methods which will be run as tests.
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 _HOST_DRIVEN_TAG = 'HostDriven' 43 _HOST_DRIVEN_TAG = 'HostDriven'
44 44
45 def __init__(self, test_name, instrumentation_options=None): 45 def __init__(self, test_name, instrumentation_options=None):
46 """Create a test case initialized to run |test_name|. 46 """Create a test case initialized to run |test_name|.
47 47
48 Args: 48 Args:
49 test_name: The name of the method to run as the test. 49 test_name: The name of the method to run as the test.
50 instrumentation_options: An InstrumentationOptions object. 50 instrumentation_options: An InstrumentationOptions object.
51 """ 51 """
52 class_name = self.__class__.__name__ 52 class_name = self.__class__.__name__
53 self.adb = None
54 self.cleanup_test_files = False
55 self.device = None 53 self.device = None
56 self.device_id = '' 54 self.device_id = ''
57 self.has_forwarded_ports = False 55 self.has_forwarded_ports = False
58 self.instrumentation_options = instrumentation_options 56 self.instrumentation_options = instrumentation_options
59 self.ports_to_forward = [] 57 self.ports_to_forward = []
60 self.shard_index = 0 58 self.shard_index = 0
61 59
62 # Use tagged_name when creating results, so that we can identify host-driven 60 # Use tagged_name when creating results, so that we can identify host-driven
63 # tests in the overall results. 61 # tests in the overall results.
64 self.test_name = test_name 62 self.test_name = test_name
65 self.qualified_name = '%s.%s' % (class_name, self.test_name) 63 self.qualified_name = '%s.%s' % (class_name, self.test_name)
66 self.tagged_name = '%s_%s' % (self._HOST_DRIVEN_TAG, self.qualified_name) 64 self.tagged_name = '%s_%s' % (self._HOST_DRIVEN_TAG, self.qualified_name)
67 65
68 # TODO(bulach): make ports_to_forward not optional and move the Forwarder 66 # TODO(bulach): make ports_to_forward not optional and move the Forwarder
69 # mapping here. 67 # mapping here.
70 def SetUp(self, device, shard_index, 68 def SetUp(self, device, shard_index, ports_to_forward=None):
71 cleanup_test_files, ports_to_forward=None):
72 if not ports_to_forward: 69 if not ports_to_forward:
73 ports_to_forward = [] 70 ports_to_forward = []
74 self.device_id = device 71 self.device_id = device
75 self.shard_index = shard_index 72 self.shard_index = shard_index
76 self.device = device_utils.DeviceUtils(self.device_id) 73 self.device = device_utils.DeviceUtils(self.device_id)
77 self.adb = self.device.old_interface
78 self.cleanup_test_files = cleanup_test_files
79 if ports_to_forward: 74 if ports_to_forward:
80 self.ports_to_forward = ports_to_forward 75 self.ports_to_forward = ports_to_forward
81 76
82 def TearDown(self): 77 def TearDown(self):
83 pass 78 pass
84 79
85 # TODO(craigdh): Remove GetOutDir once references have been removed 80 # TODO(craigdh): Remove GetOutDir once references have been removed
86 # downstream. 81 # downstream.
87 @staticmethod 82 @staticmethod
88 def GetOutDir(): 83 def GetOutDir():
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 overall_result.AddResult( 181 overall_result.AddResult(
187 test_result.InstrumentationTestResult( 182 test_result.InstrumentationTestResult(
188 self.tagged_name, test_type, start_ms, duration_ms, log=log)) 183 self.tagged_name, test_type, start_ms, duration_ms, log=log))
189 return overall_result 184 return overall_result
190 185
191 def __str__(self): 186 def __str__(self):
192 return self.tagged_name 187 return self.tagged_name
193 188
194 def __repr__(self): 189 def __repr__(self):
195 return self.tagged_name 190 return self.tagged_name
OLDNEW
« no previous file with comments | « build/android/pylib/host_driven/setup.py ('k') | build/android/pylib/host_driven/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698