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

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: Cleanup 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..ac506981398c0cde6889a47e8b46dfe014f27268 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,6 +15,7 @@ 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;
@@ -122,4 +123,22 @@ 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) {
+ CriteriaHelper.pollInstrumentationThread(Criteria.equals(true, new Callable<Boolean>() {
+ @Override
+ public Boolean call() {
+ if (VrShellDelegate.getVrShellForTesting() == null) return false;
+ VrShellImpl vrShell = (VrShellImpl) VrShellDelegate.getVrShellForTesting();
+ return vrShell.getUiContentsForTesting() != null;
+ }
+ }), timeout, POLL_CHECK_INTERVAL_LONG_MS);
+ // If we've made it here, then we know that the UI contents exist.
+ return ((VrShellImpl) VrShellDelegate.getVrShellForTesting()).getUiContentsForTesting();
+ }
}

Powered by Google App Engine
This is Rietveld 408576698