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

Side by Side Diff: content/browser/security_exploit_browsertest.cc

Issue 2052633002: Extend the ToRenderFrameHost magic to FrameTreeNode* and Shell* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix induced script bug. 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
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 RenderViewHostImpl* PrepareToDuplicateHosts(Shell* shell, 65 RenderViewHostImpl* PrepareToDuplicateHosts(Shell* shell,
66 int* target_routing_id) { 66 int* target_routing_id) {
67 GURL foo("http://foo.com/simple_page.html"); 67 GURL foo("http://foo.com/simple_page.html");
68 68
69 // Start off with initial navigation, so we get the first process allocated. 69 // Start off with initial navigation, so we get the first process allocated.
70 NavigateToURL(shell, foo); 70 NavigateToURL(shell, foo);
71 EXPECT_EQ(base::ASCIIToUTF16("OK"), shell->web_contents()->GetTitle()); 71 EXPECT_EQ(base::ASCIIToUTF16("OK"), shell->web_contents()->GetTitle());
72 72
73 // Open another window, so we generate some more routing ids. 73 // Open another window, so we generate some more routing ids.
74 ShellAddedObserver shell2_observer; 74 ShellAddedObserver shell2_observer;
75 EXPECT_TRUE(ExecuteScript( 75 EXPECT_TRUE(ExecuteScript(shell, "window.open(document.URL + '#2');"));
76 shell->web_contents(), "window.open(document.URL + '#2');"));
77 Shell* shell2 = shell2_observer.GetShell(); 76 Shell* shell2 = shell2_observer.GetShell();
78 77
79 // The new window must be in the same process, but have a new routing id. 78 // The new window must be in the same process, but have a new routing id.
80 EXPECT_EQ(shell->web_contents()->GetRenderViewHost()->GetProcess()->GetID(), 79 EXPECT_EQ(shell->web_contents()->GetRenderViewHost()->GetProcess()->GetID(),
81 shell2->web_contents()->GetRenderViewHost()->GetProcess()->GetID()); 80 shell2->web_contents()->GetRenderViewHost()->GetProcess()->GetID());
82 *target_routing_id = 81 *target_routing_id =
83 shell2->web_contents()->GetRenderViewHost()->GetRoutingID(); 82 shell2->web_contents()->GetRenderViewHost()->GetRoutingID();
84 EXPECT_NE(*target_routing_id, 83 EXPECT_NE(*target_routing_id,
85 shell->web_contents()->GetRenderViewHost()->GetRoutingID()); 84 shell->web_contents()->GetRenderViewHost()->GetRoutingID());
86 85
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 // separate task of the message loop, so ensure that the process is still 549 // separate task of the message loop, so ensure that the process is still
551 // considered alive. 550 // considered alive.
552 EXPECT_TRUE(root->current_frame_host()->GetProcess()->HasConnection()); 551 EXPECT_TRUE(root->current_frame_host()->GetProcess()->HasConnection());
553 552
554 exit_observer.Wait(); 553 exit_observer.Wait();
555 EXPECT_FALSE(exit_observer.did_exit_normally()); 554 EXPECT_FALSE(exit_observer.did_exit_normally());
556 ResourceDispatcherHost::Get()->SetDelegate(nullptr); 555 ResourceDispatcherHost::Get()->SetDelegate(nullptr);
557 } 556 }
558 557
559 } // namespace content 558 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698