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

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

Issue 2903673002: VR: Update UiSceneManager with screen capturing flag (Closed)
Patch Set: Indicators tests are added. Update the flags only when they change 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
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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 bool should_be_visible = visible_in_browsing.find(element->debug_id()) != 193 bool should_be_visible = visible_in_browsing.find(element->debug_id()) !=
194 visible_in_browsing.end(); 194 visible_in_browsing.end();
195 EXPECT_EQ(should_be_visible, element->visible()); 195 EXPECT_EQ(should_be_visible, element->visible());
196 } 196 }
197 { 197 {
198 SCOPED_TRACE("Exited Fullsceen"); 198 SCOPED_TRACE("Exited Fullsceen");
199 EXPECT_TRUE(ColorEquals(initial_background, scene_->GetBackgroundColor())); 199 EXPECT_TRUE(ColorEquals(initial_background, scene_->GetBackgroundColor()));
200 } 200 }
201 } 201 }
202 202
203 TEST_F(UiSceneManagerTest, UiUpdatesForWebVR) {
204 MakeManager(kNotInCct, kInWebVr);
205
206 manager_->SetWebVrSecureOrigin(true);
207 manager_->SetAudioCapturingIndicator(true);
208 manager_->SetVideoCapturingIndicator(true);
209 manager_->SetScreenCapturingIndicator(true);
210
211 // All elements should be hidden.
212 for (const auto& element : scene_->GetUiElements()) {
213 SCOPED_TRACE(element->debug_id());
214 EXPECT_FALSE(element->visible());
215 }
216 }
217
218 TEST_F(UiSceneManagerTest, UiUpdateTransitionToWebVR) {
219 MakeManager(kNotInCct, kNotInWebVr);
220 manager_->SetAudioCapturingIndicator(true);
221 manager_->SetVideoCapturingIndicator(true);
222 manager_->SetScreenCapturingIndicator(true);
223
224 // Transition to WebVR mode
225 manager_->SetWebVrMode(true);
226 manager_->SetWebVrSecureOrigin(true);
227
228 // All elements should be hidden.
229 for (const auto& element : scene_->GetUiElements()) {
230 SCOPED_TRACE(element->debug_id());
231 EXPECT_FALSE(element->visible());
232 }
amp 2017/05/26 17:26:01 Should we test that transitioning out of WebVR mak
cjgrant 2017/05/26 17:33:35 I still feel the same about this as before. I thi
amp 2017/05/26 17:55:30 That makes sense. I agree a single large test tha
233 }
234
235 TEST_F(UiSceneManagerTest, CaptureIndicatorsVisibility) {
236 MakeManager(kNotInCct, kNotInWebVr);
237 EXPECT_FALSE(IsVisible(kAudioCaptureIndicator));
238 EXPECT_FALSE(IsVisible(kVideoCaptureIndicator));
239 EXPECT_FALSE(IsVisible(kScreenCaptureIndicator));
240
241 manager_->SetAudioCapturingIndicator(true);
242 manager_->SetVideoCapturingIndicator(true);
243 manager_->SetScreenCapturingIndicator(true);
244
245 EXPECT_TRUE(IsVisible(kAudioCaptureIndicator));
246 EXPECT_TRUE(IsVisible(kVideoCaptureIndicator));
247 EXPECT_TRUE(IsVisible(kScreenCaptureIndicator));
248
249 manager_->SetWebVrMode(true);
250 EXPECT_FALSE(IsVisible(kAudioCaptureIndicator));
251 EXPECT_FALSE(IsVisible(kVideoCaptureIndicator));
252 EXPECT_FALSE(IsVisible(kScreenCaptureIndicator));
253
254 manager_->SetWebVrMode(false);
255 EXPECT_TRUE(IsVisible(kAudioCaptureIndicator));
256 EXPECT_TRUE(IsVisible(kVideoCaptureIndicator));
257 EXPECT_TRUE(IsVisible(kScreenCaptureIndicator));
258
259 manager_->SetAudioCapturingIndicator(false);
260 manager_->SetVideoCapturingIndicator(false);
261 manager_->SetScreenCapturingIndicator(false);
262
263 EXPECT_FALSE(IsVisible(kAudioCaptureIndicator));
264 EXPECT_FALSE(IsVisible(kVideoCaptureIndicator));
265 EXPECT_FALSE(IsVisible(kScreenCaptureIndicator));
266 }
203 } // namespace vr_shell 267 } // 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_shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698