Commit 4ff66377 authored by bsheedy's avatar bsheedy Committed by Commit Bot

Port VrShellNavigationTest to WebXR

Adds VrShellNavigationTestWebXr, which contains copies of all the tests
in VrShellNavigationTest that make use of WebVR. These will be merged
back in to VrShellNavigationTest once WebVR is removed.

Bug: 804043
Change-Id: I50c6a8618d9f1ef09de92a44b88aef5dff4bd46d
Reviewed-on: https://chromium-review.googlesource.com/887165Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533318}
parent 3184e875
...@@ -631,6 +631,7 @@ if (enable_vr) { ...@@ -631,6 +631,7 @@ if (enable_vr) {
"javatests/src/org/chromium/chrome/browser/vr_shell/VrShellControllerInputTest.java", "javatests/src/org/chromium/chrome/browser/vr_shell/VrShellControllerInputTest.java",
"javatests/src/org/chromium/chrome/browser/vr_shell/VrShellNativeUiTest.java", "javatests/src/org/chromium/chrome/browser/vr_shell/VrShellNativeUiTest.java",
"javatests/src/org/chromium/chrome/browser/vr_shell/VrShellNavigationTest.java", "javatests/src/org/chromium/chrome/browser/vr_shell/VrShellNavigationTest.java",
"javatests/src/org/chromium/chrome/browser/vr_shell/VrShellNavigationTestWebXr.java",
"javatests/src/org/chromium/chrome/browser/vr_shell/VrShellTransitionTest.java", "javatests/src/org/chromium/chrome/browser/vr_shell/VrShellTransitionTest.java",
"javatests/src/org/chromium/chrome/browser/vr_shell/VrTestFramework.java", "javatests/src/org/chromium/chrome/browser/vr_shell/VrTestFramework.java",
"javatests/src/org/chromium/chrome/browser/vr_shell/WebVrDeviceTest.java", "javatests/src/org/chromium/chrome/browser/vr_shell/WebVrDeviceTest.java",
......
...@@ -291,7 +291,8 @@ public class VrShellNavigationTest { ...@@ -291,7 +291,8 @@ public class VrShellNavigationTest {
} }
/** /**
* Tests navigation from a fullscreened WebVR to a WebVR page. * Tests that the back button is disabled in VR if pressing it in regular 2D Chrome would result
* in Chrome being backgrounded.
*/ */
@Test @Test
@MediumTest @MediumTest
......
...@@ -9,7 +9,7 @@ import static org.chromium.chrome.browser.vr_shell.VrTestFramework.POLL_TIMEOUT_ ...@@ -9,7 +9,7 @@ import static org.chromium.chrome.browser.vr_shell.VrTestFramework.POLL_TIMEOUT_
import org.chromium.base.ThreadUtils; import org.chromium.base.ThreadUtils;
import org.chromium.chrome.browser.infobar.InfoBar; import org.chromium.chrome.browser.infobar.InfoBar;
import org.chromium.chrome.browser.vr_shell.VrTestFramework; import org.chromium.chrome.browser.vr_shell.TestFramework;
import org.chromium.chrome.test.util.InfoBarUtil; import org.chromium.chrome.test.util.InfoBarUtil;
import org.chromium.content.browser.test.util.Criteria; import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper; import org.chromium.content.browser.test.util.CriteriaHelper;
...@@ -29,7 +29,7 @@ public class VrInfoBarUtils { ...@@ -29,7 +29,7 @@ public class VrInfoBarUtils {
* @return True if there are any InfoBars present, false otherwise * @return True if there are any InfoBars present, false otherwise
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static boolean isInfoBarPresent(VrTestFramework framework) { public static boolean isInfoBarPresent(TestFramework framework) {
List<InfoBar> infoBars = framework.getRule().getInfoBars(); List<InfoBar> infoBars = framework.getRule().getInfoBars();
return infoBars != null && !infoBars.isEmpty(); return infoBars != null && !infoBars.isEmpty();
} }
...@@ -38,10 +38,10 @@ public class VrInfoBarUtils { ...@@ -38,10 +38,10 @@ public class VrInfoBarUtils {
* Clicks on either the primary or secondary button of the first InfoBar * Clicks on either the primary or secondary button of the first InfoBar
* in the activity. * in the activity.
* @param button Which button to click * @param button Which button to click
* @param framework The VrTestFramework to get the current activity from * @param framework The TestFramework to get the current activity from
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static void clickInfoBarButton(final Button button, VrTestFramework framework) { public static void clickInfoBarButton(final Button button, TestFramework framework) {
if (!isInfoBarPresent(framework)) return; if (!isInfoBarPresent(framework)) return;
final List<InfoBar> infoBars = framework.getRule().getInfoBars(); final List<InfoBar> infoBars = framework.getRule().getInfoBars();
ThreadUtils.runOnUiThreadBlocking(new Runnable() { ThreadUtils.runOnUiThreadBlocking(new Runnable() {
...@@ -61,10 +61,10 @@ public class VrInfoBarUtils { ...@@ -61,10 +61,10 @@ public class VrInfoBarUtils {
/** /**
* Clicks on the close button of the first InfoBar in the activity. * Clicks on the close button of the first InfoBar in the activity.
* @param framework The VrTestFramework to get the current activity from * @param framework The TestFramework to get the current activity from
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static void clickInfobarCloseButton(VrTestFramework framework) { public static void clickInfobarCloseButton(TestFramework framework) {
if (!isInfoBarPresent(framework)) return; if (!isInfoBarPresent(framework)) return;
final List<InfoBar> infoBars = framework.getRule().getInfoBars(); final List<InfoBar> infoBars = framework.getRule().getInfoBars();
ThreadUtils.runOnUiThreadBlocking(new Runnable() { ThreadUtils.runOnUiThreadBlocking(new Runnable() {
...@@ -78,10 +78,10 @@ public class VrInfoBarUtils { ...@@ -78,10 +78,10 @@ public class VrInfoBarUtils {
/** /**
* Determines is there is any InfoBar present in the given View hierarchy. * Determines is there is any InfoBar present in the given View hierarchy.
* @param parentView The View to start the search in * @param framework The TestFramework that will be used to get the current activity/view from
* @param present Whether an InfoBar should be present. * @param present Whether an InfoBar should be present.
*/ */
public static void expectInfoBarPresent(final VrTestFramework framework, boolean present) { public static void expectInfoBarPresent(final TestFramework framework, boolean present) {
CriteriaHelper.pollUiThread(Criteria.equals(present, new Callable<Boolean>() { CriteriaHelper.pollUiThread(Criteria.equals(present, new Callable<Boolean>() {
@Override @Override
public Boolean call() { public Boolean call() {
......
<!doctype html>
<!-- WebVR page to test transitions. -->
<html>
<body>
<input type="checkbox" onclick="setFullscreen(this)" id="fullscreen">Fullscreen
<canvas id="webgl-canvas"></canvas>
<script src="../resources/webxr_e2e.js"></script>
<script src="../resources/webxr_boilerplate.js"></script>
<script src="../resources/navigation_e2e.js"></script>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment