Index: chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc |
diff --git a/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc b/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc |
index b7b840f62fc7a3ec23cca1bd5751d0b6b8e3a7ec..5782c63bc661f663060a4e02d07e7b11a5b2c893 100644 |
--- a/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc |
+++ b/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc |
@@ -5,6 +5,7 @@ |
#include "chrome/browser/android/vr_shell/ui_scene_manager.h" |
#include "base/macros.h" |
+#include "chrome/browser/android/vr_shell/ui_elements/ui_element.h" |
#include "chrome/browser/android/vr_shell/ui_scene.h" |
#include "chrome/browser/android/vr_shell/vr_browser_interface.h" |
#include "testing/gmock/include/gmock/gmock.h" |
@@ -78,4 +79,44 @@ TEST_F(UiSceneManagerTest, ContentPausesOnAppButtonClick) { |
EXPECT_TRUE(scene_->GetWebVrRenderingEnabled()); |
} |
+TEST_F(UiSceneManagerTest, UiUpdatesForFullscreen) { |
+ 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.
|
+ // Set mode to not WebVR, everything should be visible. |
+ manager_->SetWebVrMode(false); |
+ |
+ // Hold onto the background color to make sure it changes. |
+ vr::Colorf initialBackground = scene_->GetBackgroundColor(); |
+ |
+ 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
|
+ EXPECT_TRUE(element->visible()); |
+ } |
+ |
+ manager_->SetFullscreen(true); |
+ |
+ // All elements should be hidden except for main content. |
+ for (UiElement* element : manager_->browser_ui_elements_) { |
+ if (element == manager_->main_content_) { |
+ EXPECT_TRUE(element->visible()); |
+ continue; |
+ } |
+ EXPECT_FALSE(element->visible()); |
+ } |
+ // Make sure background has changed for fullscreen. |
+ EXPECT_NE(initialBackground.r, scene_->GetBackgroundColor().r); |
+ EXPECT_NE(initialBackground.g, scene_->GetBackgroundColor().g); |
+ EXPECT_NE(initialBackground.b, scene_->GetBackgroundColor().b); |
+ // Alpha doesn't change |
+ |
+ manager_->SetFullscreen(false); |
+ |
+ // Everything should return to original state after leaving fullscreen. |
+ for (UiElement* element : manager_->browser_ui_elements_) { |
+ EXPECT_TRUE(element->visible()); |
+ } |
+ EXPECT_EQ(initialBackground.r, scene_->GetBackgroundColor().r); |
+ EXPECT_EQ(initialBackground.g, scene_->GetBackgroundColor().g); |
+ EXPECT_EQ(initialBackground.b, scene_->GetBackgroundColor().b); |
+ EXPECT_EQ(initialBackground.a, scene_->GetBackgroundColor().a); |
+} |
+ |
} // namespace vr_shell |