Chromium Code Reviews| 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 datetime | 5 import datetime |
| 6 import functools | 6 import functools |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import shutil | 9 import shutil |
| 10 import tempfile | 10 import tempfile |
| 11 import threading | 11 import threading |
| 12 | 12 |
| 13 import devil_chromium | |
| 13 from devil import base_error | 14 from devil import base_error |
| 14 from devil.android import device_blacklist | 15 from devil.android import device_blacklist |
| 15 from devil.android import device_errors | 16 from devil.android import device_errors |
| 16 from devil.android import device_list | 17 from devil.android import device_list |
| 17 from devil.android import device_utils | 18 from devil.android import device_utils |
| 18 from devil.android import logcat_monitor | 19 from devil.android import logcat_monitor |
| 19 from devil.utils import file_utils | 20 from devil.utils import file_utils |
| 20 from devil.utils import parallelizer | 21 from devil.utils import parallelizer |
| 21 from pylib import constants | 22 from pylib import constants |
| 22 from pylib.base import environment | 23 from pylib.base import environment |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 self._enable_device_cache = args.enable_device_cache | 88 self._enable_device_cache = args.enable_device_cache |
| 88 self._logcat_monitors = [] | 89 self._logcat_monitors = [] |
| 89 self._logcat_output_dir = args.logcat_output_dir | 90 self._logcat_output_dir = args.logcat_output_dir |
| 90 self._logcat_output_file = args.logcat_output_file | 91 self._logcat_output_file = args.logcat_output_file |
| 91 self._max_tries = 1 + args.num_retries | 92 self._max_tries = 1 + args.num_retries |
| 92 self._skip_clear_data = args.skip_clear_data | 93 self._skip_clear_data = args.skip_clear_data |
| 93 self._target_devices_file = args.target_devices_file | 94 self._target_devices_file = args.target_devices_file |
| 94 self._tool_name = args.tool | 95 self._tool_name = args.tool |
| 95 self._trace_output = args.trace_output | 96 self._trace_output = args.trace_output |
| 96 | 97 |
| 98 devil_chromium.Initialize( | |
| 99 output_directory=constants.GetOutDirectory(), | |
| 100 adb_path=args.adb_path) | |
| 101 | |
| 102 # Some things such as Forwarder require ADB to be in the environment path. | |
| 103 adb_dir = os.path.dirname(constants.GetAdbPath()) | |
|
mikecase (-- gone --)
2017/03/14 16:02:44
You have a TODO to remove existing callers of cons
jbudorick
2017/03/14 20:00:37
Good call. Done.
| |
| 104 if adb_dir and adb_dir not in os.environ['PATH'].split(os.pathsep): | |
| 105 os.environ['PATH'] = adb_dir + os.pathsep + os.environ['PATH'] | |
| 106 | |
| 97 #override | 107 #override |
| 98 def SetUp(self): | 108 def SetUp(self): |
| 99 if self.trace_output: | 109 if self.trace_output: |
| 100 self.EnableTracing() | 110 self.EnableTracing() |
| 101 | 111 |
| 102 def _InitDevices(self): | 112 def _InitDevices(self): |
| 103 device_arg = 'default' | 113 device_arg = 'default' |
| 104 if self._target_devices_file: | 114 if self._target_devices_file: |
| 105 device_arg = device_list.GetPersistentDeviceList( | 115 device_arg = device_list.GetPersistentDeviceList( |
| 106 self._target_devices_file) | 116 self._target_devices_file) |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 257 else: | 267 else: |
| 258 trace_event.trace_disable() | 268 trace_event.trace_disable() |
| 259 self._JsonToTrace(self._trace_output + '.json', | 269 self._JsonToTrace(self._trace_output + '.json', |
| 260 self._trace_output) | 270 self._trace_output) |
| 261 | 271 |
| 262 def EnableTracing(self): | 272 def EnableTracing(self): |
| 263 if trace_event.trace_is_enabled(): | 273 if trace_event.trace_is_enabled(): |
| 264 logging.warning('Tracing is already running.') | 274 logging.warning('Tracing is already running.') |
| 265 else: | 275 else: |
| 266 trace_event.trace_enable(self._trace_output + '.json') | 276 trace_event.trace_enable(self._trace_output + '.json') |
| OLD | NEW |