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>() { |
David Trainor- moved to gerrit
2017/03/30 04:45:38
Should this be instrumentation thread? Some of th
bsheedy
2017/03/30 21:05:14
I don't think it really matters in this case, but
|
+ @Override |
+ public Boolean call() { |
+ if (VrShellDelegate.getVrShellForTesting() == null) return false; |
David Trainor- moved to gerrit
2017/03/30 04:45:38
VrShellImpl vrShell = (VrShellImpl) VrShellDelegat
bsheedy
2017/03/30 21:05:14
Done.
|
+ 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(); |
David Trainor- moved to gerrit
2017/03/30 04:45:38
Maybe try AtomicReference and just set it as we po
bsheedy
2017/03/30 21:05:14
Done. Didn't know about AtomicReference, that coul
|
+ } |
} |