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 13 matching lines...) Expand all Loading... |
24 and ask the user to verify that all of the app data was preserved. | 24 and ask the user to verify that all of the app data was preserved. |
25 """ | 25 """ |
26 | 26 |
27 import argparse | 27 import argparse |
28 import logging | 28 import logging |
29 import os | 29 import os |
30 import sys | 30 import sys |
31 import time | 31 import time |
32 | 32 |
33 from pylib import constants | 33 from pylib import constants |
34 from pylib.device import device_blacklist | 34 from devil.android import apk_helper |
35 from pylib.device import device_errors | 35 from devil.android import device_blacklist |
36 from pylib.device import device_utils | 36 from devil.android import device_errors |
37 from pylib.utils import apk_helper | 37 from devil.android import device_utils |
38 from pylib.utils import run_tests_helper | 38 from devil.utils import run_tests_helper |
39 | 39 |
40 def CreateAppData(device, old_apk, app_data, package_name): | 40 def CreateAppData(device, old_apk, app_data, package_name): |
41 device.Install(old_apk) | 41 device.Install(old_apk) |
42 raw_input('Set the application state. Once ready, press enter and ' | 42 raw_input('Set the application state. Once ready, press enter and ' |
43 'select "Backup my data" on the device.') | 43 'select "Backup my data" on the device.') |
44 device.adb.Backup(app_data, packages=[package_name]) | 44 device.adb.Backup(app_data, packages=[package_name]) |
45 logging.critical('Application data saved to %s' % app_data) | 45 logging.critical('Application data saved to %s' % app_data) |
46 | 46 |
47 def TestUpdate(device, old_apk, new_apk, app_data, package_name): | 47 def TestUpdate(device, old_apk, new_apk, app_data, package_name): |
48 device.Install(old_apk) | 48 device.Install(old_apk) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 if args.command == 'create_app_data': | 106 if args.command == 'create_app_data': |
107 CreateAppData(device, args.old_apk, args.app_data, package_name) | 107 CreateAppData(device, args.old_apk, args.app_data, package_name) |
108 elif args.command == 'test_update': | 108 elif args.command == 'test_update': |
109 TestUpdate( | 109 TestUpdate( |
110 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) |
111 else: | 111 else: |
112 raise Exception('Unknown test command: %s' % args.command) | 112 raise Exception('Unknown test command: %s' % args.command) |
113 | 113 |
114 if __name__ == '__main__': | 114 if __name__ == '__main__': |
115 sys.exit(main()) | 115 sys.exit(main()) |
OLD | NEW |