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

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

Issue 1399273002: [Android] Add a configurable environment for devil/. (RELAND) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android_any -> android_host Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/devil/android/device_utils.py ('k') | build/android/devil/android/logcat_monitor_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/devil/android/device_utils_test.py
diff --git a/build/android/devil/android/device_utils_test.py b/build/android/devil/android/device_utils_test.py
index 99d3c83d2e50469750648b2a29626c2a3c218529..ab7d3eb3abbdb0eb45c5db867cd057cd5aa2e3c2 100755
--- a/build/android/devil/android/device_utils_test.py
+++ b/build/android/devil/android/device_utils_test.py
@@ -11,10 +11,10 @@ Unit tests for the contents of device_utils.py (mostly DeviceUtils).
# pylint: disable=unused-argument
import logging
-import os
import sys
import unittest
+from devil import devil_env
from devil.android import device_errors
from devil.android import device_signal
from devil.android import device_utils
@@ -23,10 +23,8 @@ from devil.android.sdk import intent
from devil.android.sdk import version_codes
from devil.utils import cmd_helper
from devil.utils import mock_calls
-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=F0401
@@ -71,17 +69,21 @@ class DeviceUtilsInitTest(unittest.TestCase):
class DeviceUtilsGetAVDsTest(mock_calls.TestCase):
def testGetAVDs(self):
- with self.assertCall(
- mock.call.devil.utils.cmd_helper.GetCmdOutput(
- [mock.ANY, 'list', 'avd']),
- 'Available Android Virtual Devices:\n'
- ' Name: my_android5.0\n'
- ' Path: /some/path/to/.android/avd/my_android5.0.avd\n'
- ' Target: Android 5.0 (API level 21)\n'
- ' Tag/ABI: default/x86\n'
- ' Skin: WVGA800\n'):
- self.assertEquals(['my_android5.0'],
- device_utils.GetAVDs())
+ mocked_attrs = {
+ 'android_sdk': '/my/sdk/path'
+ }
+ with mock.patch('devil.devil_env._Environment.LocalPath',
+ mock.Mock(side_effect=lambda a: mocked_attrs[a])):
+ with self.assertCall(
+ mock.call.devil.utils.cmd_helper.GetCmdOutput(
+ [mock.ANY, 'list', 'avd']),
+ 'Available Android Virtual Devices:\n'
+ ' Name: my_android5.0\n'
+ ' Path: /some/path/to/.android/avd/my_android5.0.avd\n'
+ ' Target: Android 5.0 (API level 21)\n'
+ ' Tag/ABI: default/x86\n'
+ ' Skin: WVGA800\n'):
+ self.assertEquals(['my_android5.0'], device_utils.GetAVDs())
class DeviceUtilsRestartServerTest(mock_calls.TestCase):
« no previous file with comments | « build/android/devil/android/device_utils.py ('k') | build/android/devil/android/logcat_monitor_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698