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

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

Issue 1089273002: Revert of [Android] Remove android_commands uses from build/android/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « build/android/tombstones.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import logging 8 import logging
9 import optparse 9 import optparse
10 import os 10 import os
11 import shutil 11 import shutil
12 import sys 12 import sys
13 import time 13 import time
14 14
15 from pylib.device import adb_wrapper 15 from pylib import android_commands
16 from pylib.device import device_filter
17 from pylib.device import device_utils 16 from pylib.device import device_utils
18 17
19 def _SaveAppData(device, package_name, from_apk=None, data_dir=None): 18 def _SaveAppData(device, package_name, from_apk=None, data_dir=None):
20 def _BackupAppData(data_dir=None): 19 def _BackupAppData(data_dir=None):
21 device.adb.Backup(package_name) 20 device.adb.Backup(package_name)
22 backup_file = os.path.join(os.getcwd(), 'backup.ab') 21 backup_file = os.path.join(os.getcwd(), 'backup.ab')
23 assert os.path.exists(backup_file), 'Backup failed.' 22 assert os.path.exists(backup_file), 'Backup failed.'
24 if data_dir: 23 if data_dir:
25 if not os.path.isdir(data_dir): 24 if not os.path.isdir(data_dir):
26 os.makedirs(data_dir) 25 os.makedirs(data_dir)
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 parser.add_option('--to-apk', help='APK to update to.') 101 parser.add_option('--to-apk', help='APK to update to.')
103 parser.add_option('--app-data', 102 parser.add_option('--app-data',
104 help=('Path to the application data to be restored or the ' 103 help=('Path to the application data to be restored or the '
105 'directory where the data should be saved.')) 104 'directory where the data should be saved.'))
106 (options, args) = parser.parse_args() 105 (options, args) = parser.parse_args()
107 106
108 if args: 107 if args:
109 parser.print_help(sys.stderr) 108 parser.print_help(sys.stderr)
110 parser.error('Unknown arguments: %s.' % args) 109 parser.error('Unknown arguments: %s.' % args)
111 110
112 devices = adb_wrapper.AdbWrapper.Devices( 111 devices = android_commands.GetAttachedDevices()
113 filters=device_filter.DefaultFilters())
114 if len(devices) != 1: 112 if len(devices) != 1:
115 parser.error('Exactly 1 device must be attached.') 113 parser.error('Exactly 1 device must be attached.')
116 device = device_utils.DeviceUtils(devices[0]) 114 device = device_utils.DeviceUtils(devices[0])
117 115
118 if options.from_apk: 116 if options.from_apk:
119 assert os.path.isfile(options.from_apk) 117 assert os.path.isfile(options.from_apk)
120 118
121 if options.save: 119 if options.save:
122 if not options.package_name: 120 if not options.package_name:
123 parser.print_help(sys.stderr) 121 parser.print_help(sys.stderr)
124 parser.error('Missing --package-name.') 122 parser.error('Missing --package-name.')
125 _SaveAppData(device, options.package_name, from_apk=options.from_apk, 123 _SaveAppData(device, options.package_name, from_apk=options.from_apk,
126 data_dir=options.app_data) 124 data_dir=options.app_data)
127 else: 125 else:
128 if not options.to_apk or not options.app_data: 126 if not options.to_apk or not options.app_data:
129 parser.print_help(sys.stderr) 127 parser.print_help(sys.stderr)
130 parser.error('Missing --to-apk or --app-data.') 128 parser.error('Missing --to-apk or --app-data.')
131 assert os.path.isfile(options.to_apk) 129 assert os.path.isfile(options.to_apk)
132 assert os.path.isfile(options.app_data) 130 assert os.path.isfile(options.app_data)
133 _VerifyAppUpdate(device, options.to_apk, options.app_data, 131 _VerifyAppUpdate(device, options.to_apk, options.app_data,
134 from_apk=options.from_apk) 132 from_apk=options.from_apk)
135 133
136 134
137 if __name__ == '__main__': 135 if __name__ == '__main__':
138 main() 136 main()
OLDNEW
« no previous file with comments | « build/android/tombstones.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698