Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 bool should_be_visible = visible_in_browsing.find(element->debug_id()) != | 242 bool should_be_visible = visible_in_browsing.find(element->debug_id()) != |
| 243 visible_in_browsing.end(); | 243 visible_in_browsing.end(); |
| 244 EXPECT_EQ(should_be_visible, element->visible()); | 244 EXPECT_EQ(should_be_visible, element->visible()); |
| 245 } | 245 } |
| 246 { | 246 { |
| 247 SCOPED_TRACE("Exited Fullsceen"); | 247 SCOPED_TRACE("Exited Fullsceen"); |
| 248 EXPECT_EQ(initial_background, scene_->GetBackgroundColor()); | 248 EXPECT_EQ(initial_background, scene_->GetBackgroundColor()); |
| 249 } | 249 } |
| 250 } | 250 } |
| 251 | 251 |
| 252 TEST_F(UiSceneManagerTest, UiUpdatesExitPrompt) { | |
| 253 std::set<UiElementDebugId> visible_in_browsing = { | |
|
cjgrant
2017/06/05 17:33:53
visible_in_browsing should be in the empty namespa
ymalik
2017/06/05 20:02:42
Done.
| |
| 254 UiElementDebugId::kContentQuad, UiElementDebugId::kBackplane, | |
|
cjgrant
2017/06/05 17:33:53
Even though it's not done above, can we use a 'usi
ymalik
2017/06/05 20:02:42
Done.
| |
| 255 UiElementDebugId::kCeiling, UiElementDebugId::kFloor, | |
| 256 UiElementDebugId::kUrlBar, UiElementDebugId::kLoadingIndicator}; | |
| 257 std::set<UiElementDebugId> visible_when_prompting = { | |
| 258 UiElementDebugId::kExitPrompt, UiElementDebugId::kBackplane, | |
| 259 UiElementDebugId::kCeiling, UiElementDebugId::kFloor}; | |
| 260 MakeManager(kNotInCct, kNotInWebVr); | |
| 261 | |
| 262 manager_->SetWebVrSecureOrigin(true); | |
| 263 | |
| 264 // Initial state. | |
| 265 for (const auto& element : scene_->GetUiElements()) { | |
| 266 SCOPED_TRACE(element->debug_id()); | |
| 267 bool should_be_visible = visible_in_browsing.find(element->debug_id()) != | |
| 268 visible_in_browsing.end(); | |
| 269 EXPECT_EQ(should_be_visible, element->visible()); | |
| 270 } | |
| 271 | |
| 272 // Exit prompt visible state. | |
| 273 manager_->OnSecurityIconClicked(); | |
| 274 for (const auto& element : scene_->GetUiElements()) { | |
| 275 SCOPED_TRACE(element->debug_id()); | |
| 276 bool should_be_visible = visible_when_prompting.find(element->debug_id()) != | |
| 277 visible_when_prompting.end(); | |
| 278 EXPECT_EQ(should_be_visible, element->visible()); | |
| 279 } | |
| 280 | |
| 281 // Back to initial state. | |
| 282 manager_->OnExitPromptPrimaryButtonClicked(); | |
| 283 for (const auto& element : scene_->GetUiElements()) { | |
| 284 SCOPED_TRACE(element->debug_id()); | |
| 285 bool should_be_visible = visible_in_browsing.find(element->debug_id()) != | |
| 286 visible_in_browsing.end(); | |
| 287 EXPECT_EQ(should_be_visible, element->visible()); | |
| 288 } | |
| 289 } | |
| 290 | |
| 252 TEST_F(UiSceneManagerTest, UiUpdatesForWebVR) { | 291 TEST_F(UiSceneManagerTest, UiUpdatesForWebVR) { |
| 253 MakeManager(kNotInCct, kInWebVr); | 292 MakeManager(kNotInCct, kInWebVr); |
| 254 | 293 |
| 255 manager_->SetWebVrSecureOrigin(true); | 294 manager_->SetWebVrSecureOrigin(true); |
| 256 manager_->SetAudioCapturingIndicator(true); | 295 manager_->SetAudioCapturingIndicator(true); |
| 257 manager_->SetVideoCapturingIndicator(true); | 296 manager_->SetVideoCapturingIndicator(true); |
| 258 manager_->SetScreenCapturingIndicator(true); | 297 manager_->SetScreenCapturingIndicator(true); |
| 259 | 298 |
| 260 // All elements should be hidden. | 299 // All elements should be hidden. |
| 261 for (const auto& element : scene_->GetUiElements()) { | 300 for (const auto& element : scene_->GetUiElements()) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 307 | 346 |
| 308 manager_->SetAudioCapturingIndicator(false); | 347 manager_->SetAudioCapturingIndicator(false); |
| 309 manager_->SetVideoCapturingIndicator(false); | 348 manager_->SetVideoCapturingIndicator(false); |
| 310 manager_->SetScreenCapturingIndicator(false); | 349 manager_->SetScreenCapturingIndicator(false); |
| 311 | 350 |
| 312 EXPECT_FALSE(IsVisible(kAudioCaptureIndicator)); | 351 EXPECT_FALSE(IsVisible(kAudioCaptureIndicator)); |
| 313 EXPECT_FALSE(IsVisible(kVideoCaptureIndicator)); | 352 EXPECT_FALSE(IsVisible(kVideoCaptureIndicator)); |
| 314 EXPECT_FALSE(IsVisible(kScreenCaptureIndicator)); | 353 EXPECT_FALSE(IsVisible(kScreenCaptureIndicator)); |
| 315 } | 354 } |
| 316 } // namespace vr_shell | 355 } // namespace vr_shell |
| OLD | NEW |