Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc

Issue 2913633002: [vr] Clicking on the security icon should prompt the user to bail out of VR (Closed)
Patch Set: rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 f57454514cf10665218eca9f391da39729c1e9f9..5744214d908adf53c905d6c0f560358271ee583d 100644
--- a/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc
+++ b/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc
@@ -14,8 +14,6 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-using testing::InSequence;
-
namespace vr_shell {
namespace {
@@ -35,6 +33,9 @@ class MockBrowserInterface : public UiBrowserInterface {
DISALLOW_COPY_AND_ASSIGN(MockBrowserInterface);
};
+std::set<UiElementDebugId> kElementsVisibleInBrowsing = {
+ kContentQuad, kBackplane, kCeiling, kFloor, kUrlBar, kLoadingIndicator};
+
} // namespace
class UiSceneManagerTest : public testing::Test {
@@ -195,14 +196,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::kCloseButton,
- UiElementDebugId::kBackplane, UiElementDebugId::kCeiling,
- UiElementDebugId::kFloor};
+ kContentQuad, kCloseButton, kBackplane, kCeiling, kFloor};
MakeManager(kNotInCct, kNotInWebVr);
@@ -211,8 +206,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 +235,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 +246,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);
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene_manager.cc ('k') | chrome/browser/android/vr_shell/ui_unsupported_mode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698