OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import unittest | 5 import unittest |
6 | 6 |
7 from telemetry.internal.browser import browser_options | 7 from telemetry.internal.browser import browser_options |
8 from telemetry.internal.platform import android_device | 8 from telemetry.internal.platform import android_device |
9 from telemetry.testing import system_stub | 9 from telemetry.testing import system_stub |
10 import mock | 10 import mock |
11 | 11 |
12 from pylib.device import device_utils | 12 from devil.android import device_utils |
13 | 13 |
14 | 14 |
15 class _BaseAndroidDeviceTest(unittest.TestCase): | 15 class _BaseAndroidDeviceTest(unittest.TestCase): |
16 def setUp(self): | 16 def setUp(self): |
17 self._healthy_device_patcher = mock.patch( | 17 self._healthy_device_patcher = mock.patch( |
18 'pylib.device.device_utils.DeviceUtils.HealthyDevices') | 18 'devil.android.device_utils.DeviceUtils.HealthyDevices') |
19 self._healthy_device_mock = self._healthy_device_patcher.start() | 19 self._healthy_device_mock = self._healthy_device_patcher.start() |
20 self._android_device_stub = system_stub.Override( | 20 self._android_device_stub = system_stub.Override( |
21 android_device, ['subprocess', 'logging']) | 21 android_device, ['subprocess', 'logging']) |
22 | 22 |
23 def _GetMockDeviceUtils(self, device_serial, is_online=True): | 23 def _GetMockDeviceUtils(self, device_serial, is_online=True): |
24 device = device_utils.DeviceUtils(device_serial) | 24 device = device_utils.DeviceUtils(device_serial) |
25 device.IsOnline = mock.MagicMock(return_value=is_online) | 25 device.IsOnline = mock.MagicMock(return_value=is_online) |
26 return device | 26 return device |
27 | 27 |
28 def tearDown(self): | 28 def tearDown(self): |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 self._GetMockDeviceUtils('this0should0not0show', is_online=False), | 121 self._GetMockDeviceUtils('this0should0not0show', is_online=False), |
122 self._GetMockDeviceUtils('015d14fec128220d'), | 122 self._GetMockDeviceUtils('015d14fec128220d'), |
123 self._GetMockDeviceUtils('015d14fec128220e')] | 123 self._GetMockDeviceUtils('015d14fec128220e')] |
124 devices = android_device.FindAllAvailableDevices(finder_options) | 124 devices = android_device.FindAllAvailableDevices(finder_options) |
125 self.assertEquals([], self._android_device_stub.logging.warnings) | 125 self.assertEquals([], self._android_device_stub.logging.warnings) |
126 self.assertIsNotNone(devices) | 126 self.assertIsNotNone(devices) |
127 self.assertEquals(len(devices), 3) | 127 self.assertEquals(len(devices), 3) |
128 self.assertEquals(devices[0].guid, '015d14fec128220c') | 128 self.assertEquals(devices[0].guid, '015d14fec128220c') |
129 self.assertEquals(devices[1].guid, '015d14fec128220d') | 129 self.assertEquals(devices[1].guid, '015d14fec128220d') |
130 self.assertEquals(devices[2].guid, '015d14fec128220e') | 130 self.assertEquals(devices[2].guid, '015d14fec128220e') |
OLD | NEW |