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

Side by Side Diff: devil/devil/android/device_utils.py

Issue 2552033003: [devil] Clarify DeviceUtils.Install{,SplitApk} failure on missing APK. (Closed)
Patch Set: Created 4 years 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 | « no previous file | devil/devil/android/device_utils_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Provides a variety of device interactions based on adb. 5 """Provides a variety of device interactions based on adb.
6 6
7 Eventually, this will be based on adb_wrapper. 7 Eventually, this will be based on adb_wrapper.
8 """ 8 """
9 # pylint: disable=unused-argument 9 # pylint: disable=unused-argument
10 10
11 import calendar 11 import calendar
12 import collections 12 import collections
13 import itertools 13 import itertools
14 import json 14 import json
15 import logging 15 import logging
16 import multiprocessing 16 import multiprocessing
17 import os 17 import os
18 import posixpath 18 import posixpath
19 import pprint
19 import re 20 import re
20 import shutil 21 import shutil
21 import stat 22 import stat
22 import tempfile 23 import tempfile
23 import time 24 import time
24 import threading 25 import threading
25 import uuid 26 import uuid
26 import zipfile 27 import zipfile
27 28
28 from devil import base_error 29 from devil import base_error
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 695
695 base_apk = apk_helper.ToHelper(base_apk) 696 base_apk = apk_helper.ToHelper(base_apk)
696 697
697 all_apks = [base_apk.path] 698 all_apks = [base_apk.path]
698 if split_apks: 699 if split_apks:
699 all_apks += split_select.SelectSplits( 700 all_apks += split_select.SelectSplits(
700 self, base_apk.path, split_apks, allow_cached_props=allow_cached_props) 701 self, base_apk.path, split_apks, allow_cached_props=allow_cached_props)
701 if len(all_apks) == 1: 702 if len(all_apks) == 1:
702 logger.warning('split-select did not select any from %s', split_apks) 703 logger.warning('split-select did not select any from %s', split_apks)
703 704
705 missing_apks = [apk for apk in all_apks if not os.path.exists(apk)]
706 if missing_apks:
707 raise device_errors.CommandFailedError(
708 'Attempted to install non-existent apks: %s'
709 % pprint.pformat(missing_apks))
710
704 package_name = base_apk.GetPackageName() 711 package_name = base_apk.GetPackageName()
705 device_apk_paths = self._GetApplicationPathsInternal(package_name) 712 device_apk_paths = self._GetApplicationPathsInternal(package_name)
706 713
707 apks_to_install = None 714 apks_to_install = None
708 host_checksums = None 715 host_checksums = None
709 if not device_apk_paths: 716 if not device_apk_paths:
710 apks_to_install = all_apks 717 apks_to_install = all_apks
711 elif len(device_apk_paths) > 1 and not split_apks: 718 elif len(device_apk_paths) > 1 and not split_apks:
712 logger.warning( 719 logger.warning(
713 'Installing non-split APK when split APK was previously installed') 720 'Installing non-split APK when split APK was previously installed')
(...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after
2470 on: bool to decide state to switch to. True = on False = off. 2477 on: bool to decide state to switch to. True = on False = off.
2471 """ 2478 """
2472 def screen_test(): 2479 def screen_test():
2473 return self.IsScreenOn() == on 2480 return self.IsScreenOn() == on
2474 2481
2475 if screen_test(): 2482 if screen_test():
2476 logger.info('Screen already in expected state.') 2483 logger.info('Screen already in expected state.')
2477 return 2484 return
2478 self.RunShellCommand('input keyevent 26') 2485 self.RunShellCommand('input keyevent 26')
2479 timeout_retry.WaitFor(screen_test, wait_period=1) 2486 timeout_retry.WaitFor(screen_test, wait_period=1)
OLDNEW
« no previous file with comments | « no previous file | devil/devil/android/device_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698