OLD | NEW |
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 Loading... |
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 // Open both <select> menus. This creates a popup widget in both processes. | 7071 // Open both <select> menus by focusing each item and sending a space key |
| 7072 // at the focused node. This creates a popup widget in both processes. |
7072 // Wait for and then drop the ViewHostMsg_ShowWidget messages, so that both | 7073 // Wait for and then drop the ViewHostMsg_ShowWidget messages, so that both |
7073 // widgets are left in pending-but-not-shown state. | 7074 // widgets are left in pending-but-not-shown state. |
| 7075 NativeWebKeyboardEvent event; |
| 7076 event.text[0] = ' '; |
| 7077 event.timeStampSeconds = 100; |
| 7078 event.type = blink::WebKeyboardEvent::Char; |
| 7079 |
7074 scoped_refptr<PendingWidgetMessageFilter> filter1 = | 7080 scoped_refptr<PendingWidgetMessageFilter> filter1 = |
7075 new PendingWidgetMessageFilter(); | 7081 new PendingWidgetMessageFilter(); |
7076 process1->AddFilter(filter1.get()); | 7082 process1->AddFilter(filter1.get()); |
7077 EXPECT_TRUE(ExecuteScript(child1, "openSelectMenu();")); | 7083 EXPECT_TRUE(ExecuteScript(child1, "focusSelectMenu();")); |
| 7084 child1->current_frame_host()->GetRenderWidgetHost()->ForwardKeyboardEvent( |
| 7085 event); |
7078 filter1->Wait(); | 7086 filter1->Wait(); |
7079 | 7087 |
7080 scoped_refptr<PendingWidgetMessageFilter> filter2 = | 7088 scoped_refptr<PendingWidgetMessageFilter> filter2 = |
7081 new PendingWidgetMessageFilter(); | 7089 new PendingWidgetMessageFilter(); |
7082 process2->AddFilter(filter2.get()); | 7090 process2->AddFilter(filter2.get()); |
7083 EXPECT_TRUE(ExecuteScript(child2, "openSelectMenu();")); | 7091 EXPECT_TRUE(ExecuteScript(child2, "focusSelectMenu();")); |
| 7092 child2->current_frame_host()->GetRenderWidgetHost()->ForwardKeyboardEvent( |
| 7093 event); |
7084 filter2->Wait(); | 7094 filter2->Wait(); |
7085 | 7095 |
7086 // At this point, we should have two pending widgets. | 7096 // At this point, we should have two pending widgets. |
7087 EXPECT_TRUE( | 7097 EXPECT_TRUE( |
7088 ContainsKey(web_contents()->pending_widget_views_, | 7098 ContainsKey(web_contents()->pending_widget_views_, |
7089 std::make_pair(process1->GetID(), filter1->routing_id()))); | 7099 std::make_pair(process1->GetID(), filter1->routing_id()))); |
7090 EXPECT_TRUE( | 7100 EXPECT_TRUE( |
7091 ContainsKey(web_contents()->pending_widget_views_, | 7101 ContainsKey(web_contents()->pending_widget_views_, |
7092 std::make_pair(process2->GetID(), filter2->routing_id()))); | 7102 std::make_pair(process2->GetID(), filter2->routing_id()))); |
7093 | 7103 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7198 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0))); | 7208 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0))); |
7199 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); | 7209 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); |
7200 | 7210 |
7201 // Cross-site navigation should preserve the fullscreen flags. | 7211 // Cross-site navigation should preserve the fullscreen flags. |
7202 NavigateFrameToURL(root->child_at(0)->child_at(0), | 7212 NavigateFrameToURL(root->child_at(0)->child_at(0), |
7203 embedded_test_server()->GetURL("d.com", "/title1.html")); | 7213 embedded_test_server()->GetURL("d.com", "/title1.html")); |
7204 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); | 7214 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); |
7205 } | 7215 } |
7206 | 7216 |
7207 } // namespace content | 7217 } // namespace content |
OLD | NEW |