| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 Returns: | 63 Returns: |
| 64 Tuple containing: | 64 Tuple containing: |
| 65 (base_test_result.TestRunResults, tests to rerun or None) | 65 (base_test_result.TestRunResults, tests to rerun or None) |
| 66 """ | 66 """ |
| 67 raise NotImplementedError | 67 raise NotImplementedError |
| 68 | 68 |
| 69 def InstallTestPackage(self): | 69 def InstallTestPackage(self): |
| 70 """Installs the test package once before all tests are run.""" | 70 """Installs the test package once before all tests are run.""" |
| 71 pass | 71 pass |
| 72 | 72 |
| 73 def PushDataDeps(self): | |
| 74 """Push all data deps to device once before all tests are run.""" | |
| 75 pass | |
| 76 | |
| 77 def SetUp(self): | 73 def SetUp(self): |
| 78 """Run once before all tests are run.""" | 74 """Run once before all tests are run.""" |
| 79 self.InstallTestPackage() | 75 self.InstallTestPackage() |
| 80 self.PushDataDeps() | |
| 81 | 76 |
| 82 def TearDown(self): | 77 def TearDown(self): |
| 83 """Run once after all tests are run.""" | 78 """Run once after all tests are run.""" |
| 84 self.ShutdownHelperToolsForTestSuite() | 79 self.ShutdownHelperToolsForTestSuite() |
| 85 if self._cleanup_test_files: | 80 if self._cleanup_test_files: |
| 86 self.device.old_interface.RemovePushedFiles() | 81 self.device.old_interface.RemovePushedFiles() |
| 87 | 82 |
| 88 def LaunchTestHttpServer(self, document_root, port=None, | 83 def LaunchTestHttpServer(self, document_root, port=None, |
| 89 extra_config_contents=None): | 84 extra_config_contents=None): |
| 90 """Launches an HTTP server to serve HTTP tests. | 85 """Launches an HTTP server to serve HTTP tests. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 # will be left open even after the forwarder has been killed. | 132 # will be left open even after the forwarder has been killed. |
| 138 if not ports.IsDevicePortUsed(self.device, self._forwarder_device_port): | 133 if not ports.IsDevicePortUsed(self.device, self._forwarder_device_port): |
| 139 self._ForwardPortsForHttpServer() | 134 self._ForwardPortsForHttpServer() |
| 140 | 135 |
| 141 def ShutdownHelperToolsForTestSuite(self): | 136 def ShutdownHelperToolsForTestSuite(self): |
| 142 """Shuts down the server and the forwarder.""" | 137 """Shuts down the server and the forwarder.""" |
| 143 if self._http_server: | 138 if self._http_server: |
| 144 self._UnmapPorts([(self._forwarder_device_port, self._http_server.port)]) | 139 self._UnmapPorts([(self._forwarder_device_port, self._http_server.port)]) |
| 145 self._http_server.ShutdownHttpServer() | 140 self._http_server.ShutdownHttpServer() |
| 146 | 141 |
| OLD | NEW |