| 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 import os | 6 import os |
| 7 import sys | 7 import sys |
| 8 import unittest | 8 import unittest |
| 9 | 9 |
| 10 from devil.android import device_errors | 10 from devil.android import device_errors |
| 11 from devil.android import md5sum | 11 from devil.android import md5sum |
| 12 from devil.utils import cmd_helper | |
| 13 from pylib import constants | 12 from pylib import constants |
| 14 | 13 |
| 15 sys.path.append( | 14 sys.path.append( |
| 16 os.path.join(constants.DIR_SOURCE_ROOT, 'third_party', 'pymock')) | 15 os.path.join(constants.DIR_SOURCE_ROOT, 'third_party', 'pymock')) |
| 17 import mock | 16 import mock # pylint: disable=import-error |
| 18 | 17 |
| 19 TEST_OUT_DIR = os.path.join('test', 'out', 'directory') | 18 TEST_OUT_DIR = os.path.join('test', 'out', 'directory') |
| 20 HOST_MD5_EXECUTABLE = os.path.join(TEST_OUT_DIR, 'md5sum_bin_host') | 19 HOST_MD5_EXECUTABLE = os.path.join(TEST_OUT_DIR, 'md5sum_bin_host') |
| 21 | 20 |
| 22 class Md5SumTest(unittest.TestCase): | 21 class Md5SumTest(unittest.TestCase): |
| 23 | 22 |
| 24 def setUp(self): | 23 def setUp(self): |
| 25 self._patchers = [ | 24 self._patchers = [ |
| 26 mock.patch('pylib.constants.GetOutDirectory', | 25 mock.patch('pylib.constants.GetOutDirectory', |
| 27 new=mock.Mock(return_value=TEST_OUT_DIR)), | 26 new=mock.Mock(return_value=TEST_OUT_DIR)), |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 self.assertEquals('0123456789abcdeffedcba9876543210', | 224 self.assertEquals('0123456789abcdeffedcba9876543210', |
| 226 out['/storage/emulated/legacy/test/file.dat']) | 225 out['/storage/emulated/legacy/test/file.dat']) |
| 227 self.assertEquals(3, len(device.RunShellCommand.call_args_list)) | 226 self.assertEquals(3, len(device.RunShellCommand.call_args_list)) |
| 228 device.adb.Push.assert_called_once_with( | 227 device.adb.Push.assert_called_once_with( |
| 229 'test/out/directory/md5sum_dist', '/data/local/tmp/md5sum/') | 228 'test/out/directory/md5sum_dist', '/data/local/tmp/md5sum/') |
| 230 | 229 |
| 231 | 230 |
| 232 if __name__ == '__main__': | 231 if __name__ == '__main__': |
| 233 unittest.main(verbosity=2) | 232 unittest.main(verbosity=2) |
| 234 | 233 |
| OLD | NEW |