Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(780)

Unified Diff: chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc

Issue 2873043002: VrShell: Add test for fullscreen transitions. (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698