| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Swarming Authors. All rights reserved. | 2 # Copyright 2015 The Swarming Authors. All rights reserved. |
| 3 # Use of this source code is governed by the Apache v2.0 license that can be | 3 # Use of this source code is governed by the Apache v2.0 license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import logging | 6 import logging |
| 7 import sys | 7 import sys |
| 8 import unittest | 8 import unittest |
| 9 | 9 |
| 10 import test_env_platforms | 10 import test_env_platforms |
| 11 test_env_platforms.setup_test_env() | 11 test_env_platforms.setup_test_env() |
| 12 | 12 |
| 13 import android | 13 import android |
| 14 | 14 |
| 15 | 15 |
| 16 class MockDevice(object): | 16 class MockDevice(android.Device): |
| 17 def __init__(self, cmds): | 17 def __init__(self, cmds): |
| 18 super(MockDevice, self).__init__(None, None) |
| 18 self._cmds = cmds[:] | 19 self._cmds = cmds[:] |
| 19 | 20 |
| 20 def shell(self, cmd): | 21 def shell(self, cmd): |
| 21 data = self._cmds.pop(0) | 22 data = self._cmds.pop(0) |
| 22 assert data[0] == cmd, (data, cmd) | 23 assert data[0] == cmd, (data, cmd) |
| 23 return data[1], 0 | 24 return data[1], 0 |
| 24 | 25 |
| 25 | 26 |
| 26 RAW_IMEI = """Result: Parcel( | 27 RAW_IMEI = """Result: Parcel( |
| 27 0x00000000: 00000000 0000000f 00350033 00320035 '........3.5.5.2.' | 28 0x00000000: 00000000 0000000f 00350033 00320035 '........3.5.5.2.' |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 self.assertTrue(signer.Sign('data to sign')) | 79 self.assertTrue(signer.Sign('data to sign')) |
| 79 | 80 |
| 80 | 81 |
| 81 | 82 |
| 82 if __name__ == '__main__': | 83 if __name__ == '__main__': |
| 83 if '-v' in sys.argv: | 84 if '-v' in sys.argv: |
| 84 unittest.TestCase.maxDiff = None | 85 unittest.TestCase.maxDiff = None |
| 85 logging.basicConfig( | 86 logging.basicConfig( |
| 86 level=logging.DEBUG if '-v' in sys.argv else logging.CRITICAL) | 87 level=logging.DEBUG if '-v' in sys.argv else logging.CRITICAL) |
| 87 unittest.main() | 88 unittest.main() |
| OLD | NEW |