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

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

Issue 1314823011: [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 if options.blacklist_file: 78 blacklist = (device_blacklist.Blacklist(options.blacklist_file)
79 blacklist = device_blacklist.Blacklist(options.blacklist_file) 79 if options.blacklist_file
80 else: 80 else None)
81 blacklist = None
82 81
83 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) 82 devices = device_utils.DeviceUtils.HealthyDevices(blacklist)
84 if options.device: 83 if options.device:
85 device = next((d for d in devices if d == options.device), None) 84 device = next((d for d in devices if d == options.device), None)
86 if not device: 85 if not device:
87 raise device_errors.DeviceUnreachableError(options.device) 86 raise device_errors.DeviceUnreachableError(options.device)
88 else: 87 else:
89 if len(devices) > 1: 88 if len(devices) > 1:
90 parser.error('Multiple devices are attached. ' 89 parser.error('Multiple devices are attached. '
91 'Please specify device serial number with --device.') 90 'Please specify device serial number with --device.')
92 elif len(devices) == 1: 91 elif len(devices) == 1:
93 device = devices[0] 92 device = devices[0]
94 else: 93 else:
95 raise device_errors.NoDevicesError() 94 raise device_errors.NoDevicesError()
96 95
97 if options.video: 96 if options.video:
98 _CaptureVideo(device, host_file, options) 97 _CaptureVideo(device, host_file, options)
99 else: 98 else:
100 _CaptureScreenshot(device, host_file) 99 _CaptureScreenshot(device, host_file)
101 return 0 100 return 0
102 101
103 102
104 if __name__ == '__main__': 103 if __name__ == '__main__':
105 sys.exit(main()) 104 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