Chromium Code Reviews| 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 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 938 params.is_post = false; | 938 params.is_post = false; |
| 939 params.page_state = PageState::CreateFromURL(kUrl2); | 939 params.page_state = PageState::CreateFromURL(kUrl2); |
| 940 contents()->DidNavigate(evil_rvh, params); | 940 contents()->DidNavigate(evil_rvh, params); |
| 941 | 941 |
| 942 // That should have cancelled the pending RVH, and the evil RVH should be the | 942 // That should have cancelled the pending RVH, and the evil RVH should be the |
| 943 // current one. | 943 // current one. |
| 944 EXPECT_TRUE(contents()->GetRenderManagerForTesting()-> | 944 EXPECT_TRUE(contents()->GetRenderManagerForTesting()-> |
| 945 pending_render_view_host() == NULL); | 945 pending_render_view_host() == NULL); |
| 946 EXPECT_EQ(evil_rvh, contents()->GetRenderManagerForTesting()->current_host()); | 946 EXPECT_EQ(evil_rvh, contents()->GetRenderManagerForTesting()->current_host()); |
| 947 | 947 |
| 948 // Also we should not have a pending navigation entry. | 948 // Also we should not have a pending navigation entry. |
|
Charlie Reis
2013/08/16 22:10:14
Can you add a check that GetPendingEntry is null?
nasko
2013/09/12 17:56:31
Done.
| |
| 949 NavigationEntry* entry = contents()->GetController().GetActiveEntry(); | 949 NavigationEntry* entry = contents()->GetController().GetVisibleEntry(); |
| 950 ASSERT_TRUE(entry != NULL); | 950 ASSERT_TRUE(entry != NULL); |
| 951 EXPECT_EQ(kUrl2, entry->GetURL()); | 951 EXPECT_EQ(kUrl2, entry->GetURL()); |
| 952 } | 952 } |
| 953 | 953 |
| 954 // Ensure that we can go back and forward even if a SwapOut ACK isn't received. | 954 // Ensure that we can go back and forward even if a SwapOut ACK isn't received. |
| 955 // See http://crbug.com/93427. | 955 // See http://crbug.com/93427. |
| 956 TEST_F(RenderViewHostManagerTest, NavigateAfterMissingSwapOutACK) { | 956 TEST_F(RenderViewHostManagerTest, NavigateAfterMissingSwapOutACK) { |
| 957 const GURL kUrl1("http://www.google.com/"); | 957 const GURL kUrl1("http://www.google.com/"); |
| 958 const GURL kUrl2("http://www.chromium.org/"); | 958 const GURL kUrl2("http://www.chromium.org/"); |
| 959 | 959 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1205 | 1205 |
| 1206 // Commit. | 1206 // Commit. |
| 1207 manager.DidNavigateMainFrame(host); | 1207 manager.DidNavigateMainFrame(host); |
| 1208 EXPECT_EQ(host, manager.current_host()); | 1208 EXPECT_EQ(host, manager.current_host()); |
| 1209 ASSERT_TRUE(host); | 1209 ASSERT_TRUE(host); |
| 1210 EXPECT_EQ(static_cast<SiteInstanceImpl*>(host->GetSiteInstance()), | 1210 EXPECT_EQ(static_cast<SiteInstanceImpl*>(host->GetSiteInstance()), |
| 1211 instance); | 1211 instance); |
| 1212 } | 1212 } |
| 1213 | 1213 |
| 1214 } // namespace content | 1214 } // namespace content |
| OLD | NEW |