| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Provides an interface to communicate with the device via the adb command. | 6 """Provides an interface to communicate with the device via the adb command. |
| 7 | 7 |
| 8 Assumes adb binary is currently on system path. | 8 Assumes adb binary is currently on system path. |
| 9 | 9 |
| 10 Usage: | 10 Usage: |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 | 390 |
| 391 def PushIfNeeded(self, local_path, device_path): | 391 def PushIfNeeded(self, local_path, device_path): |
| 392 """Pushes |local_path| to |device_path|. | 392 """Pushes |local_path| to |device_path|. |
| 393 | 393 |
| 394 Works for files and directories. This method skips copying any paths in | 394 Works for files and directories. This method skips copying any paths in |
| 395 |test_data_paths| that already exist on the device with the same timestamp | 395 |test_data_paths| that already exist on the device with the same timestamp |
| 396 and size. | 396 and size. |
| 397 | 397 |
| 398 All pushed files can be removed by calling RemovePushedFiles(). | 398 All pushed files can be removed by calling RemovePushedFiles(). |
| 399 """ | 399 """ |
| 400 assert os.path.exists(local_path) | 400 assert os.path.exists(local_path), 'Local path not found %s' % local_path |
| 401 self._pushed_files.append(device_path) | 401 self._pushed_files.append(device_path) |
| 402 | 402 |
| 403 # If the path contents are the same, there's nothing to do. | 403 # If the path contents are the same, there's nothing to do. |
| 404 local_contents = ListHostPathContents(local_path) | 404 local_contents = ListHostPathContents(local_path) |
| 405 device_contents = self.ListPathContents(device_path) | 405 device_contents = self.ListPathContents(device_path) |
| 406 # Only compare the size and timestamp if only copying a file because | 406 # Only compare the size and timestamp if only copying a file because |
| 407 # the filename on device can be renamed. | 407 # the filename on device can be renamed. |
| 408 if os.path.isfile(local_path): | 408 if os.path.isfile(local_path): |
| 409 assert len(local_contents) == 1 | 409 assert len(local_contents) == 1 |
| 410 is_equal = local_contents.values() == device_contents.values() | 410 is_equal = local_contents.values() == device_contents.values() |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 options, args = option_parser.parse_args(argv) | 771 options, args = option_parser.parse_args(argv) |
| 772 | 772 |
| 773 commands = AndroidCommands(wait_for_pm=options.wait_for_pm) | 773 commands = AndroidCommands(wait_for_pm=options.wait_for_pm) |
| 774 if options.set_asserts != None: | 774 if options.set_asserts != None: |
| 775 if commands.SetJavaAssertsEnabled(options.set_asserts): | 775 if commands.SetJavaAssertsEnabled(options.set_asserts): |
| 776 commands.Reboot(full_reboot=False) | 776 commands.Reboot(full_reboot=False) |
| 777 | 777 |
| 778 | 778 |
| 779 if __name__ == '__main__': | 779 if __name__ == '__main__': |
| 780 main(sys.argv) | 780 main(sys.argv) |
| OLD | NEW |