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

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

Issue 743803002: Avoid stale navigation requests without excessive page id knowledge in the renderer process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more saving Created 6 years 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/logging.h" 5 #include "base/logging.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "content/browser/frame_host/cross_site_transferring_request.h" 7 #include "content/browser/frame_host/cross_site_transferring_request.h"
8 #include "content/browser/frame_host/interstitial_page_impl.h" 8 #include "content/browser/frame_host/interstitial_page_impl.h"
9 #include "content/browser/frame_host/navigation_entry_impl.h" 9 #include "content/browser/frame_host/navigation_entry_impl.h"
10 #include "content/browser/media/audio_stream_monitor.h" 10 #include "content/browser/media/audio_stream_monitor.h"
(...skipping 2264 matching lines...) Expand 10 before | Expand all | Expand 10 after
2275 interstitial->TestDidNavigate(1, url2); 2275 interstitial->TestDidNavigate(1, url2);
2276 EXPECT_TRUE(interstitial->is_showing()); 2276 EXPECT_TRUE(interstitial->is_showing());
2277 EXPECT_EQ(2, controller().GetEntryCount()); 2277 EXPECT_EQ(2, controller().GetEntryCount());
2278 2278
2279 // Create another NavigationController. 2279 // Create another NavigationController.
2280 GURL url3("http://foo2"); 2280 GURL url3("http://foo2");
2281 scoped_ptr<TestWebContents> other_contents( 2281 scoped_ptr<TestWebContents> other_contents(
2282 static_cast<TestWebContents*>(CreateTestWebContents())); 2282 static_cast<TestWebContents*>(CreateTestWebContents()));
2283 NavigationControllerImpl& other_controller = other_contents->GetController(); 2283 NavigationControllerImpl& other_controller = other_contents->GetController();
2284 other_contents->NavigateAndCommit(url3); 2284 other_contents->NavigateAndCommit(url3);
2285 other_contents->ExpectSetHistoryLengthAndPrune( 2285 other_contents->ExpectSetHistoryOffsetAndLength(1, 2);
2286 NavigationEntryImpl::FromNavigationEntry(
2287 other_controller.GetEntryAtIndex(0))->site_instance(), 1,
2288 other_controller.GetEntryAtIndex(0)->GetPageID());
2289 other_controller.CopyStateFromAndPrune(&controller(), false); 2286 other_controller.CopyStateFromAndPrune(&controller(), false);
2290 2287
2291 // The merged controller should only have two entries: url1 and url2. 2288 // The merged controller should only have two entries: url1 and url2.
2292 ASSERT_EQ(2, other_controller.GetEntryCount()); 2289 ASSERT_EQ(2, other_controller.GetEntryCount());
2293 EXPECT_EQ(1, other_controller.GetCurrentEntryIndex()); 2290 EXPECT_EQ(1, other_controller.GetCurrentEntryIndex());
2294 EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->GetURL()); 2291 EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->GetURL());
2295 EXPECT_EQ(url3, other_controller.GetEntryAtIndex(1)->GetURL()); 2292 EXPECT_EQ(url3, other_controller.GetEntryAtIndex(1)->GetURL());
2296 2293
2297 // And the merged controller shouldn't be showing an interstitial. 2294 // And the merged controller shouldn't be showing an interstitial.
2298 EXPECT_FALSE(other_contents->ShowingInterstitialPage()); 2295 EXPECT_FALSE(other_contents->ShowingInterstitialPage());
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
2788 2785
2789 // Destroy the remote player. No power save blockers should remain. 2786 // Destroy the remote player. No power save blockers should remain.
2790 rfh->OnMessageReceived( 2787 rfh->OnMessageReceived(
2791 FrameHostMsg_MediaPausedNotification(0, kPlayerRemoteId)); 2788 FrameHostMsg_MediaPausedNotification(0, kPlayerRemoteId));
2792 EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing()); 2789 EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing());
2793 EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing()); 2790 EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing());
2794 } 2791 }
2795 #endif 2792 #endif
2796 2793
2797 } // namespace content 2794 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698