Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: build/android/pylib/utils/md5sum_test.py

Issue 1085713002: [Android] DeviceUtils change to make Install work without md5 binary. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 pylib import cmd_helper 10 from pylib import cmd_helper
11 from pylib import constants 11 from pylib import constants
12 from pylib.utils import md5sum 12 from pylib.utils import md5sum
13 13
14 sys.path.append( 14 sys.path.append(
15 os.path.join(constants.DIR_SOURCE_ROOT, 'third_party', 'pymock')) 15 os.path.join(constants.DIR_SOURCE_ROOT, 'third_party', 'pymock'))
16 import mock 16 import mock
17 17
18 TEST_OUT_DIR = os.path.join('test', 'out', 'directory') 18 TEST_OUT_DIR = os.path.join('test', 'out', 'directory')
19 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')
20 20
21 class Md5SumTest(unittest.TestCase): 21 class Md5SumTest(unittest.TestCase):
22 22
23 def setUp(self): 23 def setUp(self):
24 self._patchers = [ 24 self._patchers = [
25 mock.patch('pylib.constants.GetOutDirectory', 25 mock.patch('pylib.constants.GetOutDirectory',
26 new=mock.Mock(return_value=TEST_OUT_DIR)), 26 new=mock.Mock(return_value=TEST_OUT_DIR)),
27 mock.patch('os.path.exists',
28 new=mock.Mock(return_value=True)),
27 ] 29 ]
28 for p in self._patchers: 30 for p in self._patchers:
29 p.start() 31 p.start()
30 32
31 def tearDown(self): 33 def tearDown(self):
32 for p in self._patchers: 34 for p in self._patchers:
33 p.stop() 35 p.stop()
34 36
35 def testCalculateHostMd5Sums_singlePath(self): 37 def testCalculateHostMd5Sums_singlePath(self):
36 test_path = '/test/host/file.dat' 38 test_path = '/test/host/file.dat'
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 self.assertEquals('/storage/emulated/legacy/test/file1.dat', out[1].path) 176 self.assertEquals('/storage/emulated/legacy/test/file1.dat', out[1].path)
175 device.adb.Push.assert_called_once_with( 177 device.adb.Push.assert_called_once_with(
176 '/tmp/test/script/file.sh', '/data/local/tmp/test/script/file.sh') 178 '/tmp/test/script/file.sh', '/data/local/tmp/test/script/file.sh')
177 device.RunShellCommand.assert_called_once_with( 179 device.RunShellCommand.assert_called_once_with(
178 ['sh', '/data/local/tmp/test/script/file.sh']) 180 ['sh', '/data/local/tmp/test/script/file.sh'])
179 181
180 182
181 if __name__ == '__main__': 183 if __name__ == '__main__':
182 unittest.main(verbosity=2) 184 unittest.main(verbosity=2)
183 185
OLDNEW
« build/android/pylib/device/device_utils.py ('K') | « build/android/pylib/utils/md5sum.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698