| 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 "base/memory/ptr_util.h" |
| 8 #include "base/test/scoped_task_environment.h" | 9 #include "base/test/scoped_task_environment.h" |
| 10 #include "chrome/browser/android/vr_shell/ui_browser_interface.h" |
| 9 #include "chrome/browser/android/vr_shell/ui_elements/ui_element.h" | 11 #include "chrome/browser/android/vr_shell/ui_elements/ui_element.h" |
| 10 #include "chrome/browser/android/vr_shell/ui_elements/ui_element_debug_id.h" | 12 #include "chrome/browser/android/vr_shell/ui_elements/ui_element_debug_id.h" |
| 11 #include "chrome/browser/android/vr_shell/ui_scene.h" | 13 #include "chrome/browser/android/vr_shell/ui_scene.h" |
| 12 #include "chrome/browser/android/vr_shell/vr_browser_interface.h" | |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 16 |
| 16 using testing::InSequence; | 17 using testing::InSequence; |
| 17 | 18 |
| 18 namespace vr_shell { | 19 namespace vr_shell { |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 class MockBrowserInterface : public VrBrowserInterface { | 23 class MockBrowserInterface : public UiBrowserInterface { |
| 23 public: | 24 public: |
| 24 MockBrowserInterface() {} | 25 MockBrowserInterface() {} |
| 25 ~MockBrowserInterface() override {} | 26 ~MockBrowserInterface() override {} |
| 26 | 27 |
| 27 MOCK_METHOD1(ContentSurfaceChanged, void(jobject)); | |
| 28 MOCK_METHOD0(GvrDelegateReady, void()); | |
| 29 MOCK_METHOD1(UpdateGamepadData, void(device::GvrGamepadData)); | |
| 30 MOCK_METHOD1(AppButtonGesturePerformed, void(UiInterface::Direction)); | |
| 31 | |
| 32 MOCK_METHOD0(AppButtonClicked, void()); | |
| 33 MOCK_METHOD0(ForceExitVr, void()); | |
| 34 MOCK_METHOD0(ExitPresent, void()); | 28 MOCK_METHOD0(ExitPresent, void()); |
| 35 MOCK_METHOD0(ExitFullscreen, void()); | 29 MOCK_METHOD0(ExitFullscreen, void()); |
| 36 MOCK_METHOD2( | |
| 37 RunVRDisplayInfoCallback, | |
| 38 void(const base::Callback<void(device::mojom::VRDisplayInfoPtr)>&, | |
| 39 device::mojom::VRDisplayInfoPtr*)); | |
| 40 MOCK_METHOD1(OnContentPaused, void(bool)); | |
| 41 MOCK_METHOD0(NavigateBack, void()); | 30 MOCK_METHOD0(NavigateBack, void()); |
| 42 MOCK_METHOD1(SetVideoCapturingIndicator, void(bool)); | |
| 43 MOCK_METHOD1(SetScreenCapturingIndicator, void(bool)); | |
| 44 MOCK_METHOD1(SetAudioCapturingIndicator, void(bool)); | |
| 45 MOCK_METHOD0(ExitCct, void()); | 31 MOCK_METHOD0(ExitCct, void()); |
| 46 MOCK_METHOD1(ToggleCardboardGamepad, void(bool)); | 32 MOCK_METHOD1(OnUnsupportedMode, void(UiUnsupportedMode mode)); |
| 47 MOCK_METHOD1(OnUnsupportedMode, void(UiUnsupportedMode)); | |
| 48 | |
| 49 // Stub this as scoped pointers don't work as mock method parameters. | |
| 50 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent>) {} | |
| 51 | 33 |
| 52 private: | 34 private: |
| 53 DISALLOW_COPY_AND_ASSIGN(MockBrowserInterface); | 35 DISALLOW_COPY_AND_ASSIGN(MockBrowserInterface); |
| 54 }; | 36 }; |
| 55 | 37 |
| 56 } // namespace | 38 } // namespace |
| 57 | 39 |
| 58 class UiSceneManagerTest : public testing::Test { | 40 class UiSceneManagerTest : public testing::Test { |
| 59 public: | 41 public: |
| 60 void SetUp() override { browser_ = base::MakeUnique<MockBrowserInterface>(); } | 42 void SetUp() override { browser_ = base::MakeUnique<MockBrowserInterface>(); } |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 | 289 |
| 308 manager_->SetAudioCapturingIndicator(false); | 290 manager_->SetAudioCapturingIndicator(false); |
| 309 manager_->SetVideoCapturingIndicator(false); | 291 manager_->SetVideoCapturingIndicator(false); |
| 310 manager_->SetScreenCapturingIndicator(false); | 292 manager_->SetScreenCapturingIndicator(false); |
| 311 | 293 |
| 312 EXPECT_FALSE(IsVisible(kAudioCaptureIndicator)); | 294 EXPECT_FALSE(IsVisible(kAudioCaptureIndicator)); |
| 313 EXPECT_FALSE(IsVisible(kVideoCaptureIndicator)); | 295 EXPECT_FALSE(IsVisible(kVideoCaptureIndicator)); |
| 314 EXPECT_FALSE(IsVisible(kScreenCaptureIndicator)); | 296 EXPECT_FALSE(IsVisible(kScreenCaptureIndicator)); |
| 315 } | 297 } |
| 316 } // namespace vr_shell | 298 } // namespace vr_shell |
| OLD | NEW |