| OLD | NEW |
| 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/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
| 6 #include "content/browser/renderer_host/test_render_view_host.h" | 6 #include "content/browser/renderer_host/test_render_view_host.h" |
| 7 #include "content/browser/site_instance_impl.h" | 7 #include "content/browser/site_instance_impl.h" |
| 8 #include "content/browser/web_contents/navigation_controller_impl.h" | 8 #include "content/browser/web_contents/navigation_controller_impl.h" |
| 9 #include "content/browser/web_contents/navigation_entry_impl.h" | 9 #include "content/browser/web_contents/navigation_entry_impl.h" |
| 10 #include "content/browser/web_contents/render_view_host_manager.h" | 10 #include "content/browser/web_contents/render_view_host_manager.h" |
| (...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 params.page_state = PageState::CreateFromURL(kUrl2); | 957 params.page_state = PageState::CreateFromURL(kUrl2); |
| 958 contents()->DidNavigate(evil_rvh, params); | 958 contents()->DidNavigate(evil_rvh, params); |
| 959 | 959 |
| 960 // That should have cancelled the pending RVH, and the evil RVH should be the | 960 // That should have cancelled the pending RVH, and the evil RVH should be the |
| 961 // current one. | 961 // current one. |
| 962 EXPECT_TRUE(contents()->GetRenderManagerForTesting()-> | 962 EXPECT_TRUE(contents()->GetRenderManagerForTesting()-> |
| 963 pending_render_view_host() == NULL); | 963 pending_render_view_host() == NULL); |
| 964 EXPECT_EQ(evil_rvh, contents()->GetRenderManagerForTesting()->current_host()); | 964 EXPECT_EQ(evil_rvh, contents()->GetRenderManagerForTesting()->current_host()); |
| 965 | 965 |
| 966 // Also we should not have a pending navigation entry. | 966 // Also we should not have a pending navigation entry. |
| 967 NavigationEntry* entry = contents()->GetController().GetActiveEntry(); | 967 EXPECT_TRUE(contents()->GetController().GetPendingEntry() == NULL); |
| 968 NavigationEntry* entry = contents()->GetController().GetVisibleEntry(); |
| 968 ASSERT_TRUE(entry != NULL); | 969 ASSERT_TRUE(entry != NULL); |
| 969 EXPECT_EQ(kUrl2, entry->GetURL()); | 970 EXPECT_EQ(kUrl2, entry->GetURL()); |
| 970 } | 971 } |
| 971 | 972 |
| 972 // Ensure that we can go back and forward even if a SwapOut ACK isn't received. | 973 // Ensure that we can go back and forward even if a SwapOut ACK isn't received. |
| 973 // See http://crbug.com/93427. | 974 // See http://crbug.com/93427. |
| 974 TEST_F(RenderViewHostManagerTest, NavigateAfterMissingSwapOutACK) { | 975 TEST_F(RenderViewHostManagerTest, NavigateAfterMissingSwapOutACK) { |
| 975 const GURL kUrl1("http://www.google.com/"); | 976 const GURL kUrl1("http://www.google.com/"); |
| 976 const GURL kUrl2("http://www.chromium.org/"); | 977 const GURL kUrl2("http://www.chromium.org/"); |
| 977 | 978 |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 Source<RenderWidgetHost>(host2)); | 1299 Source<RenderWidgetHost>(host2)); |
| 1299 manager.ShouldClosePage(false, true, base::TimeTicks()); | 1300 manager.ShouldClosePage(false, true, base::TimeTicks()); |
| 1300 | 1301 |
| 1301 EXPECT_TRUE( | 1302 EXPECT_TRUE( |
| 1302 notifications.Check1AndReset(NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED)); | 1303 notifications.Check1AndReset(NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED)); |
| 1303 EXPECT_FALSE(manager.pending_render_view_host()); | 1304 EXPECT_FALSE(manager.pending_render_view_host()); |
| 1304 EXPECT_EQ(host, manager.current_host()); | 1305 EXPECT_EQ(host, manager.current_host()); |
| 1305 } | 1306 } |
| 1306 | 1307 |
| 1307 } // namespace content | 1308 } // namespace content |
| OLD | NEW |