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

Side by Side Diff: content/browser/frame_host/render_frame_host_manager_unittest.cc

Issue 1255103003: Fix race when reloading original URL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2454
Patch Set: Created 5 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "base/test/histogram_tester.h" 8 #include "base/test/histogram_tester.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/browser/compositor/test/no_transport_image_transport_factory.h " 10 #include "content/browser/compositor/test/no_transport_image_transport_factory.h "
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 // |entry|. 416 // |entry|.
417 RenderFrameHostImpl* NavigateToEntry( 417 RenderFrameHostImpl* NavigateToEntry(
418 RenderFrameHostManager* manager, 418 RenderFrameHostManager* manager,
419 const NavigationEntryImpl& entry) { 419 const NavigationEntryImpl& entry) {
420 // Tests currently only navigate using main frame FrameNavigationEntries. 420 // Tests currently only navigate using main frame FrameNavigationEntries.
421 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get(); 421 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get();
422 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 422 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
423 switches::kEnableBrowserSideNavigation)) { 423 switches::kEnableBrowserSideNavigation)) {
424 scoped_ptr<NavigationRequest> navigation_request = 424 scoped_ptr<NavigationRequest> navigation_request =
425 NavigationRequest::CreateBrowserInitiated( 425 NavigationRequest::CreateBrowserInitiated(
426 manager->frame_tree_node_, *frame_entry, entry, 426 manager->frame_tree_node_, frame_entry->url(),
427 frame_entry->referrer(), *frame_entry, entry,
427 FrameMsg_Navigate_Type::NORMAL, false, base::TimeTicks::Now(), 428 FrameMsg_Navigate_Type::NORMAL, false, base::TimeTicks::Now(),
428 static_cast<NavigationControllerImpl*>(&controller())); 429 static_cast<NavigationControllerImpl*>(&controller()));
429 TestRenderFrameHost* frame_host = static_cast<TestRenderFrameHost*>( 430 TestRenderFrameHost* frame_host = static_cast<TestRenderFrameHost*>(
430 manager->GetFrameHostForNavigation(*navigation_request)); 431 manager->GetFrameHostForNavigation(*navigation_request));
431 CHECK(frame_host); 432 CHECK(frame_host);
432 frame_host->set_pending_commit(true); 433 frame_host->set_pending_commit(true);
433 return frame_host; 434 return frame_host;
434 } 435 }
435 436
436 return manager->Navigate(*frame_entry, entry); 437 return manager->Navigate(frame_entry->url(), *frame_entry, entry);
437 } 438 }
438 439
439 // Returns the pending RenderFrameHost. 440 // Returns the pending RenderFrameHost.
440 // PlzNavigate: returns the speculative RenderFrameHost. 441 // PlzNavigate: returns the speculative RenderFrameHost.
441 RenderFrameHostImpl* GetPendingFrameHost( 442 RenderFrameHostImpl* GetPendingFrameHost(
442 RenderFrameHostManager* manager) { 443 RenderFrameHostManager* manager) {
443 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 444 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
444 switches::kEnableBrowserSideNavigation)) { 445 switches::kEnableBrowserSideNavigation)) {
445 return manager->speculative_render_frame_host_.get(); 446 return manager->speculative_render_frame_host_.get();
446 } 447 }
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after
2244 EXPECT_FALSE(contents2->GetMainFrame()->IsRenderFrameLive()); 2245 EXPECT_FALSE(contents2->GetMainFrame()->IsRenderFrameLive());
2245 contents2->NavigateAndCommit(kUrl3); 2246 contents2->NavigateAndCommit(kUrl3);
2246 EXPECT_TRUE(contents2->GetMainFrame()->IsRenderFrameLive()); 2247 EXPECT_TRUE(contents2->GetMainFrame()->IsRenderFrameLive());
2247 EXPECT_NE(nullptr, 2248 EXPECT_NE(nullptr,
2248 iframe->GetRenderFrameProxyHost(contents1->GetSiteInstance())); 2249 iframe->GetRenderFrameProxyHost(contents1->GetSiteInstance()));
2249 EXPECT_EQ(nullptr, 2250 EXPECT_EQ(nullptr,
2250 iframe->GetRenderFrameProxyHost(contents2->GetSiteInstance())); 2251 iframe->GetRenderFrameProxyHost(contents2->GetSiteInstance()));
2251 } 2252 }
2252 2253
2253 } // namespace content 2254 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.cc ('k') | testing/buildbot/chromium.fyi.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698