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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/VrUtils.java

Issue 2837033002: Revert 2841523002 (Closed)
Patch Set: Make VrShell fix work with re-enabled tests Created 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/VrUtils.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/VrUtils.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/VrUtils.java
index e16076eb898dfad009c338a980925dbc38c3a1bd..d63fa8529d6537fcb23f8211d6dbb24b6a53ab1c 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/VrUtils.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/VrUtils.java
@@ -22,6 +22,7 @@ import org.chromium.content.browser.test.util.CriteriaHelper;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.concurrent.Callable;
+import java.util.concurrent.atomic.AtomicReference;
/**
* Class containing static functions and constants that are useful for VR
@@ -48,6 +49,23 @@ public class VrUtils {
private static final int RESERVED = 456;
/**
+ * Gets the VrShellDelegate instance on the UI thread, as otherwise the
+ * Choreographer obtained in VrShellDelegate's constructor is for the instrumentation
+ * thread instead of the UI thread.
+ * @return The browser's current VrShellDelegate instance
+ */
+ public static VrShellDelegate getVrShellDelegateInstance() {
+ final AtomicReference<VrShellDelegate> delegate = new AtomicReference<VrShellDelegate>();
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ delegate.set(VrShellDelegate.getInstanceForTesting());
+ }
+ });
+ return delegate.get();
+ }
+
+ /**
* Forces the browser into VR mode via a VrShellDelegate call.
*/
public static void forceEnterVr() {

Powered by Google App Engine
This is Rietveld 408576698