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 from pylib.base import environment | 5 from pylib.base import environment |
6 from pylib.device import adb_wrapper | 6 from pylib.device import adb_wrapper |
| 7 from pylib.device import device_blacklist |
7 from pylib.device import device_errors | 8 from pylib.device import device_errors |
8 from pylib.device import device_utils | 9 from pylib.device import device_utils |
9 from pylib.utils import parallelizer | 10 from pylib.utils import parallelizer |
10 | 11 |
11 | 12 |
12 class LocalDeviceEnvironment(environment.Environment): | 13 class LocalDeviceEnvironment(environment.Environment): |
13 | 14 |
14 def __init__(self, args, _error_func): | 15 def __init__(self, args, _error_func): |
15 super(LocalDeviceEnvironment, self).__init__() | 16 super(LocalDeviceEnvironment, self).__init__() |
| 17 self._blacklist = device_blacklist.Blacklist( |
| 18 args.blacklist_file or device_blacklist.BLACKLIST_JSON) |
16 self._device_serial = args.test_device | 19 self._device_serial = args.test_device |
17 self._devices = [] | 20 self._devices = [] |
18 self._max_tries = 1 + args.num_retries | 21 self._max_tries = 1 + args.num_retries |
19 self._tool_name = args.tool | 22 self._tool_name = args.tool |
20 | 23 |
21 #override | 24 #override |
22 def SetUp(self): | 25 def SetUp(self): |
23 available_devices = device_utils.DeviceUtils.HealthyDevices() | 26 available_devices = device_utils.DeviceUtils.HealthyDevices( |
| 27 self._blacklist) |
24 if not available_devices: | 28 if not available_devices: |
25 raise device_errors.NoDevicesError | 29 raise device_errors.NoDevicesError |
26 if self._device_serial: | 30 if self._device_serial: |
27 self._devices = [d for d in available_devices | 31 self._devices = [d for d in available_devices |
28 if d.adb.GetDeviceSerial() == self._device_serial] | 32 if d.adb.GetDeviceSerial() == self._device_serial] |
29 if not self._devices: | 33 if not self._devices: |
30 raise device_errors.DeviceUnreachableError( | 34 raise device_errors.DeviceUnreachableError( |
31 'Could not find device %r' % self._device_serial) | 35 'Could not find device %r' % self._device_serial) |
32 else: | 36 else: |
33 self._devices = available_devices | 37 self._devices = available_devices |
(...skipping 11 matching lines...) Expand all Loading... |
45 return self._max_tries | 49 return self._max_tries |
46 | 50 |
47 @property | 51 @property |
48 def tool(self): | 52 def tool(self): |
49 return self._tool_name | 53 return self._tool_name |
50 | 54 |
51 #override | 55 #override |
52 def TearDown(self): | 56 def TearDown(self): |
53 pass | 57 pass |
54 | 58 |
OLD | NEW |