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

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

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

Powered by Google App Engine
This is Rietveld 408576698