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 os | 5 import os |
| 6 import posixpath | 6 import posixpath |
| 7 | 7 |
| 8 from devil.android import device_errors | 8 from devil.android import device_errors |
| 9 from pylib import constants | 9 from pylib import constants |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 def Installed(device): | 26 def Installed(device): |
| 27 paths = [posixpath.join(BIN_DIR, c) for c in _COMMANDS] | 27 paths = [posixpath.join(BIN_DIR, c) for c in _COMMANDS] |
| 28 paths.append(posixpath.join(_FRAMEWORK_DIR, 'chromium_commands.jar')) | 28 paths.append(posixpath.join(_FRAMEWORK_DIR, 'chromium_commands.jar')) |
| 29 return device.PathExists(paths) | 29 return device.PathExists(paths) |
| 30 | 30 |
| 31 | 31 |
| 32 def InstallCommands(device): | 32 def InstallCommands(device): |
| 33 if device.IsUserBuild(): | 33 if device.IsUserBuild(): |
| 34 raise device_errors.CommandFailedError( | 34 raise device_errors.CommandFailedError( |
| 35 'chromium_commands currently requires a userdebug build.', | 35 'chromium_commands currently requires a userdebug build.', |
| 36 device_serial=device.GetDeviceSerial()) | 36 device_serial=device.adb.GetDeviceSerial()) |
|
jbudorick
2015/09/11 15:34:34
uh... er... how did this get here
| |
| 37 | 37 |
| 38 chromium_commands_jar_path = os.path.join( | 38 chromium_commands_jar_path = os.path.join( |
| 39 constants.GetOutDirectory(), constants.SDK_BUILD_JAVALIB_DIR, | 39 constants.GetOutDirectory(), constants.SDK_BUILD_JAVALIB_DIR, |
| 40 'chromium_commands.dex.jar') | 40 'chromium_commands.dex.jar') |
| 41 if not os.path.exists(chromium_commands_jar_path): | 41 if not os.path.exists(chromium_commands_jar_path): |
| 42 raise device_errors.CommandFailedError( | 42 raise device_errors.CommandFailedError( |
| 43 '%s not found. Please build chromium_commands.' | 43 '%s not found. Please build chromium_commands.' |
| 44 % chromium_commands_jar_path) | 44 % chromium_commands_jar_path) |
| 45 | 45 |
| 46 device.RunShellCommand(['mkdir', BIN_DIR, _FRAMEWORK_DIR]) | 46 device.RunShellCommand(['mkdir', BIN_DIR, _FRAMEWORK_DIR]) |
| 47 for command, main_class in _COMMANDS.iteritems(): | 47 for command, main_class in _COMMANDS.iteritems(): |
| 48 shell_command = _SHELL_COMMAND_FORMAT % ( | 48 shell_command = _SHELL_COMMAND_FORMAT % ( |
| 49 constants.TEST_EXECUTABLE_DIR, main_class) | 49 constants.TEST_EXECUTABLE_DIR, main_class) |
| 50 shell_file = '%s/%s' % (BIN_DIR, command) | 50 shell_file = '%s/%s' % (BIN_DIR, command) |
| 51 device.WriteFile(shell_file, shell_command) | 51 device.WriteFile(shell_file, shell_command) |
| 52 device.RunShellCommand( | 52 device.RunShellCommand( |
| 53 ['chmod', '755', shell_file], check_return=True) | 53 ['chmod', '755', shell_file], check_return=True) |
| 54 | 54 |
| 55 device.adb.Push( | 55 device.adb.Push( |
| 56 chromium_commands_jar_path, | 56 chromium_commands_jar_path, |
| 57 '%s/chromium_commands.jar' % _FRAMEWORK_DIR) | 57 '%s/chromium_commands.jar' % _FRAMEWORK_DIR) |
| 58 | 58 |
| OLD | NEW |