OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 running tests on a single device.""" | 5 """Base class for running tests on a single device.""" |
6 | 6 |
7 # TODO(jbudorick) Deprecate and remove this class and all subclasses after | 7 # TODO(jbudorick) Deprecate and remove this class and all subclasses after |
8 # any relevant parts have been ported to the new environment + test instance | 8 # any relevant parts have been ported to the new environment + test instance |
9 # model. | 9 # model. |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 Returns: | 66 Returns: |
67 Tuple containing: | 67 Tuple containing: |
68 (base_test_result.TestRunResults, tests to rerun or None) | 68 (base_test_result.TestRunResults, tests to rerun or None) |
69 """ | 69 """ |
70 raise NotImplementedError | 70 raise NotImplementedError |
71 | 71 |
72 def InstallTestPackage(self): | 72 def InstallTestPackage(self): |
73 """Installs the test package once before all tests are run.""" | 73 """Installs the test package once before all tests are run.""" |
74 pass | 74 pass |
75 | 75 |
76 def PushDataDeps(self): | |
77 """Push all data deps to device once before all tests are run.""" | |
78 pass | |
79 | |
80 def SetUp(self): | 76 def SetUp(self): |
81 """Run once before all tests are run.""" | 77 """Run once before all tests are run.""" |
82 self.InstallTestPackage() | 78 self.InstallTestPackage() |
83 self.PushDataDeps() | |
84 | 79 |
85 def TearDown(self): | 80 def TearDown(self): |
86 """Run once after all tests are run.""" | 81 """Run once after all tests are run.""" |
87 self.ShutdownHelperToolsForTestSuite() | 82 self.ShutdownHelperToolsForTestSuite() |
88 if self._cleanup_test_files: | 83 if self._cleanup_test_files: |
89 self.device.old_interface.RemovePushedFiles() | 84 self.device.old_interface.RemovePushedFiles() |
90 | 85 |
91 def LaunchTestHttpServer(self, document_root, port=None, | 86 def LaunchTestHttpServer(self, document_root, port=None, |
92 extra_config_contents=None): | 87 extra_config_contents=None): |
93 """Launches an HTTP server to serve HTTP tests. | 88 """Launches an HTTP server to serve HTTP tests. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 break | 176 break |
182 else: | 177 else: |
183 error_msgs.append(error_msg) | 178 error_msgs.append(error_msg) |
184 self._spawning_server.Stop() | 179 self._spawning_server.Stop() |
185 # Wait for 2 seconds then restart. | 180 # Wait for 2 seconds then restart. |
186 time.sleep(2) | 181 time.sleep(2) |
187 if not server_ready: | 182 if not server_ready: |
188 logging.error(';'.join(error_msgs)) | 183 logging.error(';'.join(error_msgs)) |
189 raise Exception('Can not start the test spawner server.') | 184 raise Exception('Can not start the test spawner server.') |
190 self._PushTestServerPortInfoToDevice() | 185 self._PushTestServerPortInfoToDevice() |
OLD | NEW |