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_elements/ui_element.h" | |
8 #include "chrome/browser/android/vr_shell/ui_scene.h" | 9 #include "chrome/browser/android/vr_shell/ui_scene.h" |
9 #include "chrome/browser/android/vr_shell/vr_browser_interface.h" | 10 #include "chrome/browser/android/vr_shell/vr_browser_interface.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
12 | 13 |
13 using testing::InSequence; | 14 using testing::InSequence; |
14 | 15 |
15 namespace vr_shell { | 16 namespace vr_shell { |
16 | 17 |
17 namespace { | 18 namespace { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 EXPECT_CALL(*browser_, OnContentPaused(true)).Times(1); | 72 EXPECT_CALL(*browser_, OnContentPaused(true)).Times(1); |
72 manager_->OnAppButtonClicked(); | 73 manager_->OnAppButtonClicked(); |
73 EXPECT_FALSE(scene_->GetWebVrRenderingEnabled()); | 74 EXPECT_FALSE(scene_->GetWebVrRenderingEnabled()); |
74 | 75 |
75 // Clicking it again should resume content rendering. | 76 // Clicking it again should resume content rendering. |
76 EXPECT_CALL(*browser_, OnContentPaused(false)).Times(1); | 77 EXPECT_CALL(*browser_, OnContentPaused(false)).Times(1); |
77 manager_->OnAppButtonClicked(); | 78 manager_->OnAppButtonClicked(); |
78 EXPECT_TRUE(scene_->GetWebVrRenderingEnabled()); | 79 EXPECT_TRUE(scene_->GetWebVrRenderingEnabled()); |
79 } | 80 } |
80 | 81 |
82 TEST_F(UiSceneManagerTest, UiUpdatesForFullscreen) { | |
83 InSequence s; | |
cjgrant
2017/05/10 02:45:00
Not needed - it's only required to ensure that moc
amp
2017/05/10 16:05:55
Done.
| |
84 // Set mode to not WebVR, everything should be visible. | |
85 manager_->SetWebVrMode(false); | |
86 | |
87 // Hold onto the background color to make sure it changes. | |
88 vr::Colorf initialBackground = scene_->GetBackgroundColor(); | |
89 | |
90 for (UiElement* element : manager_->browser_ui_elements_) { | |
cjgrant
2017/05/10 02:45:00
browser_ui_elements_ is an internal convenience th
amp
2017/05/10 16:05:55
Thanks for the suggestion. I had tried this at fi
| |
91 EXPECT_TRUE(element->visible()); | |
92 } | |
93 | |
94 manager_->SetFullscreen(true); | |
95 | |
96 // All elements should be hidden except for main content. | |
97 for (UiElement* element : manager_->browser_ui_elements_) { | |
98 if (element == manager_->main_content_) { | |
99 EXPECT_TRUE(element->visible()); | |
100 continue; | |
101 } | |
102 EXPECT_FALSE(element->visible()); | |
103 } | |
104 // Make sure background has changed for fullscreen. | |
105 EXPECT_NE(initialBackground.r, scene_->GetBackgroundColor().r); | |
106 EXPECT_NE(initialBackground.g, scene_->GetBackgroundColor().g); | |
107 EXPECT_NE(initialBackground.b, scene_->GetBackgroundColor().b); | |
108 // Alpha doesn't change | |
109 | |
110 manager_->SetFullscreen(false); | |
111 | |
112 // Everything should return to original state after leaving fullscreen. | |
113 for (UiElement* element : manager_->browser_ui_elements_) { | |
114 EXPECT_TRUE(element->visible()); | |
115 } | |
116 EXPECT_EQ(initialBackground.r, scene_->GetBackgroundColor().r); | |
117 EXPECT_EQ(initialBackground.g, scene_->GetBackgroundColor().g); | |
118 EXPECT_EQ(initialBackground.b, scene_->GetBackgroundColor().b); | |
119 EXPECT_EQ(initialBackground.a, scene_->GetBackgroundColor().a); | |
120 } | |
121 | |
81 } // namespace vr_shell | 122 } // namespace vr_shell |
OLD | NEW |