| 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 1899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1910 (mock.call.pylib.device.device_blacklist.ReadBlacklist(), | 1910 (mock.call.pylib.device.device_blacklist.ReadBlacklist(), |
| 1911 ['fedcba9876543210']), | 1911 ['fedcba9876543210']), |
| 1912 (mock.call.pylib.device.adb_wrapper.AdbWrapper.Devices(), | 1912 (mock.call.pylib.device.adb_wrapper.AdbWrapper.Devices(), |
| 1913 [self._createAdbWrapperMock(s) for s in test_serials])): | 1913 [self._createAdbWrapperMock(s) for s in test_serials])): |
| 1914 devices = device_utils.DeviceUtils.HealthyDevices() | 1914 devices = device_utils.DeviceUtils.HealthyDevices() |
| 1915 self.assertEquals(1, len(devices)) | 1915 self.assertEquals(1, len(devices)) |
| 1916 self.assertTrue(isinstance(devices[0], device_utils.DeviceUtils)) | 1916 self.assertTrue(isinstance(devices[0], device_utils.DeviceUtils)) |
| 1917 self.assertEquals('0123456789abcdef', devices[0].adb.GetDeviceSerial()) | 1917 self.assertEquals('0123456789abcdef', devices[0].adb.GetDeviceSerial()) |
| 1918 | 1918 |
| 1919 | 1919 |
| 1920 class DeviceUtilsRestartAdbdTest(DeviceUtilsTest): |
| 1921 |
| 1922 def testAdbdRestart(self): |
| 1923 mock_temp_file = '/sdcard/temp-123.sh' |
| 1924 with self.assertCalls( |
| 1925 (mock.call.pylib.utils.device_temp_file.DeviceTempFile( |
| 1926 self.adb, suffix='.sh'), MockTempFile(mock_temp_file)), |
| 1927 self.call.device.WriteFile(mock.ANY, mock.ANY), |
| 1928 (self.call.device.RunShellCommand( |
| 1929 ['source', mock_temp_file ], as_root=True)), |
| 1930 self.call.adb.WaitForDevice()): |
| 1931 self.device.RestartAdbd() |
| 1932 |
| 1933 |
| 1920 if __name__ == '__main__': | 1934 if __name__ == '__main__': |
| 1921 logging.getLogger().setLevel(logging.DEBUG) | 1935 logging.getLogger().setLevel(logging.DEBUG) |
| 1922 unittest.main(verbosity=2) | 1936 unittest.main(verbosity=2) |
| 1923 | |
| OLD | NEW |