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 import contextlib | 7 import contextlib |
8 import httplib | 8 import httplib |
9 import logging | 9 import logging |
10 import os | 10 import os |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 Args: | 75 Args: |
76 test: A test to run. | 76 test: A test to run. |
77 | 77 |
78 Returns: | 78 Returns: |
79 Tuple containing: | 79 Tuple containing: |
80 (base_test_result.TestRunResults, tests to rerun or None) | 80 (base_test_result.TestRunResults, tests to rerun or None) |
81 """ | 81 """ |
82 raise NotImplementedError | 82 raise NotImplementedError |
83 | 83 |
84 def PushDependencies(self): | 84 def InstallTestPackage(self): |
85 """Push all dependencies to device once before all tests are run.""" | 85 """Installs the test package once before all tests are run.""" |
| 86 pass |
| 87 |
| 88 def PushDataDeps(self): |
| 89 """Push all data deps to device once before all tests are run.""" |
86 pass | 90 pass |
87 | 91 |
88 def SetUp(self): | 92 def SetUp(self): |
89 """Run once before all tests are run.""" | 93 """Run once before all tests are run.""" |
90 Forwarder.KillDevice(self.adb, self.tool) | 94 Forwarder.KillDevice(self.adb, self.tool) |
| 95 self.InstallTestPackage() |
91 if self._push_deps: | 96 if self._push_deps: |
92 logging.info('Pushing deps to device.') | 97 logging.info('Pushing data deps to device.') |
93 self.PushDependencies() | 98 self.PushDataDeps() |
94 else: | 99 else: |
95 logging.warning('Skipping pushing deps to device.') | 100 logging.warning('Skipping pushing data deps to device.') |
96 | 101 |
97 def TearDown(self): | 102 def TearDown(self): |
98 """Run once after all tests are run.""" | 103 """Run once after all tests are run.""" |
99 self.ShutdownHelperToolsForTestSuite() | 104 self.ShutdownHelperToolsForTestSuite() |
100 | 105 |
101 def CopyTestData(self, test_data_paths, dest_dir): | 106 def CopyTestData(self, test_data_paths, dest_dir): |
102 """Copies |test_data_paths| list of files/directories to |dest_dir|. | 107 """Copies |test_data_paths| list of files/directories to |dest_dir|. |
103 | 108 |
104 Args: | 109 Args: |
105 test_data_paths: A list of files or directories relative to |dest_dir| | 110 test_data_paths: A list of files or directories relative to |dest_dir| |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 break | 215 break |
211 else: | 216 else: |
212 error_msgs.append(error_msg) | 217 error_msgs.append(error_msg) |
213 self._spawning_server.Stop() | 218 self._spawning_server.Stop() |
214 # Wait for 2 seconds then restart. | 219 # Wait for 2 seconds then restart. |
215 time.sleep(2) | 220 time.sleep(2) |
216 if not server_ready: | 221 if not server_ready: |
217 logging.error(';'.join(error_msgs)) | 222 logging.error(';'.join(error_msgs)) |
218 raise Exception('Can not start the test spawner server.') | 223 raise Exception('Can not start the test spawner server.') |
219 self._PushTestServerPortInfoToDevice() | 224 self._PushTestServerPortInfoToDevice() |
OLD | NEW |