OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 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 """Runs semi-automated update testing on a non-rooted device. | 7 """Runs semi-automated update testing on a non-rooted device. |
8 | 8 |
9 This script will help verify that app data is preserved during an update. | 9 This script will help verify that app data is preserved during an update. |
10 To use this script first run it with the create_app_data option. | 10 To use this script first run it with the create_app_data option. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 subparser.add_argument('--new-apk', required=True, | 83 subparser.add_argument('--new-apk', required=True, |
84 help='Path to apk to update to.') | 84 help='Path to apk to update to.') |
85 subparser.add_argument('--app-data', required=True, | 85 subparser.add_argument('--app-data', required=True, |
86 help='Path to where the app data backup is saved.') | 86 help='Path to where the app data backup is saved.') |
87 subparser.add_argument('--package-name', | 87 subparser.add_argument('--package-name', |
88 help='Chrome apk package name.') | 88 help='Chrome apk package name.') |
89 | 89 |
90 args = parser.parse_args() | 90 args = parser.parse_args() |
91 run_tests_helper.SetLogLevel(args.verbose) | 91 run_tests_helper.SetLogLevel(args.verbose) |
92 | 92 |
93 blacklist = (device_blacklist.Blacklist(args.blacklist_file) | 93 if args.blacklist_file: |
94 if args.blacklist_file | 94 blacklist = device_blacklist.Blacklist(args.blacklist_file) |
95 else None) | 95 else: |
| 96 blacklist = None |
96 | 97 |
97 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) | 98 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) |
98 if not devices: | 99 if not devices: |
99 raise device_errors.NoDevicesError() | 100 raise device_errors.NoDevicesError() |
100 device = devices[0] | 101 device = devices[0] |
101 logging.info('Using device %s for testing.' % str(device)) | 102 logging.info('Using device %s for testing.' % str(device)) |
102 | 103 |
103 package_name = (args.package_name if args.package_name | 104 package_name = (args.package_name if args.package_name |
104 else apk_helper.GetPackageName(args.old_apk)) | 105 else apk_helper.GetPackageName(args.old_apk)) |
105 if args.command == 'create_app_data': | 106 if args.command == 'create_app_data': |
106 CreateAppData(device, args.old_apk, args.app_data, package_name) | 107 CreateAppData(device, args.old_apk, args.app_data, package_name) |
107 elif args.command == 'test_update': | 108 elif args.command == 'test_update': |
108 TestUpdate( | 109 TestUpdate( |
109 device, args.old_apk, args.new_apk, args.app_data, package_name) | 110 device, args.old_apk, args.new_apk, args.app_data, package_name) |
110 else: | 111 else: |
111 raise Exception('Unknown test command: %s' % args.command) | 112 raise Exception('Unknown test command: %s' % args.command) |
112 | 113 |
113 if __name__ == '__main__': | 114 if __name__ == '__main__': |
114 sys.exit(main()) | 115 sys.exit(main()) |
OLD | NEW |