| 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. | |
| 73 def GetOutDir(self): | 71 def GetOutDir(self): |
| 74 return constants.GetOutDirectory() | 72 return os.path.join(os.environ['CHROME_SRC'], 'out', |
| 73 constants.GetBuildType()) |
| 75 | 74 |
| 76 def Run(self): | 75 def Run(self): |
| 77 logging.info('Running host-driven test: %s', self.tagged_name) | 76 logging.info('Running host-driven test: %s', self.tagged_name) |
| 78 # Get the test method on the derived class and execute it | 77 # Get the test method on the derived class and execute it |
| 79 return getattr(self, self.test_name)() | 78 return getattr(self, self.test_name)() |
| 80 | 79 |
| 81 def __RunJavaTest(self, test, test_pkg, additional_flags=None): | 80 def __RunJavaTest(self, test, test_pkg, additional_flags=None): |
| 82 """Runs a single Java test in a Java TestRunner. | 81 """Runs a single Java test in a Java TestRunner. |
| 83 | 82 |
| 84 Args: | 83 Args: |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 overall_result.AddResult( | 151 overall_result.AddResult( |
| 153 test_result.InstrumentationTestResult( | 152 test_result.InstrumentationTestResult( |
| 154 self.tagged_name, test_type, start_ms, duration_ms, log=log)) | 153 self.tagged_name, test_type, start_ms, duration_ms, log=log)) |
| 155 return overall_result | 154 return overall_result |
| 156 | 155 |
| 157 def __str__(self): | 156 def __str__(self): |
| 158 return self.tagged_name | 157 return self.tagged_name |
| 159 | 158 |
| 160 def __repr__(self): | 159 def __repr__(self): |
| 161 return self.tagged_name | 160 return self.tagged_name |
| OLD | NEW |