Commit eb33eca2 authored by Michael Thiessen's avatar Michael Thiessen Committed by Commit Bot

VR: Make sure VR is fully entered before proceeding in tests.

Bug: 746504
Change-Id: Ia7296889916aac759edfef72c34beb01770d79ca
Reviewed-on: https://chromium-review.googlesource.com/581851Reviewed-by: default avatarYash Malik <ymalik@chromium.org>
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488757}
parent 4fc42357
......@@ -538,15 +538,15 @@ public class VrShellDelegate
public void doFrame(long frameTimeNanos) {
if (mNativeVrShellDelegate == 0) return;
Choreographer.getInstance().postFrameCallback(this);
++mVSyncCount;
if (mVSyncTimebaseNanos == 0) {
updateVSyncInterval(frameTimeNanos, mVSyncIntervalNanos);
return;
}
if (mVSyncCount < MIN_FRAME_COUNT) return;
++mVSyncCount;
long elapsed = frameTimeNanos - mVSyncTimebaseNanos;
// If you're hitting the assert below, you probably added the callback twice.
assert elapsed != 0;
if (mVSyncCount < MIN_FRAME_COUNT) return;
long vSyncIntervalNanos = elapsed / mVSyncCount;
if (vSyncIntervalNanos < mMinVSyncIntervalNanos) {
// We may run slow, but we should never run fast. If the VSync interval is too
......@@ -1587,6 +1587,11 @@ public class VrShellDelegate
return nativeIsClearActivatePending(mNativeVrShellDelegate);
}
@VisibleForTesting
public boolean isVrEntryComplete() {
return mInVr && !mProbablyInDon;
}
/**
* @return Pointer to the native VrShellDelegate object.
*/
......
......@@ -67,7 +67,7 @@ public class VrTransitionUtils {
CriteriaHelper.pollUiThread(Criteria.equals(true, new Callable<Boolean>() {
@Override
public Boolean call() {
return VrShellDelegate.isInVr();
return VrShellDelegate.getInstanceForTesting().isVrEntryComplete();
}
}), timeout, POLL_CHECK_INTERVAL_SHORT_MS);
}
......@@ -111,8 +111,8 @@ public class VrTransitionUtils {
*/
public static void enterPresentationOrFail(ContentViewCore cvc) {
enterPresentation(cvc);
VrTestRule.pollJavaScriptBoolean(
"vrDisplay.isPresenting", POLL_TIMEOUT_LONG_MS, cvc.getWebContents());
Assert.assertTrue(VrTestRule.pollJavaScriptBoolean(
"vrDisplay.isPresenting", POLL_TIMEOUT_LONG_MS, cvc.getWebContents()));
Assert.assertTrue(VrShellDelegate.getVrShellForTesting().getWebVrModeEnabled());
}
......
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