OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """ | 6 """ |
7 Unit tests for the contents of device_utils.py (mostly DeviceUtils). | 7 Unit tests for the contents of device_utils.py (mostly DeviceUtils). |
8 """ | 8 """ |
9 | 9 |
10 # pylint: disable=C0321 | 10 # pylint: disable=C0321 |
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 (mock.call.multiprocessing.Process( | 1038 (mock.call.multiprocessing.Process( |
1039 target=device_utils.DeviceUtils._CreateDeviceZip, | 1039 target=device_utils.DeviceUtils._CreateDeviceZip, |
1040 args=('/test/temp/file/tmp.zip', test_files)), mock.Mock()), | 1040 args=('/test/temp/file/tmp.zip', test_files)), mock.Mock()), |
1041 (self.call.device.GetExternalStoragePath(), | 1041 (self.call.device.GetExternalStoragePath(), |
1042 '/test/device/external_dir'), | 1042 '/test/device/external_dir'), |
1043 self.call.adb.Push( | 1043 self.call.adb.Push( |
1044 '/test/temp/file/tmp.zip', '/test/device/external_dir/tmp.zip'), | 1044 '/test/temp/file/tmp.zip', '/test/device/external_dir/tmp.zip'), |
1045 self.call.device.RunShellCommand( | 1045 self.call.device.RunShellCommand( |
1046 ['unzip', '/test/device/external_dir/tmp.zip'], | 1046 ['unzip', '/test/device/external_dir/tmp.zip'], |
1047 as_root=True, | 1047 as_root=True, |
1048 env={'PATH': '$PATH:/data/local/tmp/bin'}, | 1048 env={'PATH': '/data/local/tmp/bin:$PATH'}, |
1049 check_return=True), | 1049 check_return=True), |
1050 (self.call.device.IsOnline(), True), | 1050 (self.call.device.IsOnline(), True), |
1051 self.call.device.RunShellCommand( | 1051 self.call.device.RunShellCommand( |
1052 ['rm', '/test/device/external_dir/tmp.zip'], check_return=True)): | 1052 ['rm', '/test/device/external_dir/tmp.zip'], check_return=True)): |
1053 self.device._PushChangedFilesZipped(test_files) | 1053 self.device._PushChangedFilesZipped(test_files) |
1054 | 1054 |
1055 def testPushChangedFilesZipped_single(self): | 1055 def testPushChangedFilesZipped_single(self): |
1056 self._testPushChangedFilesZipped_spec( | 1056 self._testPushChangedFilesZipped_spec( |
1057 [('/test/host/path/file1', '/test/device/path/file1')]) | 1057 [('/test/host/path/file1', '/test/device/path/file1')]) |
1058 | 1058 |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1455 self.assertTrue( | 1455 self.assertTrue( |
1456 isinstance(device, device_utils.DeviceUtils) | 1456 isinstance(device, device_utils.DeviceUtils) |
1457 and serial == str(device), | 1457 and serial == str(device), |
1458 'Expected a DeviceUtils object with serial %s' % serial) | 1458 'Expected a DeviceUtils object with serial %s' % serial) |
1459 | 1459 |
1460 | 1460 |
1461 if __name__ == '__main__': | 1461 if __name__ == '__main__': |
1462 logging.getLogger().setLevel(logging.DEBUG) | 1462 logging.getLogger().setLevel(logging.DEBUG) |
1463 unittest.main(verbosity=2) | 1463 unittest.main(verbosity=2) |
1464 | 1464 |
OLD | NEW |