| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/browser_thread_impl.h" | 5 #include "content/browser/browser_thread_impl.h" |
| 6 #include "content/browser/browser_url_handler.h" | 6 #include "content/browser/browser_url_handler.h" |
| 7 #include "content/browser/mock_content_browser_client.h" | 7 #include "content/browser/mock_content_browser_client.h" |
| 8 #include "content/browser/renderer_host/test_render_view_host.h" | 8 #include "content/browser/renderer_host/test_render_view_host.h" |
| 9 #include "content/browser/site_instance.h" | 9 #include "content/browser/site_instance.h" |
| 10 #include "content/browser/tab_contents/navigation_controller.h" | 10 #include "content/browser/tab_contents/navigation_controller.h" |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 // Before that RVH has committed, the evil page reloads itself. | 585 // Before that RVH has committed, the evil page reloads itself. |
| 586 ViewHostMsg_FrameNavigate_Params params; | 586 ViewHostMsg_FrameNavigate_Params params; |
| 587 params.page_id = 1; | 587 params.page_id = 1; |
| 588 params.url = kUrl2; | 588 params.url = kUrl2; |
| 589 params.transition = content::PAGE_TRANSITION_CLIENT_REDIRECT; | 589 params.transition = content::PAGE_TRANSITION_CLIENT_REDIRECT; |
| 590 params.should_update_history = false; | 590 params.should_update_history = false; |
| 591 params.gesture = NavigationGestureAuto; | 591 params.gesture = NavigationGestureAuto; |
| 592 params.was_within_same_page = false; | 592 params.was_within_same_page = false; |
| 593 params.is_post = false; | 593 params.is_post = false; |
| 594 params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(kUrl2)); | 594 params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(kUrl2)); |
| 595 contents()->TestDidNavigate(evil_rvh, params); | 595 contents()->DidNavigate(evil_rvh, params); |
| 596 | 596 |
| 597 // That should have cancelled the pending RVH, and the evil RVH should be the | 597 // That should have cancelled the pending RVH, and the evil RVH should be the |
| 598 // current one. | 598 // current one. |
| 599 EXPECT_TRUE(contents()->render_manager_for_testing()-> | 599 EXPECT_TRUE(contents()->render_manager_for_testing()-> |
| 600 pending_render_view_host() == NULL); | 600 pending_render_view_host() == NULL); |
| 601 EXPECT_EQ(evil_rvh, contents()->render_manager_for_testing()->current_host()); | 601 EXPECT_EQ(evil_rvh, contents()->render_manager_for_testing()->current_host()); |
| 602 | 602 |
| 603 // Also we should not have a pending navigation entry. | 603 // Also we should not have a pending navigation entry. |
| 604 NavigationEntry* entry = contents()->controller().GetActiveEntry(); | 604 NavigationEntry* entry = contents()->controller().GetActiveEntry(); |
| 605 ASSERT_TRUE(entry != NULL); | 605 ASSERT_TRUE(entry != NULL); |
| 606 EXPECT_EQ(kUrl2, entry->url()); | 606 EXPECT_EQ(kUrl2, entry->url()); |
| 607 } | 607 } |
| OLD | NEW |