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

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

Issue 2887773008: Update fullscreen ux, make floor and ceiling visible. (Closed)
Patch Set: adjust tests to fail if a new added element becomes visible at some future point 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 | « chrome/browser/android/vr_shell/ui_scene_manager.cc ('k') | 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 6f350a879827c5a1296d0a16c81e87fc5d4128aa..e88d601f3b3f548d84ec74ea7644e271e390edbb 100644
--- a/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc
+++ b/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc
@@ -84,6 +84,11 @@ class UiSceneManagerTest : public testing::Test {
std::unique_ptr<MockBrowserInterface> browser_;
std::unique_ptr<UiScene> scene_;
std::unique_ptr<UiSceneManager> manager_;
+
+ bool ColorEquals(vr::Colorf expected, vr::Colorf actual) {
+ return (expected.r == actual.r) && (expected.g == actual.g) &&
+ (expected.b == actual.b) && (expected.a == actual.a);
+ }
};
TEST_F(UiSceneManagerTest, ExitPresentAndFullscreenOnAppButtonClick) {
@@ -139,4 +144,60 @@ TEST_F(UiSceneManagerTest, CctButtonVisibleInCct) {
EXPECT_TRUE(IsVisible(kCloseButton));
}
+TEST_F(UiSceneManagerTest, UiUpdatesForFullscreenChanges) {
+ std::set<UiElementDebugId> visible_in_browsing = {
+ UiElementDebugId::kContentQuad, UiElementDebugId::kBackplane,
+ UiElementDebugId::kCeiling, UiElementDebugId::kFloor,
+ UiElementDebugId::kFloorGrid, UiElementDebugId::kUrlBar,
+ UiElementDebugId::kLoadingIndicator};
+ std::set<UiElementDebugId> visible_in_fullscreen = {
+ UiElementDebugId::kContentQuad, UiElementDebugId::kBackplane,
+ UiElementDebugId::kCeiling, UiElementDebugId::kFloor,
+ UiElementDebugId::kFloorGrid};
+
+ MakeManager(kNotInCct, kNotInWebVr);
+
+ // Hold onto the background color to make sure it changes.
+ vr::Colorf initial_background = scene_->GetBackgroundColor();
+
+ for (const auto& element : scene_->GetUiElements()) {
+ SCOPED_TRACE(element->debug_id());
+ bool should_be_visible = visible_in_browsing.find(element->debug_id()) !=
+ visible_in_browsing.end();
+ EXPECT_EQ(should_be_visible, element->visible());
+ }
+
+ // Transistion to fullscreen.
+ manager_->SetFullscreen(true);
+
+ // Content elements should be visible, control elements should be hidden.
+ for (const auto& element : scene_->GetUiElements()) {
+ SCOPED_TRACE(element->debug_id());
+ bool should_be_visible = visible_in_fullscreen.find(element->debug_id()) !=
+ visible_in_fullscreen.end();
+ EXPECT_EQ(should_be_visible, element->visible());
+ }
+
+ {
+ SCOPED_TRACE("Entered Fullsceen");
+ // Make sure background has changed for fullscreen.
+ EXPECT_FALSE(ColorEquals(initial_background, scene_->GetBackgroundColor()));
+ }
+
+ // Exit fullscreen.
+ manager_->SetFullscreen(false);
+
+ // Everything should return to original state after leaving fullscreen.
+ for (const auto& element : scene_->GetUiElements()) {
+ SCOPED_TRACE(element->debug_id());
+ bool should_be_visible = visible_in_browsing.find(element->debug_id()) !=
+ visible_in_browsing.end();
+ EXPECT_EQ(should_be_visible, element->visible());
+ }
+ {
+ SCOPED_TRACE("Exited Fullsceen");
+ EXPECT_TRUE(ColorEquals(initial_background, scene_->GetBackgroundColor()));
+ }
+}
+
} // namespace vr_shell
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698