OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |