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

Side by Side Diff: content/browser/cross_site_transfer_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) 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/macros.h" 6 #include "base/macros.h"
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "content/browser/loader/resource_dispatcher_host_impl.h" 8 #include "content/browser/loader/resource_dispatcher_host_impl.h"
9 #include "content/public/browser/navigation_entry.h" 9 #include "content/public/browser/navigation_entry.h"
10 #include "content/public/browser/resource_dispatcher_host_delegate.h" 10 #include "content/public/browser/resource_dispatcher_host_delegate.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 void NavigateToURLContentInitiated(Shell* window, 181 void NavigateToURLContentInitiated(Shell* window,
182 const GURL& url, 182 const GURL& url,
183 bool should_replace_current_entry, 183 bool should_replace_current_entry,
184 bool should_wait_for_navigation) { 184 bool should_wait_for_navigation) {
185 std::string script; 185 std::string script;
186 if (should_replace_current_entry) 186 if (should_replace_current_entry)
187 script = base::StringPrintf("location.replace('%s')", url.spec().c_str()); 187 script = base::StringPrintf("location.replace('%s')", url.spec().c_str());
188 else 188 else
189 script = base::StringPrintf("location.href = '%s'", url.spec().c_str()); 189 script = base::StringPrintf("location.href = '%s'", url.spec().c_str());
190 TestNavigationObserver load_observer(shell()->web_contents(), 1); 190 TestNavigationObserver load_observer(shell()->web_contents(), 1);
191 bool result = ExecuteScript(window->web_contents(), script); 191 bool result = ExecuteScript(window, script);
192 EXPECT_TRUE(result); 192 EXPECT_TRUE(result);
193 if (should_wait_for_navigation) 193 if (should_wait_for_navigation)
194 load_observer.Wait(); 194 load_observer.Wait();
195 } 195 }
196 196
197 void SetUpCommandLine(base::CommandLine* command_line) override { 197 void SetUpCommandLine(base::CommandLine* command_line) override {
198 IsolateAllSitesForTesting(command_line); 198 IsolateAllSitesForTesting(command_line);
199 } 199 }
200 200
201 void InjectResourceDispatcherHostDelegate() { 201 void InjectResourceDispatcherHostDelegate() {
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); 412 EXPECT_EQ(0, controller.GetCurrentEntryIndex());
413 EXPECT_EQ(url1, controller.GetEntryAtIndex(0)->GetURL()); 413 EXPECT_EQ(url1, controller.GetEntryAtIndex(0)->GetURL());
414 414
415 // Make sure the request for url2 did not complete. 415 // Make sure the request for url2 did not complete.
416 EXPECT_FALSE(tracking_delegate().WaitForTrackedURLAndGetCompleted()); 416 EXPECT_FALSE(tracking_delegate().WaitForTrackedURLAndGetCompleted());
417 417
418 shell()->web_contents()->SetDelegate(old_delegate); 418 shell()->web_contents()->SetDelegate(old_delegate);
419 } 419 }
420 420
421 } // namespace content 421 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698