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

Unified Diff: third_party/WebKit/Source/web/tests/ChromeClientImplTest.cpp

Issue 2905873003: VR: Disable select element in VR mode via WebPreferences (Closed)
Patch Set: Address the comment Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/web/ChromeClientImpl.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/tests/ChromeClientImplTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/ChromeClientImplTest.cpp b/third_party/WebKit/Source/web/tests/ChromeClientImplTest.cpp
index 6d571fea327509ed0fa1c86796cf3da75b8f9771..177f2957c7a690261821c3f6a20e2483e355f348 100644
--- a/third_party/WebKit/Source/web/tests/ChromeClientImplTest.cpp
+++ b/third_party/WebKit/Source/web/tests/ChromeClientImplTest.cpp
@@ -29,6 +29,7 @@
*/
#include "core/exported/WebViewBase.h"
+#include "core/html/HTMLSelectElement.h"
#include "core/html/forms/ColorChooserClient.h"
#include "core/html/forms/DateTimeChooser.h"
#include "core/html/forms/DateTimeChooserClient.h"
@@ -353,6 +354,11 @@ class PagePopupSuppressionTest : public testing::Test {
params);
}
+ bool CanOpenPopupMenu() {
+ LocalFrame* frame = ToWebLocalFrameImpl(main_frame_)->GetFrame();
+ return !!chrome_client_impl_->OpenPopupMenu(*frame, *select_);
+ }
+
Settings* GetSettings() {
LocalFrame* frame = ToWebLocalFrameImpl(main_frame_)->GetFrame();
return frame->GetDocument()->GetSettings();
@@ -372,6 +378,7 @@ class PagePopupSuppressionTest : public testing::Test {
new FakeColorChooserClient(frame->GetDocument()->documentElement());
date_time_chooser_client_ =
new FakeDateTimeChooserClient(frame->GetDocument()->documentElement());
+ select_ = HTMLSelectElement::Create(*(frame->GetDocument()));
}
void TearDown() override { web_view_->Close(); }
@@ -384,6 +391,7 @@ class PagePopupSuppressionTest : public testing::Test {
Persistent<ChromeClientImpl> chrome_client_impl_;
Persistent<FakeColorChooserClient> color_chooser_client_;
Persistent<FakeDateTimeChooserClient> date_time_chooser_client_;
+ Persistent<HTMLSelectElement> select_;
};
TEST_F(PagePopupSuppressionTest, SuppressColorChooser) {
@@ -412,4 +420,17 @@ TEST_F(PagePopupSuppressionTest, SuppressDateTimeChooser) {
EXPECT_TRUE(CanOpenDateTimeChooser());
}
+TEST_F(PagePopupSuppressionTest, SuppressPopupMenu) {
+ // By default, the popup should be shown.
+ EXPECT_TRUE(CanOpenPopupMenu());
+
+ Settings* settings = GetSettings();
+ settings->SetPagePopupsSuppressed(true);
+
+ EXPECT_FALSE(CanOpenPopupMenu());
+
+ settings->SetPagePopupsSuppressed(false);
+ EXPECT_TRUE(CanOpenPopupMenu());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/web/ChromeClientImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698