| 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/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
| 6 #include "content/browser/browser_thread_impl.h" | 6 #include "content/browser/browser_thread_impl.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_impl.h" | 9 #include "content/browser/site_instance_impl.h" |
| 10 #include "content/browser/web_contents/navigation_entry_impl.h" | 10 #include "content/browser/web_contents/navigation_entry_impl.h" |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 ASSERT_TRUE(pending_rvh()); // New pending RenderViewHost will be created. | 357 ASSERT_TRUE(pending_rvh()); // New pending RenderViewHost will be created. |
| 358 RenderViewHost* last_rvh = pending_rvh(); | 358 RenderViewHost* last_rvh = pending_rvh(); |
| 359 int32 new_id = contents()->GetMaxPageIDForSiteInstance( | 359 int32 new_id = contents()->GetMaxPageIDForSiteInstance( |
| 360 active_rvh()->GetSiteInstance()) + 1; | 360 active_rvh()->GetSiteInstance()) + 1; |
| 361 pending_test_rvh()->SendNavigate(new_id, kUrl); | 361 pending_test_rvh()->SendNavigate(new_id, kUrl); |
| 362 EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 1); | 362 EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 1); |
| 363 ASSERT_TRUE(controller().GetLastCommittedEntry()); | 363 ASSERT_TRUE(controller().GetLastCommittedEntry()); |
| 364 EXPECT_TRUE(kUrl == controller().GetLastCommittedEntry()->GetURL()); | 364 EXPECT_TRUE(kUrl == controller().GetLastCommittedEntry()->GetURL()); |
| 365 EXPECT_FALSE(controller().GetPendingEntry()); | 365 EXPECT_FALSE(controller().GetPendingEntry()); |
| 366 // Because we're using TestWebContents and TestRenderViewHost in this | 366 // Because we're using TestWebContents and TestRenderViewHost in this |
| 367 // unittest, no one calls TabContents::RenderViewCreated(). So, we see no | 367 // unittest, no one calls WebContentsImpl::RenderViewCreated(). So, we see no |
| 368 // EnableViewSourceMode message, here. | 368 // EnableViewSourceMode message, here. |
| 369 | 369 |
| 370 // Clear queued messages before load. | 370 // Clear queued messages before load. |
| 371 process()->sink().ClearMessages(); | 371 process()->sink().ClearMessages(); |
| 372 // Navigate, again. | 372 // Navigate, again. |
| 373 controller().LoadURL( | 373 controller().LoadURL( |
| 374 kUrl, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); | 374 kUrl, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 375 // The same RenderViewHost should be reused. | 375 // The same RenderViewHost should be reused. |
| 376 EXPECT_FALSE(pending_rvh()); | 376 EXPECT_FALSE(pending_rvh()); |
| 377 EXPECT_TRUE(last_rvh == rvh()); | 377 EXPECT_TRUE(last_rvh == rvh()); |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 | 763 |
| 764 // We should be able to navigate forward. | 764 // We should be able to navigate forward. |
| 765 contents()->GetController().GoForward(); | 765 contents()->GetController().GoForward(); |
| 766 contents()->ProceedWithCrossSiteNavigation(); | 766 contents()->ProceedWithCrossSiteNavigation(); |
| 767 const NavigationEntry* entry2 = contents()->GetController().GetPendingEntry(); | 767 const NavigationEntry* entry2 = contents()->GetController().GetPendingEntry(); |
| 768 rvh2->SendNavigate(entry2->GetPageID(), entry2->GetURL()); | 768 rvh2->SendNavigate(entry2->GetPageID(), entry2->GetURL()); |
| 769 EXPECT_EQ(rvh2, rvh()); | 769 EXPECT_EQ(rvh2, rvh()); |
| 770 EXPECT_FALSE(rvh2->is_swapped_out()); | 770 EXPECT_FALSE(rvh2->is_swapped_out()); |
| 771 EXPECT_TRUE(rvh1->is_swapped_out()); | 771 EXPECT_TRUE(rvh1->is_swapped_out()); |
| 772 } | 772 } |
| OLD | NEW |