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

Side by Side Diff: chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc

Issue 2874103003: Revert of App button click exits WebVR presentation. (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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 10 matching lines...) Expand all
21 MockBrowserInterface() {} 21 MockBrowserInterface() {}
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());
32 MOCK_METHOD2( 31 MOCK_METHOD2(
33 RunVRDisplayInfoCallback, 32 RunVRDisplayInfoCallback,
34 void(const base::Callback<void(device::mojom::VRDisplayInfoPtr)>&, 33 void(const base::Callback<void(device::mojom::VRDisplayInfoPtr)>&,
35 device::mojom::VRDisplayInfoPtr*)); 34 device::mojom::VRDisplayInfoPtr*));
36 MOCK_METHOD1(OnContentPaused, void(bool)); 35 MOCK_METHOD1(OnContentPaused, void(bool));
37 MOCK_METHOD0(NavigateBack, void()); 36 MOCK_METHOD0(NavigateBack, void());
38 37
39 // Stub this as scoped pointers don't work as mock method parameters. 38 // Stub this as scoped pointers don't work as mock method parameters.
40 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent>) {} 39 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent>) {}
41 40
(...skipping 15 matching lines...) Expand all
57 manager_ = base::MakeUnique<UiSceneManager>(browser_.get(), scene_.get(), 56 manager_ = base::MakeUnique<UiSceneManager>(browser_.get(), scene_.get(),
58 in_cct, in_web_vr); 57 in_cct, in_web_vr);
59 } 58 }
60 59
61 protected: 60 protected:
62 std::unique_ptr<MockBrowserInterface> browser_; 61 std::unique_ptr<MockBrowserInterface> browser_;
63 std::unique_ptr<UiScene> scene_; 62 std::unique_ptr<UiScene> scene_;
64 std::unique_ptr<UiSceneManager> manager_; 63 std::unique_ptr<UiSceneManager> manager_;
65 }; 64 };
66 65
67 TEST_F(UiSceneManagerTest, ExitPresentOnAppButtonClick) { 66 TEST_F(UiSceneManagerTest, ContentPausesOnAppButtonClick) {
68 InSequence s; 67 InSequence s;
69 68
70 // Clicking app button should trigger to exit presentation. 69 EXPECT_TRUE(scene_->GetWebVrRenderingEnabled());
71 EXPECT_CALL(*browser_, ExitPresent()).Times(1); 70
71 // Clicking app button once should pause content rendering.
72 EXPECT_CALL(*browser_, OnContentPaused(true)).Times(1);
72 manager_->OnAppButtonClicked(); 73 manager_->OnAppButtonClicked();
74 EXPECT_FALSE(scene_->GetWebVrRenderingEnabled());
75
76 // Clicking it again should resume content rendering.
77 EXPECT_CALL(*browser_, OnContentPaused(false)).Times(1);
78 manager_->OnAppButtonClicked();
79 EXPECT_TRUE(scene_->GetWebVrRenderingEnabled());
73 } 80 }
74 81
75 } // namespace vr_shell 82 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene_manager.cc ('k') | chrome/browser/android/vr_shell/vr_browser_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698