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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 pass | 86 pass |
87 | 87 |
88 def PushDataDeps(self): | 88 def PushDataDeps(self): |
89 """Push all data deps to device once before all tests are run.""" | 89 """Push all data deps to device once before all tests are run.""" |
90 pass | 90 pass |
91 | 91 |
92 def SetUp(self): | 92 def SetUp(self): |
93 """Run once before all tests are run.""" | 93 """Run once before all tests are run.""" |
94 Forwarder.KillDevice(self.adb, self.tool) | 94 Forwarder.KillDevice(self.adb, self.tool) |
95 self.InstallTestPackage() | 95 self.InstallTestPackage() |
| 96 push_size_before = self.adb.GetPushSizeInfo() |
96 if self._push_deps: | 97 if self._push_deps: |
97 logging.info('Pushing data deps to device.') | 98 logging.warning('Pushing data files to device.') |
98 self.PushDataDeps() | 99 self.PushDataDeps() |
| 100 push_size_after = self.adb.GetPushSizeInfo() |
| 101 logging.warning('Total data: %dMB' % |
| 102 (push_size_after[0] - push_size_before[0])) |
| 103 logging.warning('Total data transferred: %dMB' % |
| 104 (push_size_after[1] - push_size_before[1])) |
99 else: | 105 else: |
100 logging.warning('Skipping pushing data deps to device.') | 106 logging.warning('Skipping pushing data to device.') |
101 | 107 |
102 def TearDown(self): | 108 def TearDown(self): |
103 """Run once after all tests are run.""" | 109 """Run once after all tests are run.""" |
104 self.ShutdownHelperToolsForTestSuite() | 110 self.ShutdownHelperToolsForTestSuite() |
105 | 111 |
106 def CopyTestData(self, test_data_paths, dest_dir): | 112 def CopyTestData(self, test_data_paths, dest_dir): |
107 """Copies |test_data_paths| list of files/directories to |dest_dir|. | 113 """Copies |test_data_paths| list of files/directories to |dest_dir|. |
108 | 114 |
109 Args: | 115 Args: |
110 test_data_paths: A list of files or directories relative to |dest_dir| | 116 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... |
215 break | 221 break |
216 else: | 222 else: |
217 error_msgs.append(error_msg) | 223 error_msgs.append(error_msg) |
218 self._spawning_server.Stop() | 224 self._spawning_server.Stop() |
219 # Wait for 2 seconds then restart. | 225 # Wait for 2 seconds then restart. |
220 time.sleep(2) | 226 time.sleep(2) |
221 if not server_ready: | 227 if not server_ready: |
222 logging.error(';'.join(error_msgs)) | 228 logging.error(';'.join(error_msgs)) |
223 raise Exception('Can not start the test spawner server.') | 229 raise Exception('Can not start the test spawner server.') |
224 self._PushTestServerPortInfoToDevice() | 230 self._PushTestServerPortInfoToDevice() |
OLD | NEW |