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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 }; 66 };
66 67
67 TEST_F(UiSceneManagerTest, ExitPresentOnAppButtonClick) { 68 TEST_F(UiSceneManagerTest, ExitPresentOnAppButtonClick) {
68 InSequence s; 69 InSequence s;
69 70
70 // Clicking app button should trigger to exit presentation. 71 // Clicking app button should trigger to exit presentation.
71 EXPECT_CALL(*browser_, ExitPresent()).Times(1); 72 EXPECT_CALL(*browser_, ExitPresent()).Times(1);
72 manager_->OnAppButtonClicked(); 73 manager_->OnAppButtonClicked();
73 } 74 }
74 75
76 TEST_F(UiSceneManagerTest, UiUpdatesForFullscreen) {
77 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
78 // Set mode to not fullscreen, everything should be visible.
79 manager_->SetFullscreen(false);
80
81 // Hold onto the background color to make sure it changes.
82 vr::Colorf initialBackground = scene_->GetBackgroundColor();
83
84 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
85 if (element->fill() != vr_shell::Fill::NONE) {
86 EXPECT_TRUE(element->visible());
87 }
88 }
89
90 // Transistion to fullscreen.
91 manager_->SetFullscreen(true);
92
93 // All elements should be hidden except for main content.
94 for (const auto& element : scene_->GetUiElements()) {
95 if (element->fill() == vr_shell::Fill::CONTENT) {
96 EXPECT_TRUE(element->visible());
97 continue;
98 }
99 if (element->fill() != vr_shell::Fill::NONE) {
100 EXPECT_FALSE(element->visible());
101 }
102 }
103 // Make sure background has changed for fullscreen.
104 EXPECT_NE(initialBackground.r, scene_->GetBackgroundColor().r);
105 EXPECT_NE(initialBackground.g, scene_->GetBackgroundColor().g);
106 EXPECT_NE(initialBackground.b, scene_->GetBackgroundColor().b);
107 // Alpha doesn't change
108
109 // Exit fullscreen.
110 manager_->SetFullscreen(false);
111
112 // Everything should return to original state after leaving fullscreen.
113 for (const auto& element : scene_->GetUiElements()) {
114 if (element->fill() != vr_shell::Fill::NONE) {
115 EXPECT_TRUE(element->visible());
116 }
117 }
118 EXPECT_EQ(initialBackground.r, scene_->GetBackgroundColor().r);
cjgrant 2017/05/17 14:40:11 Revisiting the helper method approach here, see gt
119 EXPECT_EQ(initialBackground.g, scene_->GetBackgroundColor().g);
120 EXPECT_EQ(initialBackground.b, scene_->GetBackgroundColor().b);
121 EXPECT_EQ(initialBackground.a, scene_->GetBackgroundColor().a);
122 }
123
75 } // namespace vr_shell 124 } // namespace vr_shell
OLDNEW
« 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