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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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, UiUpdatesForWebVRChanges) { | |
| 204 MakeManager(kNotInCct, kInWebVr); | |
|
cjgrant
2017/05/26 01:09:26
This line is initializing a scene manager in WebVR
| |
| 205 | |
| 206 // Transistion to web vr mode. | |
| 207 manager_->SetWebVrMode(true); | |
| 208 manager_->SetWebVrSecureOrigin(true); | |
| 209 | |
| 210 // All elements should be hidden. | |
| 211 for (const auto& element : scene_->GetUiElements()) { | |
| 212 SCOPED_TRACE(element->debug_id()); | |
| 213 EXPECT_FALSE(element->visible()); | |
| 214 } | |
| 215 | |
| 216 // Exit webvr mode. | |
| 217 std::set<UiElementDebugId> visible_in_browsing = { | |
|
cjgrant
2017/05/26 00:58:02
If the text is going to check this set of elements
| |
| 218 UiElementDebugId::kContentQuad, | |
| 219 UiElementDebugId::kBackplane, | |
| 220 UiElementDebugId::kCeiling, | |
| 221 UiElementDebugId::kFloor, | |
| 222 UiElementDebugId::kFloorGrid, | |
| 223 UiElementDebugId::kUrlBar, | |
| 224 UiElementDebugId::kLoadingIndicator, | |
| 225 UiElementDebugId::kAudioCaptureIndicator, | |
| 226 UiElementDebugId::kVideoCaptureIndicator, | |
| 227 UiElementDebugId::kScreenCaptureIndicator}; | |
| 228 | |
| 229 manager_->SetWebVrMode(false); | |
| 230 manager_->SetAudioCapturingIndicator(true); | |
|
cjgrant
2017/05/26 01:09:26
Miscommunication. The point of adding this test i
| |
| 231 manager_->SetVideoCapturingIndicator(true); | |
| 232 manager_->SetScreenCapturingIndicator(true); | |
| 233 | |
| 234 // Everything should return to original state after leaving webvr. | |
| 235 for (const auto& element : scene_->GetUiElements()) { | |
| 236 SCOPED_TRACE(element->debug_id()); | |
| 237 bool should_be_visible = visible_in_browsing.find(element->debug_id()) != | |
| 238 visible_in_browsing.end(); | |
| 239 EXPECT_EQ(should_be_visible, element->visible()); | |
| 240 } | |
| 241 } | |
| 203 } // namespace vr_shell | 242 } // namespace vr_shell |
| OLD | NEW |