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

Side by Side 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: 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/site_per_process_browsertest.h" 5 #include "content/browser/site_per_process_browsertest.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 7050 matching lines...) Expand 10 before | Expand all | Expand 10 after
7061 FrameTreeNode* child2 = root->child_at(1); 7061 FrameTreeNode* child2 = root->child_at(1);
7062 RenderProcessHost* process1 = child1->current_frame_host()->GetProcess(); 7062 RenderProcessHost* process1 = child1->current_frame_host()->GetProcess();
7063 RenderProcessHost* process2 = child2->current_frame_host()->GetProcess(); 7063 RenderProcessHost* process2 = child2->current_frame_host()->GetProcess();
7064 7064
7065 // Navigate both subframes to a page with a <select> element. 7065 // Navigate both subframes to a page with a <select> element.
7066 NavigateFrameToURL(child1, embedded_test_server()->GetURL( 7066 NavigateFrameToURL(child1, embedded_test_server()->GetURL(
7067 "b.com", "/site_isolation/page-with-select.html")); 7067 "b.com", "/site_isolation/page-with-select.html"));
7068 NavigateFrameToURL(child2, embedded_test_server()->GetURL( 7068 NavigateFrameToURL(child2, embedded_test_server()->GetURL(
7069 "c.com", "/site_isolation/page-with-select.html")); 7069 "c.com", "/site_isolation/page-with-select.html"));
7070 7070
7071 NativeWebKeyboardEvent event;
7072 event.text[0] = ' ';
Charlie Reis 2016/06/16 22:35:23 This isn't entirely clear to me at first glance.
7073 event.timeStampSeconds = 100;
7074 event.type = blink::WebKeyboardEvent::Char;
7071 // Open both <select> menus. This creates a popup widget in both processes. 7075 // Open both <select> menus. This creates a popup widget in both processes.
7072 // Wait for and then drop the ViewHostMsg_ShowWidget messages, so that both 7076 // Wait for and then drop the ViewHostMsg_ShowWidget messages, so that both
7073 // widgets are left in pending-but-not-shown state. 7077 // widgets are left in pending-but-not-shown state.
7074 scoped_refptr<PendingWidgetMessageFilter> filter1 = 7078 scoped_refptr<PendingWidgetMessageFilter> filter1 =
7075 new PendingWidgetMessageFilter(); 7079 new PendingWidgetMessageFilter();
7076 process1->AddFilter(filter1.get()); 7080 process1->AddFilter(filter1.get());
7077 EXPECT_TRUE(ExecuteScript(child1, "openSelectMenu();")); 7081 EXPECT_TRUE(ExecuteScript(child1, "focusSelectMenu();"));
7082 child1->current_frame_host()->GetRenderWidgetHost()->ForwardKeyboardEvent(
7083 event);
7078 filter1->Wait(); 7084 filter1->Wait();
7079 7085
7080 scoped_refptr<PendingWidgetMessageFilter> filter2 = 7086 scoped_refptr<PendingWidgetMessageFilter> filter2 =
7081 new PendingWidgetMessageFilter(); 7087 new PendingWidgetMessageFilter();
7082 process2->AddFilter(filter2.get()); 7088 process2->AddFilter(filter2.get());
7083 EXPECT_TRUE(ExecuteScript(child2, "openSelectMenu();")); 7089 EXPECT_TRUE(ExecuteScript(child2, "focusSelectMenu();"));
7090 child2->current_frame_host()->GetRenderWidgetHost()->ForwardKeyboardEvent(
7091 event);
7084 filter2->Wait(); 7092 filter2->Wait();
7085 7093
7086 // At this point, we should have two pending widgets. 7094 // At this point, we should have two pending widgets.
7087 EXPECT_TRUE( 7095 EXPECT_TRUE(
7088 ContainsKey(web_contents()->pending_widget_views_, 7096 ContainsKey(web_contents()->pending_widget_views_,
7089 std::make_pair(process1->GetID(), filter1->routing_id()))); 7097 std::make_pair(process1->GetID(), filter1->routing_id())));
7090 EXPECT_TRUE( 7098 EXPECT_TRUE(
7091 ContainsKey(web_contents()->pending_widget_views_, 7099 ContainsKey(web_contents()->pending_widget_views_,
7092 std::make_pair(process2->GetID(), filter2->routing_id()))); 7100 std::make_pair(process2->GetID(), filter2->routing_id())));
7093 7101
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
7198 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0))); 7206 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)));
7199 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); 7207 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0)));
7200 7208
7201 // Cross-site navigation should preserve the fullscreen flags. 7209 // Cross-site navigation should preserve the fullscreen flags.
7202 NavigateFrameToURL(root->child_at(0)->child_at(0), 7210 NavigateFrameToURL(root->child_at(0)->child_at(0),
7203 embedded_test_server()->GetURL("d.com", "/title1.html")); 7211 embedded_test_server()->GetURL("d.com", "/title1.html"));
7204 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); 7212 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0)));
7205 } 7213 }
7206 7214
7207 } // namespace content 7215 } // namespace content
OLDNEW
« 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