blob: 4b047e933726b4e9875267fd5147f8b363862eb5 [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/vr/test/vr_browser_test.h"
#include "chrome/browser/vr/test/vr_transition_utils.h"
#include "content/public/test/browser_test_utils.h"
// Browser test equivalent of
// chrome/android/javatests/src/.../browser/vr_shell/WebVrTransitionTest.java.
// End-to-end tests for transitioning between WebVR's magic window and
// presentation modes.
namespace vr {
// Tests that a successful requestPresent call actually enters VR.
IN_PROC_BROWSER_TEST_F(VrBrowserTest,
REQUIRES_GPU(TestRequestPresentEntersVr)) {
LoadUrlAndAwaitInitialization(
GetHtmlTestFile("test_requestPresent_enters_vr"));
EnterPresentationAndWait(GetFirstTabWebContents());
EXPECT_TRUE(RunJavaScriptAndExtractBoolOrFail("vrDisplay.isPresenting",
GetFirstTabWebContents()))
<< "Was not presenting after requestPresent";
EndTest(GetFirstTabWebContents());
}
// Tests that window.requestAnimationFrame continues to fire while in WebVR
// presentation since the tab is still visible.
IN_PROC_BROWSER_TEST_F(VrBrowserTest,
REQUIRES_GPU(TestWindowRafFiresWhilePresenting)) {
LoadUrlAndAwaitInitialization(
GetHtmlTestFile("test_window_raf_fires_while_presenting"));
ExecuteStepAndWait("stepVerifyBeforePresent()", GetFirstTabWebContents());
EnterPresentationOrFail(GetFirstTabWebContents());
ExecuteStepAndWait("stepVerifyDuringPresent()", GetFirstTabWebContents());
ExitPresentationOrFail(GetFirstTabWebContents());
ExecuteStepAndWait("stepVerifyAfterPresent()", GetFirstTabWebContents());
EndTest(GetFirstTabWebContents());
}
} // namespace vr