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

Side by Side Diff: chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc

Issue 2911943002: [vr] Add incognito coloring (Closed)
Patch Set: Created 3 years, 6 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
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 "base/test/scoped_task_environment.h" 8 #include "base/test/scoped_task_environment.h"
9 #include "chrome/browser/android/vr_shell/ui_elements/ui_element.h" 9 #include "chrome/browser/android/vr_shell/ui_elements/ui_element.h"
10 #include "chrome/browser/android/vr_shell/ui_elements/ui_element_debug_id.h" 10 #include "chrome/browser/android/vr_shell/ui_elements/ui_element_debug_id.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 MakeManager(kNotInCct, kNotInWebVr); 134 MakeManager(kNotInCct, kNotInWebVr);
135 EXPECT_FALSE(IsVisible(kCloseButton)); 135 EXPECT_FALSE(IsVisible(kCloseButton));
136 136
137 MakeManager(kInCct, kInWebVr); 137 MakeManager(kInCct, kInWebVr);
138 EXPECT_FALSE(IsVisible(kCloseButton)); 138 EXPECT_FALSE(IsVisible(kCloseButton));
139 manager_->SetWebVrMode(false); 139 manager_->SetWebVrMode(false);
140 EXPECT_TRUE(IsVisible(kCloseButton)); 140 EXPECT_TRUE(IsVisible(kCloseButton));
141 } 141 }
142 142
143 TEST_F(UiSceneManagerTest, UiUpdatesForIncognito) {
144 MakeManager(kNotInCct, kNotInWebVr);
145
146 // Hold onto the background color to make sure it changes.
147 SkColor initial_background = scene_->GetBackgroundColor();
148 manager_->SetFullscreen(true);
149
150 {
151 SCOPED_TRACE("Entered Fullsceen");
152 // Make sure background has changed for fullscreen.
153 EXPECT_NE(initial_background, scene_->GetBackgroundColor());
154 }
155
156 SkColor fullscreen_background = scene_->GetBackgroundColor();
157
158 manager_->SetIncognito(true);
159
160 {
161 SCOPED_TRACE("Entered Incognito");
162 // Make sure background has changed for incognito.
163 EXPECT_NE(fullscreen_background, scene_->GetBackgroundColor());
164 EXPECT_NE(initial_background, scene_->GetBackgroundColor());
165 }
166
167 SkColor incognito_background = scene_->GetBackgroundColor();
168
169 manager_->SetIncognito(false);
170
171 {
172 SCOPED_TRACE("Exited Incognito");
173 EXPECT_EQ(fullscreen_background, scene_->GetBackgroundColor());
174 }
175
176 manager_->SetFullscreen(false);
177
178 {
179 SCOPED_TRACE("Exited Fullsceen");
180 EXPECT_EQ(initial_background, scene_->GetBackgroundColor());
181 }
182
183 manager_->SetIncognito(true);
184
185 {
186 SCOPED_TRACE("Entered Incognito");
187 EXPECT_EQ(incognito_background, scene_->GetBackgroundColor());
188 }
189
190 manager_->SetIncognito(false);
191
192 {
193 SCOPED_TRACE("Exited Incognito");
194 EXPECT_EQ(initial_background, scene_->GetBackgroundColor());
195 }
196 }
197
143 TEST_F(UiSceneManagerTest, UiUpdatesForFullscreenChanges) { 198 TEST_F(UiSceneManagerTest, UiUpdatesForFullscreenChanges) {
144 std::set<UiElementDebugId> visible_in_browsing = { 199 std::set<UiElementDebugId> visible_in_browsing = {
145 UiElementDebugId::kContentQuad, UiElementDebugId::kBackplane, 200 UiElementDebugId::kContentQuad, UiElementDebugId::kBackplane,
146 UiElementDebugId::kCeiling, UiElementDebugId::kFloor, 201 UiElementDebugId::kCeiling, UiElementDebugId::kFloor,
147 UiElementDebugId::kFloorGrid, UiElementDebugId::kUrlBar, 202 UiElementDebugId::kFloorGrid, UiElementDebugId::kUrlBar,
148 UiElementDebugId::kLoadingIndicator}; 203 UiElementDebugId::kLoadingIndicator};
149 std::set<UiElementDebugId> visible_in_fullscreen = { 204 std::set<UiElementDebugId> visible_in_fullscreen = {
150 UiElementDebugId::kContentQuad, UiElementDebugId::kBackplane, 205 UiElementDebugId::kContentQuad, UiElementDebugId::kBackplane,
151 UiElementDebugId::kCeiling, UiElementDebugId::kFloor, 206 UiElementDebugId::kCeiling, UiElementDebugId::kFloor,
152 UiElementDebugId::kFloorGrid}; 207 UiElementDebugId::kFloorGrid};
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 visible_in_browsing.end(); 245 visible_in_browsing.end();
191 EXPECT_EQ(should_be_visible, element->visible()); 246 EXPECT_EQ(should_be_visible, element->visible());
192 } 247 }
193 { 248 {
194 SCOPED_TRACE("Exited Fullsceen"); 249 SCOPED_TRACE("Exited Fullsceen");
195 EXPECT_EQ(initial_background, scene_->GetBackgroundColor()); 250 EXPECT_EQ(initial_background, scene_->GetBackgroundColor());
196 } 251 }
197 } 252 }
198 253
199 } // namespace vr_shell 254 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene_manager.cc ('k') | chrome/browser/android/vr_shell/vr_gl_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698