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

Unified Diff: build/android/devil/android/md5sum_test.py

Issue 1416703003: [Android] Add a configurable environment for devil/. (RELAND 2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/devil/android/md5sum.py ('k') | build/android/devil/android/sdk/aapt.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/devil/android/md5sum_test.py
diff --git a/build/android/devil/android/md5sum_test.py b/build/android/devil/android/md5sum_test.py
index e9481b65080181c606d4269822908145ddccf5c9..86023f7aee7ebff41e24fa6c258d46f47dd04d7c 100755
--- a/build/android/devil/android/md5sum_test.py
+++ b/build/android/devil/android/md5sum_test.py
@@ -7,25 +7,29 @@ import os
import sys
import unittest
+from devil import devil_env
from devil.android import device_errors
from devil.android import md5sum
-from pylib import constants
-sys.path.append(
- os.path.join(constants.DIR_SOURCE_ROOT, 'third_party', 'pymock'))
+sys.path.append(devil_env.config.LocalPath('pymock'))
import mock # pylint: disable=import-error
TEST_OUT_DIR = os.path.join('test', 'out', 'directory')
HOST_MD5_EXECUTABLE = os.path.join(TEST_OUT_DIR, 'md5sum_bin_host')
+MD5_DIST = os.path.join(TEST_OUT_DIR, 'md5sum_dist')
class Md5SumTest(unittest.TestCase):
def setUp(self):
+ mocked_attrs = {
+ 'md5sum_host': HOST_MD5_EXECUTABLE,
+ 'md5sum_device': MD5_DIST,
+ }
self._patchers = [
- mock.patch('pylib.constants.GetOutDirectory',
- new=mock.Mock(return_value=TEST_OUT_DIR)),
- mock.patch('os.path.exists',
- new=mock.Mock(return_value=True)),
+ mock.patch('devil.devil_env._Environment.FetchPath',
+ mock.Mock(side_effect=lambda a, device=None: mocked_attrs[a])),
+ mock.patch('os.path.exists',
+ new=mock.Mock(return_value=True)),
]
for p in self._patchers:
p.start()
@@ -217,7 +221,8 @@ class Md5SumTest(unittest.TestCase):
device.RunShellCommand = mock.Mock(
side_effect=(error, '', device_md5sum_output))
- with mock.patch('os.path.getsize', return_value=1337):
+ with mock.patch('os.path.isdir', return_value=True), (
+ mock.patch('os.path.getsize', return_value=1337)):
out = md5sum.CalculateDeviceMd5Sums(test_path, device)
self.assertEquals(1, len(out))
self.assertTrue('/storage/emulated/legacy/test/file.dat' in out)
« no previous file with comments | « build/android/devil/android/md5sum.py ('k') | build/android/devil/android/sdk/aapt.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698