| 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();
|
| + }
|
| }
|
|
|