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 mock_calls.py. | 7 Unit tests for the contents of mock_calls.py. |
8 """ | 8 """ |
9 | 9 |
10 import logging | 10 import logging |
11 import os | 11 import os |
12 import sys | 12 import sys |
13 import unittest | 13 import unittest |
14 | 14 |
| 15 from devil import devil_env |
15 from devil.android.sdk import version_codes | 16 from devil.android.sdk import version_codes |
16 from devil.utils import mock_calls | 17 from devil.utils import mock_calls |
17 from pylib import constants | |
18 | 18 |
19 sys.path.append(os.path.join( | 19 sys.path.append(devil_env.config.LocalPath('pymock')) |
20 constants.DIR_SOURCE_ROOT, 'third_party', 'pymock')) | |
21 import mock # pylint: disable=F0401 | 20 import mock # pylint: disable=F0401 |
22 | 21 |
23 | 22 |
24 class _DummyAdb(object): | 23 class _DummyAdb(object): |
25 def __str__(self): | 24 def __str__(self): |
26 return '0123456789abcdef' | 25 return '0123456789abcdef' |
27 | 26 |
28 def Push(self, host_path, device_path): | 27 def Push(self, host_path, device_path): |
29 logging.debug('(device %s) pushing %r to %r', self, host_path, device_path) | 28 logging.debug('(device %s) pushing %r to %r', self, host_path, device_path) |
30 | 29 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 self.watchMethodCalls(self.call.adb) | 163 self.watchMethodCalls(self.call.adb) |
165 with self.assertRaises(AssertionError): | 164 with self.assertRaises(AssertionError): |
166 with self.assertCalls(): | 165 with self.assertCalls(): |
167 self.adb.IsOnline() | 166 self.adb.IsOnline() |
168 | 167 |
169 | 168 |
170 if __name__ == '__main__': | 169 if __name__ == '__main__': |
171 logging.getLogger().setLevel(logging.DEBUG) | 170 logging.getLogger().setLevel(logging.DEBUG) |
172 unittest.main(verbosity=2) | 171 unittest.main(verbosity=2) |
173 | 172 |
OLD | NEW |