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

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

Issue 1059443005: Revert of [Android] Reland cleanup of old_interface in build/android/pylib. (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
53 self.device = None 55 self.device = None
54 self.device_id = '' 56 self.device_id = ''
55 self.has_forwarded_ports = False 57 self.has_forwarded_ports = False
56 self.instrumentation_options = instrumentation_options 58 self.instrumentation_options = instrumentation_options
57 self.ports_to_forward = [] 59 self.ports_to_forward = []
58 self.shard_index = 0 60 self.shard_index = 0
59 61
60 # Use tagged_name when creating results, so that we can identify host-driven 62 # Use tagged_name when creating results, so that we can identify host-driven
61 # tests in the overall results. 63 # tests in the overall results.
62 self.test_name = test_name 64 self.test_name = test_name
63 self.qualified_name = '%s.%s' % (class_name, self.test_name) 65 self.qualified_name = '%s.%s' % (class_name, self.test_name)
64 self.tagged_name = '%s_%s' % (self._HOST_DRIVEN_TAG, self.qualified_name) 66 self.tagged_name = '%s_%s' % (self._HOST_DRIVEN_TAG, self.qualified_name)
65 67
66 # TODO(bulach): make ports_to_forward not optional and move the Forwarder 68 # TODO(bulach): make ports_to_forward not optional and move the Forwarder
67 # mapping here. 69 # mapping here.
68 def SetUp(self, device, shard_index, ports_to_forward=None): 70 def SetUp(self, device, shard_index,
71 cleanup_test_files, ports_to_forward=None):
69 if not ports_to_forward: 72 if not ports_to_forward:
70 ports_to_forward = [] 73 ports_to_forward = []
71 self.device_id = device 74 self.device_id = device
72 self.shard_index = shard_index 75 self.shard_index = shard_index
73 self.device = device_utils.DeviceUtils(self.device_id) 76 self.device = device_utils.DeviceUtils(self.device_id)
77 self.adb = self.device.old_interface
78 self.cleanup_test_files = cleanup_test_files
74 if ports_to_forward: 79 if ports_to_forward:
75 self.ports_to_forward = ports_to_forward 80 self.ports_to_forward = ports_to_forward
76 81
77 def TearDown(self): 82 def TearDown(self):
78 pass 83 pass
79 84
80 # TODO(craigdh): Remove GetOutDir once references have been removed 85 # TODO(craigdh): Remove GetOutDir once references have been removed
81 # downstream. 86 # downstream.
82 @staticmethod 87 @staticmethod
83 def GetOutDir(): 88 def GetOutDir():
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 overall_result.AddResult( 186 overall_result.AddResult(
182 test_result.InstrumentationTestResult( 187 test_result.InstrumentationTestResult(
183 self.tagged_name, test_type, start_ms, duration_ms, log=log)) 188 self.tagged_name, test_type, start_ms, duration_ms, log=log))
184 return overall_result 189 return overall_result
185 190
186 def __str__(self): 191 def __str__(self):
187 return self.tagged_name 192 return self.tagged_name
188 193
189 def __repr__(self): 194 def __repr__(self):
190 return self.tagged_name 195 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