OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 """Tests for the AdbWrapper class.""" | 5 """Tests for the AdbWrapper class.""" |
6 | 6 |
7 import os | 7 import os |
8 import tempfile | 8 import tempfile |
9 import time | 9 import time |
10 import unittest | 10 import unittest |
11 | 11 |
12 from pylib.device import adb_wrapper | 12 from pylib.device import adb_wrapper |
13 from pylib.device import device_errors | 13 from pylib.device import device_errors |
14 | 14 |
15 | 15 |
16 class TestAdbWrapper(unittest.TestCase): | 16 class TestAdbWrapper(unittest.TestCase): |
17 | 17 |
18 def setUp(self): | 18 def setUp(self): |
19 devices = adb_wrapper.AdbWrapper.GetDevices() | 19 devices = adb_wrapper.AdbWrapper.Devices() |
20 assert devices, 'A device must be attached' | 20 assert devices, 'A device must be attached' |
21 self._adb = devices[0] | 21 self._adb = devices[0] |
22 self._adb.WaitForDevice() | 22 self._adb.WaitForDevice() |
23 | 23 |
24 @staticmethod | 24 @staticmethod |
25 def _MakeTempFile(contents): | 25 def _MakeTempFile(contents): |
26 """Make a temporary file with the given contents. | 26 """Make a temporary file with the given contents. |
27 | 27 |
28 Args: | 28 Args: |
29 contents: string to write to the temporary file. | 29 contents: string to write to the temporary file. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 try: | 87 try: |
88 self._adb.Shell('start') | 88 self._adb.Shell('start') |
89 break | 89 break |
90 except device_errors.AdbCommandFailedError: | 90 except device_errors.AdbCommandFailedError: |
91 time.sleep(1) | 91 time.sleep(1) |
92 self._adb.Remount() | 92 self._adb.Remount() |
93 | 93 |
94 | 94 |
95 if __name__ == '__main__': | 95 if __name__ == '__main__': |
96 unittest.main() | 96 unittest.main() |
OLD | NEW |