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

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

Issue 88503002: Have the unload event execute in background on cross-site navigations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Nasko's comments Created 6 years, 10 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 | Annotate | Revision Log
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 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 increment_active_view_count(); 1090 increment_active_view_count();
1091 1091
1092 // Navigate to a second URL, simulate the beforeunload ack for the cross-site 1092 // Navigate to a second URL, simulate the beforeunload ack for the cross-site
1093 // transition, and set bindings on the pending RenderViewHost to simulate a 1093 // transition, and set bindings on the pending RenderViewHost to simulate a
1094 // privileged url. 1094 // privileged url.
1095 controller.LoadURL(url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); 1095 controller.LoadURL(url2, Referrer(), PAGE_TRANSITION_TYPED, std::string());
1096 orig_rvh->SendShouldCloseACK(true); 1096 orig_rvh->SendShouldCloseACK(true);
1097 contents()->GetPendingRenderViewHost()->AllowBindings(1); 1097 contents()->GetPendingRenderViewHost()->AllowBindings(1);
1098 static_cast<TestRenderViewHost*>( 1098 static_cast<TestRenderViewHost*>(
1099 contents()->GetPendingRenderViewHost())->SendNavigate(1, url2); 1099 contents()->GetPendingRenderViewHost())->SendNavigate(1, url2);
1100 orig_rvh->OnSwappedOut(false);
1100 1101
1101 // The second load should be committed, and bindings should be remembered. 1102 // The second load should be committed, and bindings should be remembered.
1102 EXPECT_EQ(controller.GetEntryCount(), 2); 1103 EXPECT_EQ(controller.GetEntryCount(), 2);
1103 EXPECT_EQ(1, controller.GetLastCommittedEntryIndex()); 1104 EXPECT_EQ(1, controller.GetLastCommittedEntryIndex());
1104 EXPECT_TRUE(controller.CanGoBack()); 1105 EXPECT_TRUE(controller.CanGoBack());
1105 EXPECT_EQ(1, NavigationEntryImpl::FromNavigationEntry( 1106 EXPECT_EQ(1, NavigationEntryImpl::FromNavigationEntry(
1106 controller.GetLastCommittedEntry())->bindings()); 1107 controller.GetLastCommittedEntry())->bindings());
1107 1108
1108 // Going back, the first entry should still appear unprivileged. 1109 // Going back, the first entry should still appear unprivileged.
1109 controller.GoBack(); 1110 controller.GoBack();
(...skipping 2905 matching lines...) Expand 10 before | Expand all | Expand 10 after
4015 EXPECT_EQ(1, controller.GetEntryCount()); 4016 EXPECT_EQ(1, controller.GetEntryCount());
4016 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); 4017 EXPECT_EQ(0, controller.GetCurrentEntryIndex());
4017 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); 4018 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex());
4018 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); 4019 EXPECT_EQ(-1, controller.GetPendingEntryIndex());
4019 EXPECT_FALSE(controller.CanGoBack()); 4020 EXPECT_FALSE(controller.CanGoBack());
4020 EXPECT_FALSE(controller.CanGoForward()); 4021 EXPECT_FALSE(controller.CanGoForward());
4021 EXPECT_EQ(url4, controller.GetVisibleEntry()->GetURL()); 4022 EXPECT_EQ(url4, controller.GetVisibleEntry()->GetURL());
4022 } 4023 }
4023 4024
4024 } // namespace content 4025 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698