| 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 16 matching lines...) Expand all Loading... |
| 27 DISALLOW_COPY_AND_ASSIGN(MockBrowserInterface); | 27 DISALLOW_COPY_AND_ASSIGN(MockBrowserInterface); |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 class UiSceneManagerTest : public testing::Test { | 32 class UiSceneManagerTest : public testing::Test { |
| 33 public: | 33 public: |
| 34 void SetUp() override { | 34 void SetUp() override { |
| 35 browser_ = base::MakeUnique<MockBrowserInterface>(); | 35 browser_ = base::MakeUnique<MockBrowserInterface>(); |
| 36 scene_ = base::MakeUnique<UiScene>(); | 36 scene_ = base::MakeUnique<UiScene>(); |
| 37 manager_ = base::MakeUnique<UiSceneManager>(browser_.get(), scene_.get()); | 37 // TODO(mthiesse): When we have UI to test for CCT, we'll need to modify |
| 38 // setup to allow us to test CCT mode. |
| 39 bool in_cct = false; |
| 40 manager_ = |
| 41 base::MakeUnique<UiSceneManager>(browser_.get(), scene_.get(), in_cct); |
| 38 } | 42 } |
| 39 | 43 |
| 40 protected: | 44 protected: |
| 41 std::unique_ptr<MockBrowserInterface> browser_; | 45 std::unique_ptr<MockBrowserInterface> browser_; |
| 42 std::unique_ptr<UiScene> scene_; | 46 std::unique_ptr<UiScene> scene_; |
| 43 std::unique_ptr<UiSceneManager> manager_; | 47 std::unique_ptr<UiSceneManager> manager_; |
| 44 }; | 48 }; |
| 45 | 49 |
| 46 TEST_F(UiSceneManagerTest, ContentPausesOnAppButtonClick) { | 50 TEST_F(UiSceneManagerTest, ContentPausesOnAppButtonClick) { |
| 47 InSequence s; | 51 InSequence s; |
| 48 | 52 |
| 49 EXPECT_TRUE(scene_->GetWebVrRenderingEnabled()); | 53 EXPECT_TRUE(scene_->GetWebVrRenderingEnabled()); |
| 50 | 54 |
| 51 // Clicking app button once should pause content rendering. | 55 // Clicking app button once should pause content rendering. |
| 52 EXPECT_CALL(*browser_, OnContentPaused(true)).Times(1); | 56 EXPECT_CALL(*browser_, OnContentPaused(true)).Times(1); |
| 53 manager_->OnAppButtonClicked(); | 57 manager_->OnAppButtonClicked(); |
| 54 EXPECT_FALSE(scene_->GetWebVrRenderingEnabled()); | 58 EXPECT_FALSE(scene_->GetWebVrRenderingEnabled()); |
| 55 | 59 |
| 56 // Clicking it again should resume content rendering. | 60 // Clicking it again should resume content rendering. |
| 57 EXPECT_CALL(*browser_, OnContentPaused(false)).Times(1); | 61 EXPECT_CALL(*browser_, OnContentPaused(false)).Times(1); |
| 58 manager_->OnAppButtonClicked(); | 62 manager_->OnAppButtonClicked(); |
| 59 EXPECT_TRUE(scene_->GetWebVrRenderingEnabled()); | 63 EXPECT_TRUE(scene_->GetWebVrRenderingEnabled()); |
| 60 } | 64 } |
| 61 | 65 |
| 62 } // namespace vr_shell | 66 } // namespace vr_shell |
| OLD | NEW |