| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // Start off with initial navigation, so we get the first process allocated. | 72 // Start off with initial navigation, so we get the first process allocated. |
| 73 NavigateToURL(shell, foo); | 73 NavigateToURL(shell, foo); |
| 74 EXPECT_EQ(base::ASCIIToUTF16("OK"), shell->web_contents()->GetTitle()); | 74 EXPECT_EQ(base::ASCIIToUTF16("OK"), shell->web_contents()->GetTitle()); |
| 75 | 75 |
| 76 // Open another window, so we generate some more routing ids. | 76 // Open another window, so we generate some more routing ids. |
| 77 ShellAddedObserver shell2_observer; | 77 ShellAddedObserver shell2_observer; |
| 78 EXPECT_TRUE(ExecuteScript(shell, "window.open(document.URL + '#2');")); | 78 EXPECT_TRUE(ExecuteScript(shell, "window.open(document.URL + '#2');")); |
| 79 Shell* shell2 = shell2_observer.GetShell(); | 79 Shell* shell2 = shell2_observer.GetShell(); |
| 80 | 80 |
| 81 // The new window must be in the same process, but have a new routing id. | 81 // The new window must be in the same process, but have a new routing id. |
| 82 EXPECT_EQ(shell->web_contents()->GetRenderViewHost()->GetProcess()->GetID(), | 82 EXPECT_EQ(shell->web_contents()->GetMainFrame()->GetProcess()->GetID(), |
| 83 shell2->web_contents()->GetRenderViewHost()->GetProcess()->GetID()); | 83 shell2->web_contents()->GetMainFrame()->GetProcess()->GetID()); |
| 84 *target_routing_id = | 84 *target_routing_id = |
| 85 shell2->web_contents()->GetRenderViewHost()->GetRoutingID(); | 85 shell2->web_contents()->GetRenderViewHost()->GetRoutingID(); |
| 86 EXPECT_NE(*target_routing_id, | 86 EXPECT_NE(*target_routing_id, |
| 87 shell->web_contents()->GetRenderViewHost()->GetRoutingID()); | 87 shell->web_contents()->GetRenderViewHost()->GetRoutingID()); |
| 88 | 88 |
| 89 // Now, simulate a link click coming from the renderer. | 89 // Now, simulate a link click coming from the renderer. |
| 90 GURL extension_url("https://bar.com/simple_page.html"); | 90 GURL extension_url("https://bar.com/simple_page.html"); |
| 91 WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell->web_contents()); | 91 WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell->web_contents()); |
| 92 wc->GetFrameTree()->root()->navigator()->RequestOpenURL( | 92 wc->GetFrameTree()->root()->navigator()->RequestOpenURL( |
| 93 wc->GetFrameTree()->root()->current_frame_host(), extension_url, false, | 93 wc->GetFrameTree()->root()->current_frame_host(), extension_url, false, |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 // separate task of the message loop, so ensure that the process is still | 552 // separate task of the message loop, so ensure that the process is still |
| 553 // considered alive. | 553 // considered alive. |
| 554 EXPECT_TRUE(root->current_frame_host()->GetProcess()->HasConnection()); | 554 EXPECT_TRUE(root->current_frame_host()->GetProcess()->HasConnection()); |
| 555 | 555 |
| 556 exit_observer.Wait(); | 556 exit_observer.Wait(); |
| 557 EXPECT_FALSE(exit_observer.did_exit_normally()); | 557 EXPECT_FALSE(exit_observer.did_exit_normally()); |
| 558 ResourceDispatcherHost::Get()->SetDelegate(nullptr); | 558 ResourceDispatcherHost::Get()->SetDelegate(nullptr); |
| 559 } | 559 } |
| 560 | 560 |
| 561 } // namespace content | 561 } // namespace content |
| OLD | NEW |