| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 cleanup_test_files): | 61 cleanup_test_files): |
| 62 self.device_id = device | 62 self.device_id = device |
| 63 self.shard_index = shard_index | 63 self.shard_index = shard_index |
| 64 self.adb = android_commands.AndroidCommands(self.device_id) | 64 self.adb = android_commands.AndroidCommands(self.device_id) |
| 65 self.push_deps = push_deps | 65 self.push_deps = push_deps |
| 66 self.cleanup_test_files = cleanup_test_files | 66 self.cleanup_test_files = cleanup_test_files |
| 67 | 67 |
| 68 def TearDown(self): | 68 def TearDown(self): |
| 69 pass | 69 pass |
| 70 | 70 |
| 71 # TODO(craigdh): Remove GetOutDir once references have been removed |
| 72 # downstream. |
| 71 def GetOutDir(self): | 73 def GetOutDir(self): |
| 72 return os.path.join(os.environ['CHROME_SRC'], 'out', | 74 return constants.GetOutDirectory() |
| 73 constants.GetBuildType()) | |
| 74 | 75 |
| 75 def Run(self): | 76 def Run(self): |
| 76 logging.info('Running host-driven test: %s', self.tagged_name) | 77 logging.info('Running host-driven test: %s', self.tagged_name) |
| 77 # Get the test method on the derived class and execute it | 78 # Get the test method on the derived class and execute it |
| 78 return getattr(self, self.test_name)() | 79 return getattr(self, self.test_name)() |
| 79 | 80 |
| 80 def __RunJavaTest(self, test, test_pkg, additional_flags=None): | 81 def __RunJavaTest(self, test, test_pkg, additional_flags=None): |
| 81 """Runs a single Java test in a Java TestRunner. | 82 """Runs a single Java test in a Java TestRunner. |
| 82 | 83 |
| 83 Args: | 84 Args: |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 overall_result.AddResult( | 152 overall_result.AddResult( |
| 152 test_result.InstrumentationTestResult( | 153 test_result.InstrumentationTestResult( |
| 153 self.tagged_name, test_type, start_ms, duration_ms, log=log)) | 154 self.tagged_name, test_type, start_ms, duration_ms, log=log)) |
| 154 return overall_result | 155 return overall_result |
| 155 | 156 |
| 156 def __str__(self): | 157 def __str__(self): |
| 157 return self.tagged_name | 158 return self.tagged_name |
| 158 | 159 |
| 159 def __repr__(self): | 160 def __repr__(self): |
| 160 return self.tagged_name | 161 return self.tagged_name |
| OLD | NEW |