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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 2806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2817 entry->SetTitle(base::ASCIIToUTF16("Title")); | 2817 entry->SetTitle(base::ASCIIToUTF16("Title")); |
2818 entry->SetPageState(PageState::CreateFromEncodedData("state")); | 2818 entry->SetPageState(PageState::CreateFromEncodedData("state")); |
2819 entries.push_back(entry); | 2819 entries.push_back(entry); |
2820 scoped_ptr<WebContentsImpl> our_contents(static_cast<WebContentsImpl*>( | 2820 scoped_ptr<WebContentsImpl> our_contents(static_cast<WebContentsImpl*>( |
2821 WebContents::Create(WebContents::CreateParams(browser_context())))); | 2821 WebContents::Create(WebContents::CreateParams(browser_context())))); |
2822 NavigationControllerImpl& our_controller = our_contents->GetController(); | 2822 NavigationControllerImpl& our_controller = our_contents->GetController(); |
2823 our_controller.Restore( | 2823 our_controller.Restore( |
2824 0, NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, &entries); | 2824 0, NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, &entries); |
2825 ASSERT_EQ(0u, entries.size()); | 2825 ASSERT_EQ(0u, entries.size()); |
2826 | 2826 |
| 2827 // Ensure the RenderFrame is initialized before simulating events coming from |
| 2828 // it. |
| 2829 main_test_rfh()->InitializeRenderFrameIfNeeded(); |
| 2830 |
2827 // Before navigating to the restored entry, it should have a restore_type | 2831 // Before navigating to the restored entry, it should have a restore_type |
2828 // and no SiteInstance. | 2832 // and no SiteInstance. |
2829 entry = our_controller.GetEntryAtIndex(0); | 2833 entry = our_controller.GetEntryAtIndex(0); |
2830 EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY, | 2834 EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY, |
2831 our_controller.GetEntryAtIndex(0)->restore_type()); | 2835 our_controller.GetEntryAtIndex(0)->restore_type()); |
2832 EXPECT_FALSE(our_controller.GetEntryAtIndex(0)->site_instance()); | 2836 EXPECT_FALSE(our_controller.GetEntryAtIndex(0)->site_instance()); |
2833 | 2837 |
2834 // After navigating, we should have one entry, and it should be "pending". | 2838 // After navigating, we should have one entry, and it should be "pending". |
2835 // It should now have a SiteInstance and no restore_type. | 2839 // It should now have a SiteInstance and no restore_type. |
2836 our_controller.GoToIndex(0); | 2840 our_controller.GoToIndex(0); |
(...skipping 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4897 { | 4901 { |
4898 LoadCommittedDetails details; | 4902 LoadCommittedDetails details; |
4899 controller_impl().RendererDidNavigate(main_test_rfh(), params, &details); | 4903 controller_impl().RendererDidNavigate(main_test_rfh(), params, &details); |
4900 EXPECT_EQ(PAGE_TYPE_ERROR, | 4904 EXPECT_EQ(PAGE_TYPE_ERROR, |
4901 controller_impl().GetLastCommittedEntry()->GetPageType()); | 4905 controller_impl().GetLastCommittedEntry()->GetPageType()); |
4902 EXPECT_EQ(NAVIGATION_TYPE_IN_PAGE, details.type); | 4906 EXPECT_EQ(NAVIGATION_TYPE_IN_PAGE, details.type); |
4903 } | 4907 } |
4904 } | 4908 } |
4905 | 4909 |
4906 } // namespace content | 4910 } // namespace content |
OLD | NEW |