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

Side by Side Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 1048463004: PlzNavigate: track pending commits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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/logging.h" 6 #include "base/logging.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "content/browser/frame_host/cross_site_transferring_request.h" 8 #include "content/browser/frame_host/cross_site_transferring_request.h"
9 #include "content/browser/frame_host/interstitial_page_impl.h" 9 #include "content/browser/frame_host/interstitial_page_impl.h"
10 #include "content/browser/frame_host/navigation_entry_impl.h" 10 #include "content/browser/frame_host/navigation_entry_impl.h"
(...skipping 2642 matching lines...) Expand 10 before | Expand all | Expand 10 after
2653 EXPECT_EQ(1u, instance->GetRelatedActiveContentsCount()); 2653 EXPECT_EQ(1u, instance->GetRelatedActiveContentsCount());
2654 2654
2655 // Navigate to a URL in a different site. 2655 // Navigate to a URL in a different site.
2656 const GURL kUrl = GURL("http://b.com"); 2656 const GURL kUrl = GURL("http://b.com");
2657 contents->GetController().LoadURL(kUrl, 2657 contents->GetController().LoadURL(kUrl,
2658 Referrer(), 2658 Referrer(),
2659 ui::PAGE_TRANSITION_TYPED, 2659 ui::PAGE_TRANSITION_TYPED,
2660 std::string()); 2660 std::string());
2661 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 2661 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
2662 switches::kEnableBrowserSideNavigation)) { 2662 switches::kEnableBrowserSideNavigation)) {
2663 contents->GetMainFrame()->SendBeforeUnloadACK(true); 2663 contents->GetMainFrame()->PrepareForCommit();
clamy 2015/03/30 12:50:57 Decoupling the CommitPendingNavigation in two was
carlosk 2015/03/31 13:01:32 To make sure I understand what you mean: you are e
2664 } 2664 }
2665 EXPECT_TRUE(contents->cross_navigation_pending()); 2665 EXPECT_TRUE(contents->cross_navigation_pending());
2666 EXPECT_EQ(1u, instance->GetRelatedActiveContentsCount()); 2666 EXPECT_EQ(1u, instance->GetRelatedActiveContentsCount());
2667 contents->CommitPendingNavigation(); 2667 contents->GetPendingMainFrame()->SendNavigate(0, kUrl);
2668 EXPECT_EQ(1u, instance->GetRelatedActiveContentsCount()); 2668 EXPECT_EQ(1u, instance->GetRelatedActiveContentsCount());
2669 2669
2670 contents.reset(); 2670 contents.reset();
2671 EXPECT_EQ(0u, instance->GetRelatedActiveContentsCount()); 2671 EXPECT_EQ(0u, instance->GetRelatedActiveContentsCount());
2672 } 2672 }
2673 2673
2674 // Tests that GetRelatedActiveContentsCount tracks BrowsingInstance changes 2674 // Tests that GetRelatedActiveContentsCount tracks BrowsingInstance changes
2675 // from WebUI. 2675 // from WebUI.
2676 TEST_F(WebContentsImplTest, ActiveContentsCountChangeBrowsingInstance) { 2676 TEST_F(WebContentsImplTest, ActiveContentsCountChangeBrowsingInstance) {
2677 scoped_refptr<SiteInstance> instance( 2677 scoped_refptr<SiteInstance> instance(
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
3014 contents()->GetMainFrame()->OnMessageReceived( 3014 contents()->GetMainFrame()->OnMessageReceived(
3015 FrameHostMsg_RenderProcessGone( 3015 FrameHostMsg_RenderProcessGone(
3016 0, base::TERMINATION_STATUS_PROCESS_CRASHED, -1)); 3016 0, base::TERMINATION_STATUS_PROCESS_CRASHED, -1));
3017 3017
3018 // Verify that all the power save blockers have been released. 3018 // Verify that all the power save blockers have been released.
3019 EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing()); 3019 EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing());
3020 EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing()); 3020 EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing());
3021 } 3021 }
3022 3022
3023 } // namespace content 3023 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698