| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/android/vr_shell/ui_scene_manager.h" | 5 #include "chrome/browser/android/vr_shell/ui_scene_manager.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "chrome/browser/android/vr_shell/ui_scene.h" | 8 #include "chrome/browser/android/vr_shell/ui_scene.h" |
| 9 #include "chrome/browser/android/vr_shell/vr_browser_interface.h" | 9 #include "chrome/browser/android/vr_shell/vr_browser_interface.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 ~MockBrowserInterface() override {} | 22 ~MockBrowserInterface() override {} |
| 23 | 23 |
| 24 MOCK_METHOD1(ContentSurfaceChanged, void(jobject)); | 24 MOCK_METHOD1(ContentSurfaceChanged, void(jobject)); |
| 25 MOCK_METHOD0(GvrDelegateReady, void()); | 25 MOCK_METHOD0(GvrDelegateReady, void()); |
| 26 MOCK_METHOD1(UpdateGamepadData, void(device::GvrGamepadData)); | 26 MOCK_METHOD1(UpdateGamepadData, void(device::GvrGamepadData)); |
| 27 MOCK_METHOD1(AppButtonGesturePerformed, void(UiInterface::Direction)); | 27 MOCK_METHOD1(AppButtonGesturePerformed, void(UiInterface::Direction)); |
| 28 | 28 |
| 29 MOCK_METHOD0(AppButtonClicked, void()); | 29 MOCK_METHOD0(AppButtonClicked, void()); |
| 30 MOCK_METHOD0(ForceExitVr, void()); | 30 MOCK_METHOD0(ForceExitVr, void()); |
| 31 MOCK_METHOD0(ExitPresent, void()); | 31 MOCK_METHOD0(ExitPresent, void()); |
| 32 MOCK_METHOD0(ExitFullscreen, void()); |
| 32 MOCK_METHOD2( | 33 MOCK_METHOD2( |
| 33 RunVRDisplayInfoCallback, | 34 RunVRDisplayInfoCallback, |
| 34 void(const base::Callback<void(device::mojom::VRDisplayInfoPtr)>&, | 35 void(const base::Callback<void(device::mojom::VRDisplayInfoPtr)>&, |
| 35 device::mojom::VRDisplayInfoPtr*)); | 36 device::mojom::VRDisplayInfoPtr*)); |
| 36 MOCK_METHOD1(OnContentPaused, void(bool)); | 37 MOCK_METHOD1(OnContentPaused, void(bool)); |
| 37 MOCK_METHOD0(NavigateBack, void()); | 38 MOCK_METHOD0(NavigateBack, void()); |
| 38 | 39 |
| 39 // Stub this as scoped pointers don't work as mock method parameters. | 40 // Stub this as scoped pointers don't work as mock method parameters. |
| 40 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent>) {} | 41 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent>) {} |
| 41 | 42 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 57 manager_ = base::MakeUnique<UiSceneManager>(browser_.get(), scene_.get(), | 58 manager_ = base::MakeUnique<UiSceneManager>(browser_.get(), scene_.get(), |
| 58 in_cct, in_web_vr); | 59 in_cct, in_web_vr); |
| 59 } | 60 } |
| 60 | 61 |
| 61 protected: | 62 protected: |
| 62 std::unique_ptr<MockBrowserInterface> browser_; | 63 std::unique_ptr<MockBrowserInterface> browser_; |
| 63 std::unique_ptr<UiScene> scene_; | 64 std::unique_ptr<UiScene> scene_; |
| 64 std::unique_ptr<UiSceneManager> manager_; | 65 std::unique_ptr<UiSceneManager> manager_; |
| 65 }; | 66 }; |
| 66 | 67 |
| 67 TEST_F(UiSceneManagerTest, ExitPresentOnAppButtonClick) { | 68 TEST_F(UiSceneManagerTest, ExitPresentAndFullscreenOnAppButtonClick) { |
| 68 InSequence s; | |
| 69 | |
| 70 // Clicking app button should trigger to exit presentation. | 69 // Clicking app button should trigger to exit presentation. |
| 71 EXPECT_CALL(*browser_, ExitPresent()).Times(1); | 70 EXPECT_CALL(*browser_, ExitPresent()).Times(1); |
| 71 // And also trigger exit fullscreen. |
| 72 EXPECT_CALL(*browser_, ExitFullscreen()).Times(1); |
| 72 manager_->OnAppButtonClicked(); | 73 manager_->OnAppButtonClicked(); |
| 73 } | 74 } |
| 74 | 75 |
| 75 } // namespace vr_shell | 76 } // namespace vr_shell |
| OLD | NEW |