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) { | |
|
cjgrant
2017/05/25 23:02:56
I'm not sure it makes sense to include browser-mod
amp
2017/05/25 23:18:05
I was thinking about this as well. We could split
asimjour1
2017/05/25 23:33:32
Done.
| |
| 204 std::set<UiElementDebugId> visible_in_browsing = { | |
| 205 UiElementDebugId::kContentQuad, | |
| 206 UiElementDebugId::kBackplane, | |
| 207 UiElementDebugId::kCeiling, | |
| 208 UiElementDebugId::kFloor, | |
| 209 UiElementDebugId::kFloorGrid, | |
| 210 UiElementDebugId::kUrlBar, | |
| 211 UiElementDebugId::kLoadingIndicator, | |
| 212 UiElementDebugId::kAudioCaptureIndicator, | |
| 213 UiElementDebugId::kVideoCaptureIndicator, | |
| 214 UiElementDebugId::kScreenCaptureIndicator}; | |
| 215 | |
| 216 MakeManager(kNotInCct, kNotInWebVr); | |
| 217 manager_->SetAudioCapturingIndicator(true); | |
| 218 manager_->SetVideoCapturingIndicator(true); | |
| 219 manager_->SetScreenCapturingIndicator(true); | |
| 220 | |
| 221 // Everything should be visible by default. | |
|
cjgrant
2017/05/25 23:02:56
As above, can skip.
asimjour1
2017/05/25 23:33:32
Done.
| |
| 222 for (const auto& element : scene_->GetUiElements()) { | |
| 223 SCOPED_TRACE(element->debug_id()); | |
| 224 bool should_be_visible = visible_in_browsing.find(element->debug_id()) != | |
| 225 visible_in_browsing.end(); | |
| 226 EXPECT_EQ(should_be_visible, element->visible()); | |
| 227 } | |
| 228 | |
| 229 // Transistion to web vr mode. | |
| 230 manager_->SetWebVrMode(true); | |
| 231 manager_->SetAudioCapturingIndicator(true); | |
|
cjgrant
2017/05/25 23:02:56
No need to re-set these flags.
asimjour1
2017/05/25 23:33:32
Done.
| |
| 232 manager_->SetVideoCapturingIndicator(true); | |
| 233 manager_->SetScreenCapturingIndicator(true); | |
| 234 | |
| 235 // All elements should be hidden. | |
| 236 for (const auto& element : scene_->GetUiElements()) { | |
| 237 SCOPED_TRACE(element->debug_id()); | |
|
cjgrant
2017/05/25 23:02:56
All elements should be invisible, so there's no lo
amp
2017/05/25 23:18:05
+1
asimjour1
2017/05/25 23:33:32
Done.
| |
| 238 bool should_be_hidden = visible_in_browsing.find(element->debug_id()) != | |
| 239 visible_in_browsing.end(); | |
| 240 if (should_be_hidden) | |
| 241 EXPECT_FALSE(element->visible()); | |
| 242 } | |
| 243 | |
| 244 // Exit webvr mode. | |
|
cjgrant
2017/05/25 23:02:56
And, no need for this block.
amp
2017/05/25 23:18:05
This one I would argue it's nice to verify the ret
asimjour1
2017/05/25 23:33:32
Done.
cjgrant
2017/05/26 00:58:02
Adam, could go either way, but with unit tests, it
| |
| 245 manager_->SetWebVrMode(false); | |
| 246 manager_->SetAudioCapturingIndicator(true); | |
| 247 manager_->SetVideoCapturingIndicator(true); | |
| 248 manager_->SetScreenCapturingIndicator(true); | |
| 249 | |
| 250 // Everything should return to original state after leaving webvr. | |
| 251 for (const auto& element : scene_->GetUiElements()) { | |
| 252 SCOPED_TRACE(element->debug_id()); | |
| 253 bool should_be_visible = visible_in_browsing.find(element->debug_id()) != | |
| 254 visible_in_browsing.end(); | |
| 255 EXPECT_EQ(should_be_visible, element->visible()); | |
| 256 } | |
| 257 } | |
| 203 } // namespace vr_shell | 258 } // namespace vr_shell |
| OLD | NEW |