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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/local/device/local_device_instrumentation_test_run.py
diff --git a/build/android/pylib/local/device/local_device_instrumentation_test_run.py b/build/android/pylib/local/device/local_device_instrumentation_test_run.py
index 7bfe3f5974efed2439e332afc0cd94f7ccd968ab..f1b2246045a65af4e9011cf5493e471e709594de 100644
--- a/build/android/pylib/local/device/local_device_instrumentation_test_run.py
+++ b/build/android/pylib/local/device/local_device_instrumentation_test_run.py
@@ -11,6 +11,7 @@ import time
from devil.android import device_errors
from devil.android import flag_changer
+from devil.android.sdk import intent
from devil.android.sdk import shared_prefs
from devil.utils import reraiser_thread
from pylib import valgrind_tools
@@ -132,6 +133,26 @@ class LocalDeviceInstrumentationTestRun(
def edit_shared_prefs():
for pref in self._test_instance.edit_shared_prefs:
+ # 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
+ # shared preference files if they are created by something other
+ # than the process that uses them (see b/36093591), even with proper
+ # permissions, owner, and group.
+ # This gets around that by adding the option to start and kill
+ # an activity before modifying the preferences file, thus allowing
+ # the app to create a default file that can then be edited.
+ if 'start_and_kill_activity' in pref:
+ act_options = pref['start_and_kill_activity']
+ dev.StartActivity(intent.Intent(
+ action=act_options.get('action', None),
+ activity=act_options.get('activity', None),
+ category=act_options.get('category', None),
+ component=act_options.get('component', None),
+ data=act_options.get('data', None),
+ extras=act_options.get('extras', None),
+ flags=act_options.get('flags', None),
+ package=pref['package']))
+ dev.ForceStop(pref['package'])
+
prefs = shared_prefs.SharedPrefs(dev, pref['package'],
pref['filename'])
prefs.Load()
« 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