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

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

Issue 2768583002: Make VR screen tap tests more stable (Closed)
Patch Set: Change assert description 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/WebVrTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/WebVrTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/WebVrTest.java
index 04bb75a72477136a9415c69d4736545e4efe5d5a..d83de5972660c4a56417e7e4f6f2f70ad97255cd 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/WebVrTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/WebVrTest.java
@@ -12,6 +12,8 @@ import static org.chromium.chrome.test.util.ChromeRestriction.RESTRICTION_TYPE_V
import static org.chromium.chrome.test.util.ChromeRestriction.RESTRICTION_TYPE_VIEWER_NON_DAYDREAM;
import static org.chromium.chrome.test.util.ChromeRestriction.RESTRICTION_TYPE_WEBVR_SUPPORTED;
+import android.support.test.filters.LargeTest;
+import android.support.test.filters.MediumTest;
import android.support.test.filters.SmallTest;
import org.chromium.base.Log;
@@ -26,6 +28,7 @@ import org.chromium.content.browser.test.util.JavaScriptUtils;
import org.chromium.content_public.browser.WebContents;
import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@@ -252,7 +255,7 @@ public class WebVrTest extends ChromeTabbedActivityTestBase {
* Tests that screen touches are not registered when the viewer is a
* Daydream View.
*/
- @SmallTest
+ @LargeTest
@Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM)
public void testScreenTapsNotRegisteredOnDaydream() throws InterruptedException {
String testName = "test_screen_taps_not_registered_on_daydream";
@@ -260,7 +263,18 @@ public class WebVrTest extends ChromeTabbedActivityTestBase {
assertTrue("VRDisplay found", vrDisplayFound(mWebContents));
executeStepAndWait("stepVerifyNoInitialTaps()", mWebContents);
enterVrTapAndWait(mWebContents);
+ // Wait on VrShellImpl to say that its parent consumed the touch event
+ // Set to 2 because there's an ACTION_DOWN followed by ACTION_UP
+ final CountDownLatch touchRegisteredLatch = new CountDownLatch(2);
+ ((VrShellImpl) VrShellDelegate.getVrShellForTesting())
+ .setOnDispatchTouchEventForTesting(new Runnable() {
+ @Override
+ public void run() {
+ touchRegisteredLatch.countDown();
+ }
+ });
enterVrTap();
+ touchRegisteredLatch.await();
mthiesse 2017/03/28 18:08:01 What's the timeout on this? Will it wait forever i
bsheedy 2017/03/28 20:50:35 Done, and made the await() have a one second timeo
executeStepAndWait("stepVerifyNoAdditionalTaps()", mWebContents);
endTest(mWebContents);
}
@@ -269,16 +283,17 @@ public class WebVrTest extends ChromeTabbedActivityTestBase {
* Tests that screen touches are still registered when the viewer is
* Cardboard.
*/
- @SmallTest
+ @MediumTest
@Restriction(RESTRICTION_TYPE_VIEWER_NON_DAYDREAM)
public void testScreenTapsRegisteredOnCardboard() throws InterruptedException {
String testName = "test_screen_taps_registered_on_cardboard";
loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S);
assertTrue("VRDisplay found", vrDisplayFound(mWebContents));
executeStepAndWait("stepVerifyNoInitialTaps()", mWebContents);
+ // Tap and wait to enter VR
+ enterVrTapAndWait(mWebContents);
+ // Tap and wait for Javascript to receive it
enterVrTapAndWait(mWebContents);
- enterVrTap();
- executeStepAndWait("stepVerifyAdditionalTap()", mWebContents);
endTest(mWebContents);
}

Powered by Google App Engine
This is Rietveld 408576698