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 f803c835f69dbfef66b239321cbe090b9b8c975b..6fe133bc498eaf3cf17a56a91ab1fbaf09503b55 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" |
@@ -72,4 +73,52 @@ TEST_F(UiSceneManagerTest, ExitPresentOnAppButtonClick) { |
manager_->OnAppButtonClicked(); |
} |
+TEST_F(UiSceneManagerTest, UiUpdatesForFullscreen) { |
+ InSequence s; |
cjgrant
2017/05/10 18:50:22
I think you said removing this was Done. :)
amp
2017/05/10 21:43:43
Oops, must of slipped through the cracks as I was
|
+ // Set mode to not fullscreen, everything should be visible. |
+ manager_->SetFullscreen(false); |
+ |
+ // Hold onto the background color to make sure it changes. |
+ vr::Colorf initialBackground = scene_->GetBackgroundColor(); |
+ |
+ for (const auto& element : scene_->GetUiElements()) { |
cjgrant
2017/05/10 18:50:22
Thinking about this more. This should be tripping
amp
2017/05/10 21:43:43
Per offline discussion I'll go with something like
|
+ if (element->fill() != vr_shell::Fill::NONE) { |
+ EXPECT_TRUE(element->visible()); |
+ } |
+ } |
+ |
+ // Transistion to fullscreen. |
+ manager_->SetFullscreen(true); |
+ |
+ // All elements should be hidden except for main content. |
+ for (const auto& element : scene_->GetUiElements()) { |
+ if (element->fill() == vr_shell::Fill::CONTENT) { |
+ EXPECT_TRUE(element->visible()); |
+ continue; |
+ } |
+ if (element->fill() != vr_shell::Fill::NONE) { |
+ 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 |
+ |
+ // Exit fullscreen. |
+ manager_->SetFullscreen(false); |
+ |
+ // Everything should return to original state after leaving fullscreen. |
+ for (const auto& element : scene_->GetUiElements()) { |
+ if (element->fill() != vr_shell::Fill::NONE) { |
+ EXPECT_TRUE(element->visible()); |
+ } |
+ } |
+ EXPECT_EQ(initialBackground.r, scene_->GetBackgroundColor().r); |
cjgrant
2017/05/17 14:40:11
Revisiting the helper method approach here, see gt
|
+ EXPECT_EQ(initialBackground.g, scene_->GetBackgroundColor().g); |
+ EXPECT_EQ(initialBackground.b, scene_->GetBackgroundColor().b); |
+ EXPECT_EQ(initialBackground.a, scene_->GetBackgroundColor().a); |
+} |
+ |
} // namespace vr_shell |