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

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

Issue 180993003: Revert "Revert 249676 "Have the unload event execute in background on cr..."" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Delete RFH pending shutdown in all nodes of the FrameTree Created 6 years, 9 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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 increment_active_view_count(); 1088 increment_active_view_count();
1089 1089
1090 // Navigate to a second URL, simulate the beforeunload ack for the cross-site 1090 // Navigate to a second URL, simulate the beforeunload ack for the cross-site
1091 // transition, and set bindings on the pending RenderViewHost to simulate a 1091 // transition, and set bindings on the pending RenderViewHost to simulate a
1092 // privileged url. 1092 // privileged url.
1093 controller.LoadURL(url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); 1093 controller.LoadURL(url2, Referrer(), PAGE_TRANSITION_TYPED, std::string());
1094 orig_rvh->SendShouldCloseACK(true); 1094 orig_rvh->SendShouldCloseACK(true);
1095 contents()->GetPendingRenderViewHost()->AllowBindings(1); 1095 contents()->GetPendingRenderViewHost()->AllowBindings(1);
1096 static_cast<TestRenderViewHost*>( 1096 static_cast<TestRenderViewHost*>(
1097 contents()->GetPendingRenderViewHost())->SendNavigate(1, url2); 1097 contents()->GetPendingRenderViewHost())->SendNavigate(1, url2);
1098 orig_rvh->OnSwappedOut(false);
1098 1099
1099 // The second load should be committed, and bindings should be remembered. 1100 // The second load should be committed, and bindings should be remembered.
1100 EXPECT_EQ(controller.GetEntryCount(), 2); 1101 EXPECT_EQ(controller.GetEntryCount(), 2);
1101 EXPECT_EQ(1, controller.GetLastCommittedEntryIndex()); 1102 EXPECT_EQ(1, controller.GetLastCommittedEntryIndex());
1102 EXPECT_TRUE(controller.CanGoBack()); 1103 EXPECT_TRUE(controller.CanGoBack());
1103 EXPECT_EQ(1, NavigationEntryImpl::FromNavigationEntry( 1104 EXPECT_EQ(1, NavigationEntryImpl::FromNavigationEntry(
1104 controller.GetLastCommittedEntry())->bindings()); 1105 controller.GetLastCommittedEntry())->bindings());
1105 1106
1106 // Going back, the first entry should still appear unprivileged. 1107 // Going back, the first entry should still appear unprivileged.
1107 controller.GoBack(); 1108 controller.GoBack();
(...skipping 2905 matching lines...) Expand 10 before | Expand all | Expand 10 after
4013 EXPECT_EQ(1, controller.GetEntryCount()); 4014 EXPECT_EQ(1, controller.GetEntryCount());
4014 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); 4015 EXPECT_EQ(0, controller.GetCurrentEntryIndex());
4015 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); 4016 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex());
4016 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); 4017 EXPECT_EQ(-1, controller.GetPendingEntryIndex());
4017 EXPECT_FALSE(controller.CanGoBack()); 4018 EXPECT_FALSE(controller.CanGoBack());
4018 EXPECT_FALSE(controller.CanGoForward()); 4019 EXPECT_FALSE(controller.CanGoForward());
4019 EXPECT_EQ(url4, controller.GetVisibleEntry()->GetURL()); 4020 EXPECT_EQ(url4, controller.GetVisibleEntry()->GetURL());
4020 } 4021 }
4021 4022
4022 } // namespace content 4023 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/frame_tree.cc ('k') | content/browser/frame_host/render_frame_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698