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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 2077683003: Don't rely on untrusted events in site isolation browser test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment Created 4 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
« no previous file with comments | « no previous file | content/test/data/site_isolation/page-with-select.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/site_per_process_browsertest.cc
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
index 69bc8e72a511bdb594684598515068458351d1c4..a659caf6b9e4796e7fb6a196b3384a1a8b1bf07d 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -7068,19 +7068,29 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
NavigateFrameToURL(child2, embedded_test_server()->GetURL(
"c.com", "/site_isolation/page-with-select.html"));
- // Open both <select> menus. This creates a popup widget in both processes.
+ // Open both <select> menus by focusing each item and sending a space key
+ // at the focused node. This creates a popup widget in both processes.
// Wait for and then drop the ViewHostMsg_ShowWidget messages, so that both
// widgets are left in pending-but-not-shown state.
+ NativeWebKeyboardEvent event;
+ event.text[0] = ' ';
+ event.timeStampSeconds = 100;
+ event.type = blink::WebKeyboardEvent::Char;
+
scoped_refptr<PendingWidgetMessageFilter> filter1 =
new PendingWidgetMessageFilter();
process1->AddFilter(filter1.get());
- EXPECT_TRUE(ExecuteScript(child1, "openSelectMenu();"));
+ EXPECT_TRUE(ExecuteScript(child1, "focusSelectMenu();"));
+ child1->current_frame_host()->GetRenderWidgetHost()->ForwardKeyboardEvent(
+ event);
filter1->Wait();
scoped_refptr<PendingWidgetMessageFilter> filter2 =
new PendingWidgetMessageFilter();
process2->AddFilter(filter2.get());
- EXPECT_TRUE(ExecuteScript(child2, "openSelectMenu();"));
+ EXPECT_TRUE(ExecuteScript(child2, "focusSelectMenu();"));
+ child2->current_frame_host()->GetRenderWidgetHost()->ForwardKeyboardEvent(
+ event);
filter2->Wait();
// At this point, we should have two pending widgets.
« no previous file with comments | « no previous file | content/test/data/site_isolation/page-with-select.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698