Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: build/android/screenshot.py

Issue 1306653005: Revert of [Android] Don't use a device blacklist if one isn't provided. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Takes a screenshot or a screen video capture from an Android device.""" 7 """Takes a screenshot or a screen video capture from an Android device."""
8 8
9 import logging 9 import logging
10 import optparse 10 import optparse
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 (options, args) = parser.parse_args() 69 (options, args) = parser.parse_args()
70 70
71 if len(args) > 1: 71 if len(args) > 1:
72 parser.error('Too many positional arguments.') 72 parser.error('Too many positional arguments.')
73 host_file = args[0] if args else options.file 73 host_file = args[0] if args else options.file
74 74
75 if options.verbose: 75 if options.verbose:
76 logging.getLogger().setLevel(logging.DEBUG) 76 logging.getLogger().setLevel(logging.DEBUG)
77 77
78 blacklist = (device_blacklist.Blacklist(options.blacklist_file) 78 if options.blacklist_file:
79 if options.blacklist_file 79 blacklist = device_blacklist.Blacklist(options.blacklist_file)
80 else None) 80 else:
81 blacklist = None
81 82
82 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) 83 devices = device_utils.DeviceUtils.HealthyDevices(blacklist)
83 if options.device: 84 if options.device:
84 device = next((d for d in devices if d == options.device), None) 85 device = next((d for d in devices if d == options.device), None)
85 if not device: 86 if not device:
86 raise device_errors.DeviceUnreachableError(options.device) 87 raise device_errors.DeviceUnreachableError(options.device)
87 else: 88 else:
88 if len(devices) > 1: 89 if len(devices) > 1:
89 parser.error('Multiple devices are attached. ' 90 parser.error('Multiple devices are attached. '
90 'Please specify device serial number with --device.') 91 'Please specify device serial number with --device.')
91 elif len(devices) == 1: 92 elif len(devices) == 1:
92 device = devices[0] 93 device = devices[0]
93 else: 94 else:
94 raise device_errors.NoDevicesError() 95 raise device_errors.NoDevicesError()
95 96
96 if options.video: 97 if options.video:
97 _CaptureVideo(device, host_file, options) 98 _CaptureVideo(device, host_file, options)
98 else: 99 else:
99 _CaptureScreenshot(device, host_file) 100 _CaptureScreenshot(device, host_file)
100 return 0 101 return 0
101 102
102 103
103 if __name__ == '__main__': 104 if __name__ == '__main__':
104 sys.exit(main()) 105 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/pylib/local/device/local_device_environment.py ('k') | build/android/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698