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

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

Issue 2773903003: Add way to get native VR UI information from Java (Closed)
Patch Set: Remove comment 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
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 7e5797911605c7419a338e00258528b5395a13ea..60b48458b57916ffe332b67a420f16a0f9478673 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
@@ -15,10 +15,12 @@ import android.nfc.NfcAdapter;
import org.chromium.base.ThreadUtils;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
+import org.chromium.content_public.browser.WebContents;
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
@@ -122,4 +124,21 @@ public class VrUtils {
}
}), timeout, POLL_CHECK_INTERVAL_SHORT_MS);
}
+
+ /**
+ * Tries to get the HTML UI WebContents from VrShell.
+ * @param timeout The timeout for getting the WebContents in milliseconds
+ * @return The WebContents for the HTML UI.
+ */
+ public static WebContents getVrShellUiContents(final int timeout) {
+ final AtomicReference<VrShellImpl> vrShell = new AtomicReference<VrShellImpl>();
+ CriteriaHelper.pollUiThread(Criteria.equals(true, new Callable<Boolean>() {
+ @Override
+ public Boolean call() {
+ vrShell.set((VrShellImpl) VrShellDelegate.getVrShellForTesting());
+ return vrShell.get() != null && vrShell.get().getUiContentsForTesting() != null;
+ }
+ }), timeout, POLL_CHECK_INTERVAL_LONG_MS);
+ return vrShell.get().getUiContentsForTesting();
+ }
}

Powered by Google App Engine
This is Rietveld 408576698