| 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 7220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7231 EXPECT_TRUE(ExecuteScript(child1, "window.open();")); | 7231 EXPECT_TRUE(ExecuteScript(child1, "window.open();")); |
| 7232 filter1->Wait(); | 7232 filter1->Wait(); |
| 7233 | 7233 |
| 7234 scoped_refptr<PendingWidgetMessageFilter> filter2 = | 7234 scoped_refptr<PendingWidgetMessageFilter> filter2 = |
| 7235 new PendingWidgetMessageFilter(); | 7235 new PendingWidgetMessageFilter(); |
| 7236 process2->AddFilter(filter2.get()); | 7236 process2->AddFilter(filter2.get()); |
| 7237 EXPECT_TRUE(ExecuteScript(child2, "window.open();")); | 7237 EXPECT_TRUE(ExecuteScript(child2, "window.open();")); |
| 7238 filter2->Wait(); | 7238 filter2->Wait(); |
| 7239 | 7239 |
| 7240 // At this point, we should have two pending WebContents. | 7240 // At this point, we should have two pending WebContents. |
| 7241 EXPECT_TRUE( | 7241 EXPECT_TRUE(base::ContainsKey( |
| 7242 ContainsKey(web_contents()->pending_contents_, | 7242 web_contents()->pending_contents_, |
| 7243 std::make_pair(process1->GetID(), filter1->routing_id()))); | 7243 std::make_pair(process1->GetID(), filter1->routing_id()))); |
| 7244 EXPECT_TRUE( | 7244 EXPECT_TRUE(base::ContainsKey( |
| 7245 ContainsKey(web_contents()->pending_contents_, | 7245 web_contents()->pending_contents_, |
| 7246 std::make_pair(process2->GetID(), filter2->routing_id()))); | 7246 std::make_pair(process2->GetID(), filter2->routing_id()))); |
| 7247 | 7247 |
| 7248 // Both subframes were set up in the same way, so the next routing ID for the | 7248 // Both subframes were set up in the same way, so the next routing ID for the |
| 7249 // new popup windows should match up (this led to the collision in the | 7249 // new popup windows should match up (this led to the collision in the |
| 7250 // pending contents map in the original bug). | 7250 // pending contents map in the original bug). |
| 7251 EXPECT_EQ(filter1->routing_id(), filter2->routing_id()); | 7251 EXPECT_EQ(filter1->routing_id(), filter2->routing_id()); |
| 7252 | 7252 |
| 7253 // Now, simulate that both ShowView messages arrive by showing both of the | 7253 // Now, simulate that both ShowView messages arrive by showing both of the |
| 7254 // pending WebContents. | 7254 // pending WebContents. |
| 7255 web_contents()->ShowCreatedWindow(process1->GetID(), filter1->routing_id(), | 7255 web_contents()->ShowCreatedWindow(process1->GetID(), filter1->routing_id(), |
| 7256 NEW_FOREGROUND_TAB, gfx::Rect(), true); | 7256 NEW_FOREGROUND_TAB, gfx::Rect(), true); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7307 | 7307 |
| 7308 scoped_refptr<PendingWidgetMessageFilter> filter2 = | 7308 scoped_refptr<PendingWidgetMessageFilter> filter2 = |
| 7309 new PendingWidgetMessageFilter(); | 7309 new PendingWidgetMessageFilter(); |
| 7310 process2->AddFilter(filter2.get()); | 7310 process2->AddFilter(filter2.get()); |
| 7311 EXPECT_TRUE(ExecuteScript(child2, "focusSelectMenu();")); | 7311 EXPECT_TRUE(ExecuteScript(child2, "focusSelectMenu();")); |
| 7312 child2->current_frame_host()->GetRenderWidgetHost()->ForwardKeyboardEvent( | 7312 child2->current_frame_host()->GetRenderWidgetHost()->ForwardKeyboardEvent( |
| 7313 event); | 7313 event); |
| 7314 filter2->Wait(); | 7314 filter2->Wait(); |
| 7315 | 7315 |
| 7316 // At this point, we should have two pending widgets. | 7316 // At this point, we should have two pending widgets. |
| 7317 EXPECT_TRUE( | 7317 EXPECT_TRUE(base::ContainsKey( |
| 7318 ContainsKey(web_contents()->pending_widget_views_, | 7318 web_contents()->pending_widget_views_, |
| 7319 std::make_pair(process1->GetID(), filter1->routing_id()))); | 7319 std::make_pair(process1->GetID(), filter1->routing_id()))); |
| 7320 EXPECT_TRUE( | 7320 EXPECT_TRUE(base::ContainsKey( |
| 7321 ContainsKey(web_contents()->pending_widget_views_, | 7321 web_contents()->pending_widget_views_, |
| 7322 std::make_pair(process2->GetID(), filter2->routing_id()))); | 7322 std::make_pair(process2->GetID(), filter2->routing_id()))); |
| 7323 | 7323 |
| 7324 // Both subframes were set up in the same way, so the next routing ID for the | 7324 // Both subframes were set up in the same way, so the next routing ID for the |
| 7325 // new popup widgets should match up (this led to the collision in the | 7325 // new popup widgets should match up (this led to the collision in the |
| 7326 // pending widgets map in the original bug). | 7326 // pending widgets map in the original bug). |
| 7327 EXPECT_EQ(filter1->routing_id(), filter2->routing_id()); | 7327 EXPECT_EQ(filter1->routing_id(), filter2->routing_id()); |
| 7328 | 7328 |
| 7329 // Now simulate both widgets being shown. | 7329 // Now simulate both widgets being shown. |
| 7330 web_contents()->ShowCreatedWidget(process1->GetID(), filter1->routing_id(), | 7330 web_contents()->ShowCreatedWidget(process1->GetID(), filter1->routing_id(), |
| 7331 false, gfx::Rect()); | 7331 false, gfx::Rect()); |
| 7332 web_contents()->ShowCreatedWidget(process2->GetID(), filter2->routing_id(), | 7332 web_contents()->ShowCreatedWidget(process2->GetID(), filter2->routing_id(), |
| 7333 false, gfx::Rect()); | 7333 false, gfx::Rect()); |
| 7334 EXPECT_FALSE( | 7334 EXPECT_FALSE(base::ContainsKey( |
| 7335 ContainsKey(web_contents()->pending_widget_views_, | 7335 web_contents()->pending_widget_views_, |
| 7336 std::make_pair(process1->GetID(), filter1->routing_id()))); | 7336 std::make_pair(process1->GetID(), filter1->routing_id()))); |
| 7337 EXPECT_FALSE( | 7337 EXPECT_FALSE(base::ContainsKey( |
| 7338 ContainsKey(web_contents()->pending_widget_views_, | 7338 web_contents()->pending_widget_views_, |
| 7339 std::make_pair(process2->GetID(), filter2->routing_id()))); | 7339 std::make_pair(process2->GetID(), filter2->routing_id()))); |
| 7340 } | 7340 } |
| 7341 #endif | 7341 #endif |
| 7342 | 7342 |
| 7343 // Check that out-of-process frames correctly calculate their ability to enter | 7343 // Check that out-of-process frames correctly calculate their ability to enter |
| 7344 // fullscreen. A frame is allowed enter fullscreen if the allowFullscreen | 7344 // fullscreen. A frame is allowed enter fullscreen if the allowFullscreen |
| 7345 // attribute is present in all of its ancestor <iframe> elements. For OOPIF, | 7345 // attribute is present in all of its ancestor <iframe> elements. For OOPIF, |
| 7346 // when a parent frame changes this attribute, the change is replicated to the | 7346 // when a parent frame changes this attribute, the change is replicated to the |
| 7347 // child frame and its proxies. | 7347 // child frame and its proxies. |
| 7348 // | 7348 // |
| 7349 // The test checks the following cases: | 7349 // The test checks the following cases: |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7848 // Send a postMessage from the child to its parent. This verifies that the | 7848 // Send a postMessage from the child to its parent. This verifies that the |
| 7849 // parent's proxy in the child's SiteInstance was also restored. | 7849 // parent's proxy in the child's SiteInstance was also restored. |
| 7850 base::string16 expected_title(base::UTF8ToUTF16("I am alive!")); | 7850 base::string16 expected_title(base::UTF8ToUTF16("I am alive!")); |
| 7851 TitleWatcher title_watcher(shell()->web_contents(), expected_title); | 7851 TitleWatcher title_watcher(shell()->web_contents(), expected_title); |
| 7852 EXPECT_TRUE(ExecuteScript(child->current_frame_host(), | 7852 EXPECT_TRUE(ExecuteScript(child->current_frame_host(), |
| 7853 "parent.postMessage('I am alive!', '*');")); | 7853 "parent.postMessage('I am alive!', '*');")); |
| 7854 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 7854 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
| 7855 } | 7855 } |
| 7856 | 7856 |
| 7857 } // namespace content | 7857 } // namespace content |
| OLD | NEW |