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

Side by Side Diff: build/android/pylib/local/device/local_device_instrumentation_test_run.py

Issue 2746453003: Fix several issues with VR instrumentation tests (Closed)
Patch Set: Disable strict mode Created 3 years, 9 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 | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java » ('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 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 import logging 5 import logging
6 import os 6 import os
7 import posixpath 7 import posixpath
8 import re 8 import re
9 import tempfile 9 import tempfile
10 import time 10 import time
11 11
12 from devil.android import device_errors 12 from devil.android import device_errors
13 from devil.android import flag_changer 13 from devil.android import flag_changer
14 from devil.android.sdk import intent
14 from devil.android.sdk import shared_prefs 15 from devil.android.sdk import shared_prefs
15 from devil.utils import reraiser_thread 16 from devil.utils import reraiser_thread
16 from pylib import valgrind_tools 17 from pylib import valgrind_tools
17 from pylib.android import logdog_logcat_monitor 18 from pylib.android import logdog_logcat_monitor
18 from pylib.constants import host_paths 19 from pylib.constants import host_paths
19 from pylib.base import base_test_result 20 from pylib.base import base_test_result
20 from pylib.instrumentation import instrumentation_test_instance 21 from pylib.instrumentation import instrumentation_test_instance
21 from pylib.local.device import local_device_environment 22 from pylib.local.device import local_device_environment
22 from pylib.local.device import local_device_test_run 23 from pylib.local.device import local_device_test_run
23 from pylib.utils import google_storage_helper 24 from pylib.utils import google_storage_helper
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 logging.error("Couldn't set debug app: no package info") 126 logging.error("Couldn't set debug app: no package info")
126 elif not self._test_instance.package_info.package: 127 elif not self._test_instance.package_info.package:
127 logging.error("Couldn't set debug app: no package defined") 128 logging.error("Couldn't set debug app: no package defined")
128 else: 129 else:
129 dev.RunShellCommand(['am', 'set-debug-app', '--persistent', 130 dev.RunShellCommand(['am', 'set-debug-app', '--persistent',
130 self._test_instance.package_info.package], 131 self._test_instance.package_info.package],
131 check_return=True) 132 check_return=True)
132 133
133 def edit_shared_prefs(): 134 def edit_shared_prefs():
134 for pref in self._test_instance.edit_shared_prefs: 135 for pref in self._test_instance.edit_shared_prefs:
136 # Workaround for Android's SharedPreferencesImpl failing to open
bsheedy 2017/03/10 00:01:45 This is a very hacky workaround, but I've been una
jbudorick 2017/03/10 02:19:21 Dollars to donuts that this is an SELinux issue. C
137 # shared preference files if they are created by something other
138 # than the process that uses them (see b/36093591), even with proper
139 # permissions, owner, and group.
140 # This gets around that by adding the option to start and kill
141 # an activity before modifying the preferences file, thus allowing
142 # the app to create a default file that can then be edited.
143 if 'start_and_kill_activity' in pref:
144 act_options = pref['start_and_kill_activity']
145 dev.StartActivity(intent.Intent(
146 action=act_options.get('action', None),
147 activity=act_options.get('activity', None),
148 category=act_options.get('category', None),
149 component=act_options.get('component', None),
150 data=act_options.get('data', None),
151 extras=act_options.get('extras', None),
152 flags=act_options.get('flags', None),
153 package=pref['package']))
154 dev.ForceStop(pref['package'])
155
135 prefs = shared_prefs.SharedPrefs(dev, pref['package'], 156 prefs = shared_prefs.SharedPrefs(dev, pref['package'],
136 pref['filename']) 157 pref['filename'])
137 prefs.Load() 158 prefs.Load()
138 for key in pref.get('remove', []): 159 for key in pref.get('remove', []):
139 try: 160 try:
140 prefs.Remove(key) 161 prefs.Remove(key)
141 except KeyError: 162 except KeyError:
142 logging.warning("Attempted to remove non-existent key %s", key) 163 logging.warning("Attempted to remove non-existent key %s", key)
143 for key, value in pref.get('set', {}).iteritems(): 164 for key, value in pref.get('set', {}).iteritems():
144 if isinstance(value, bool): 165 if isinstance(value, bool):
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 timeout = v 564 timeout = v
544 break 565 break
545 else: 566 else:
546 logging.warning('Using default 1 minute timeout for %s', test_name) 567 logging.warning('Using default 1 minute timeout for %s', test_name)
547 timeout = 60 568 timeout = 60
548 569
549 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) 570 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations)
550 571
551 return timeout 572 return timeout
552 573
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698