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 0e1345feed931f2bd1e06f09a7a0feed91bf8d96..81c6c736ecf674c70074ad54919d761fb42af3ee 100644 |
| --- a/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc |
| +++ b/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc |
| @@ -13,10 +13,16 @@ |
| #include "testing/gmock/include/gmock/gmock.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| -using testing::InSequence; |
| - |
| namespace vr_shell { |
| +using UiElementDebugId::kContentQuad; |
|
cjgrant
2017/06/05 20:47:17
Oops, I didn't mean this. But actually, if you di
ymalik
2017/06/06 02:14:09
Ah, the reason this works is because its not a str
|
| +using UiElementDebugId::kBackplane; |
| +using UiElementDebugId::kCeiling; |
| +using UiElementDebugId::kFloor; |
| +using UiElementDebugId::kUrlBar; |
| +using UiElementDebugId::kLoadingIndicator; |
| +using UiElementDebugId::kExitPrompt; |
| + |
| namespace { |
| class MockBrowserInterface : public VrBrowserInterface { |
| @@ -53,6 +59,9 @@ class MockBrowserInterface : public VrBrowserInterface { |
| DISALLOW_COPY_AND_ASSIGN(MockBrowserInterface); |
| }; |
| +std::set<UiElementDebugId> kElementsVisibleInBrowsing = { |
| + kContentQuad, kBackplane, kCeiling, kFloor, kUrlBar, kLoadingIndicator}; |
| + |
| } // namespace |
| class UiSceneManagerTest : public testing::Test { |
| @@ -196,13 +205,8 @@ TEST_F(UiSceneManagerTest, UiUpdatesForIncognito) { |
| } |
| TEST_F(UiSceneManagerTest, UiUpdatesForFullscreenChanges) { |
| - std::set<UiElementDebugId> visible_in_browsing = { |
| - UiElementDebugId::kContentQuad, UiElementDebugId::kBackplane, |
| - UiElementDebugId::kCeiling, UiElementDebugId::kFloor, |
| - UiElementDebugId::kUrlBar, UiElementDebugId::kLoadingIndicator}; |
| - std::set<UiElementDebugId> visible_in_fullscreen = { |
| - UiElementDebugId::kContentQuad, UiElementDebugId::kBackplane, |
| - UiElementDebugId::kCeiling, UiElementDebugId::kFloor}; |
| + std::set<UiElementDebugId> visible_in_fullscreen = {kContentQuad, kBackplane, |
| + kCeiling, kFloor}; |
| MakeManager(kNotInCct, kNotInWebVr); |
| @@ -211,8 +215,9 @@ TEST_F(UiSceneManagerTest, UiUpdatesForFullscreenChanges) { |
| 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(); |
| + bool should_be_visible = |
| + kElementsVisibleInBrowsing.find(element->debug_id()) != |
| + kElementsVisibleInBrowsing.end(); |
| EXPECT_EQ(should_be_visible, element->visible()); |
| } |
| @@ -239,8 +244,9 @@ TEST_F(UiSceneManagerTest, UiUpdatesForFullscreenChanges) { |
| // Everything should return to original state after leaving fullscreen. |
| 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(); |
| + bool should_be_visible = |
| + kElementsVisibleInBrowsing.find(element->debug_id()) != |
| + kElementsVisibleInBrowsing.end(); |
| EXPECT_EQ(should_be_visible, element->visible()); |
| } |
| { |
| @@ -249,6 +255,42 @@ TEST_F(UiSceneManagerTest, UiUpdatesForFullscreenChanges) { |
| } |
| } |
| +TEST_F(UiSceneManagerTest, UiUpdatesExitPrompt) { |
| + std::set<UiElementDebugId> visible_when_prompting = {kExitPrompt, kBackplane, |
| + kCeiling, kFloor}; |
| + MakeManager(kNotInCct, kNotInWebVr); |
| + |
| + manager_->SetWebVrSecureOrigin(true); |
| + |
| + // Initial state. |
| + for (const auto& element : scene_->GetUiElements()) { |
| + SCOPED_TRACE(element->debug_id()); |
| + bool should_be_visible = |
| + kElementsVisibleInBrowsing.find(element->debug_id()) != |
| + kElementsVisibleInBrowsing.end(); |
| + EXPECT_EQ(should_be_visible, element->visible()); |
| + } |
| + |
| + // Exit prompt visible state. |
| + manager_->OnSecurityIconClicked(); |
| + for (const auto& element : scene_->GetUiElements()) { |
| + SCOPED_TRACE(element->debug_id()); |
| + bool should_be_visible = visible_when_prompting.find(element->debug_id()) != |
| + visible_when_prompting.end(); |
| + EXPECT_EQ(should_be_visible, element->visible()); |
| + } |
| + |
| + // Back to initial state. |
| + manager_->OnExitPromptPrimaryButtonClicked(); |
| + for (const auto& element : scene_->GetUiElements()) { |
| + SCOPED_TRACE(element->debug_id()); |
| + bool should_be_visible = |
| + kElementsVisibleInBrowsing.find(element->debug_id()) != |
| + kElementsVisibleInBrowsing.end(); |
| + EXPECT_EQ(should_be_visible, element->visible()); |
| + } |
| +} |
| + |
| TEST_F(UiSceneManagerTest, UiUpdatesForWebVR) { |
| MakeManager(kNotInCct, kInWebVr); |