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 itertools | 5 import itertools |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 import posixpath | 8 import posixpath |
9 | 9 |
10 from devil.android import device_errors | 10 from devil.android import device_errors |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 if not os.path.exists(host_file): | 49 if not os.path.exists(host_file): |
50 break | 50 break |
51 device.PullFile(device_file, host_file) | 51 device.PullFile(device_file, host_file) |
52 | 52 |
53 class _ApkDelegate(object): | 53 class _ApkDelegate(object): |
54 def __init__(self, test_instance): | 54 def __init__(self, test_instance): |
55 self._activity = test_instance.activity | 55 self._activity = test_instance.activity |
56 self._apk = test_instance.apk | 56 self._apk = test_instance.apk |
57 self._package = test_instance.package | 57 self._package = test_instance.package |
58 self._runner = test_instance.runner | 58 self._runner = test_instance.runner |
| 59 self._permissions = test_instance.permissions |
59 | 60 |
60 self._component = '%s/%s' % (self._package, self._runner) | 61 self._component = '%s/%s' % (self._package, self._runner) |
61 self._extras = test_instance.extras | 62 self._extras = test_instance.extras |
62 | 63 |
63 def Install(self, device): | 64 def Install(self, device): |
64 device.Install(self._apk) | 65 device.Install(self._apk, permissions=self._permissions) |
65 | 66 |
66 def Run(self, test, device, flags=None, **kwargs): | 67 def Run(self, test, device, flags=None, **kwargs): |
67 extras = dict(self._extras) | 68 extras = dict(self._extras) |
68 | 69 |
69 with device_temp_file.DeviceTempFile(device.adb) as command_line_file: | 70 with device_temp_file.DeviceTempFile(device.adb) as command_line_file: |
70 device.WriteFile(command_line_file.name, '_ %s' % flags if flags else '_') | 71 device.WriteFile(command_line_file.name, '_ %s' % flags if flags else '_') |
71 extras[_EXTRA_COMMAND_LINE_FILE] = command_line_file.name | 72 extras[_EXTRA_COMMAND_LINE_FILE] = command_line_file.name |
72 | 73 |
73 with device_temp_file.DeviceTempFile(device.adb) as test_list_file: | 74 with device_temp_file.DeviceTempFile(device.adb) as test_list_file: |
74 if test: | 75 if test: |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 return results | 233 return results |
233 | 234 |
234 #override | 235 #override |
235 def TearDown(self): | 236 def TearDown(self): |
236 def individual_device_tear_down(dev): | 237 def individual_device_tear_down(dev): |
237 for s in self._servers[str(dev)]: | 238 for s in self._servers[str(dev)]: |
238 s.TearDown() | 239 s.TearDown() |
239 | 240 |
240 self._env.parallel_devices.pMap(individual_device_tear_down) | 241 self._env.parallel_devices.pMap(individual_device_tear_down) |
241 | 242 |
OLD | NEW |