Chromium Code Reviews| Index: chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc |
| diff --git a/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc b/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc |
| index e88d601f3b3f548d84ec74ea7644e271e390edbb..520e9ed99d9f29b6d70cf5c2309075bbea5ad8a1 100644 |
| --- a/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc |
| +++ b/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc |
| @@ -200,4 +200,59 @@ TEST_F(UiSceneManagerTest, UiUpdatesForFullscreenChanges) { |
| } |
| } |
| +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.
|
| + std::set<UiElementDebugId> visible_in_browsing = { |
| + UiElementDebugId::kContentQuad, |
| + UiElementDebugId::kBackplane, |
| + UiElementDebugId::kCeiling, |
| + UiElementDebugId::kFloor, |
| + UiElementDebugId::kFloorGrid, |
| + UiElementDebugId::kUrlBar, |
| + UiElementDebugId::kLoadingIndicator, |
| + UiElementDebugId::kAudioCaptureIndicator, |
| + UiElementDebugId::kVideoCaptureIndicator, |
| + UiElementDebugId::kScreenCaptureIndicator}; |
| + |
| + MakeManager(kNotInCct, kNotInWebVr); |
| + manager_->SetAudioCapturingIndicator(true); |
| + manager_->SetVideoCapturingIndicator(true); |
| + manager_->SetScreenCapturingIndicator(true); |
| + |
| + // 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.
|
| + for (const auto& element : scene_->GetUiElements()) { |
| + SCOPED_TRACE(element->debug_id()); |
| + bool should_be_visible = visible_in_browsing.find(element->debug_id()) != |
| + visible_in_browsing.end(); |
| + EXPECT_EQ(should_be_visible, element->visible()); |
| + } |
| + |
| + // Transistion to web vr mode. |
| + manager_->SetWebVrMode(true); |
| + 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.
|
| + manager_->SetVideoCapturingIndicator(true); |
| + manager_->SetScreenCapturingIndicator(true); |
| + |
| + // All elements should be hidden. |
| + for (const auto& element : scene_->GetUiElements()) { |
| + 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.
|
| + bool should_be_hidden = visible_in_browsing.find(element->debug_id()) != |
| + visible_in_browsing.end(); |
| + if (should_be_hidden) |
| + EXPECT_FALSE(element->visible()); |
| + } |
| + |
| + // 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
|
| + manager_->SetWebVrMode(false); |
| + manager_->SetAudioCapturingIndicator(true); |
| + manager_->SetVideoCapturingIndicator(true); |
| + manager_->SetScreenCapturingIndicator(true); |
| + |
| + // Everything should return to original state after leaving webvr. |
| + for (const auto& element : scene_->GetUiElements()) { |
| + SCOPED_TRACE(element->debug_id()); |
| + bool should_be_visible = visible_in_browsing.find(element->debug_id()) != |
| + visible_in_browsing.end(); |
| + EXPECT_EQ(should_be_visible, element->visible()); |
| + } |
| +} |
| } // namespace vr_shell |