Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 | 53 self.adb = None |
| 54 self.cleanup_test_files = False | 54 self.cleanup_test_files = False |
| 55 self.device = None | 55 self.device = None |
| 56 self.device_id = '' | 56 self.device_id = '' |
| 57 self.has_forwarded_ports = False | 57 self.has_forwarded_ports = False |
| 58 self.instrumentation_options = instrumentation_options | 58 self.instrumentation_options = instrumentation_options |
| 59 self.ports_to_forward = [] | 59 self.ports_to_forward = [] |
| 60 self.push_deps = False | |
|
mikecase (-- gone --)
2014/11/01 00:53:54
This line created my only hesitation to remove thi
| |
| 61 self.shard_index = 0 | 60 self.shard_index = 0 |
| 62 | 61 |
| 63 # 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 |
| 64 # tests in the overall results. | 63 # tests in the overall results. |
| 65 self.test_name = test_name | 64 self.test_name = test_name |
| 66 self.qualified_name = '%s.%s' % (class_name, self.test_name) | 65 self.qualified_name = '%s.%s' % (class_name, self.test_name) |
| 67 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) |
| 68 | 67 |
| 69 # 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 |
| 70 # mapping here. | 69 # mapping here. |
| 71 def SetUp(self, device, shard_index, push_deps, | 70 def SetUp(self, device, shard_index, |
| 72 cleanup_test_files, ports_to_forward=None): | 71 cleanup_test_files, ports_to_forward=None): |
| 73 if not ports_to_forward: | 72 if not ports_to_forward: |
| 74 ports_to_forward = [] | 73 ports_to_forward = [] |
| 75 self.device_id = device | 74 self.device_id = device |
| 76 self.shard_index = shard_index | 75 self.shard_index = shard_index |
| 77 self.device = device_utils.DeviceUtils(self.device_id) | 76 self.device = device_utils.DeviceUtils(self.device_id) |
| 78 self.adb = self.device.old_interface | 77 self.adb = self.device.old_interface |
| 79 self.push_deps = push_deps | |
| 80 self.cleanup_test_files = cleanup_test_files | 78 self.cleanup_test_files = cleanup_test_files |
| 81 if ports_to_forward: | 79 if ports_to_forward: |
| 82 self.ports_to_forward = ports_to_forward | 80 self.ports_to_forward = ports_to_forward |
| 83 | 81 |
| 84 def TearDown(self): | 82 def TearDown(self): |
| 85 pass | 83 pass |
| 86 | 84 |
| 87 # TODO(craigdh): Remove GetOutDir once references have been removed | 85 # TODO(craigdh): Remove GetOutDir once references have been removed |
| 88 # downstream. | 86 # downstream. |
| 89 @staticmethod | 87 @staticmethod |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 overall_result.AddResult( | 186 overall_result.AddResult( |
| 189 test_result.InstrumentationTestResult( | 187 test_result.InstrumentationTestResult( |
| 190 self.tagged_name, test_type, start_ms, duration_ms, log=log)) | 188 self.tagged_name, test_type, start_ms, duration_ms, log=log)) |
| 191 return overall_result | 189 return overall_result |
| 192 | 190 |
| 193 def __str__(self): | 191 def __str__(self): |
| 194 return self.tagged_name | 192 return self.tagged_name |
| 195 | 193 |
| 196 def __repr__(self): | 194 def __repr__(self): |
| 197 return self.tagged_name | 195 return self.tagged_name |
| OLD | NEW |