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 2775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2786 ASSERT_EQ(0u, entries.size()); | 2786 ASSERT_EQ(0u, entries.size()); |
2787 | 2787 |
2788 // Before navigating to the restored entry, it should have a restore_type | 2788 // Before navigating to the restored entry, it should have a restore_type |
2789 // and no SiteInstance. | 2789 // and no SiteInstance. |
2790 ASSERT_EQ(1, our_controller.GetEntryCount()); | 2790 ASSERT_EQ(1, our_controller.GetEntryCount()); |
2791 EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY, | 2791 EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY, |
2792 our_controller.GetEntryAtIndex(0)->restore_type()); | 2792 our_controller.GetEntryAtIndex(0)->restore_type()); |
2793 EXPECT_FALSE(our_controller.GetEntryAtIndex(0)->site_instance()); | 2793 EXPECT_FALSE(our_controller.GetEntryAtIndex(0)->site_instance()); |
2794 | 2794 |
2795 // After navigating, we should have one entry, and it should be "pending". | 2795 // After navigating, we should have one entry, and it should be "pending". |
2796 // It should now have a SiteInstance and no restore_type. | |
2797 our_controller.GoToIndex(0); | 2796 our_controller.GoToIndex(0); |
2798 EXPECT_EQ(1, our_controller.GetEntryCount()); | 2797 EXPECT_EQ(1, our_controller.GetEntryCount()); |
2799 EXPECT_EQ(our_controller.GetEntryAtIndex(0), | 2798 EXPECT_EQ(our_controller.GetEntryAtIndex(0), |
2800 our_controller.GetPendingEntry()); | 2799 our_controller.GetPendingEntry()); |
2801 EXPECT_EQ(0, our_controller.GetEntryAtIndex(0)->GetPageID()); | 2800 EXPECT_EQ(0, our_controller.GetEntryAtIndex(0)->GetPageID()); |
2802 EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, | |
2803 our_controller.GetEntryAtIndex(0)->restore_type()); | |
2804 EXPECT_TRUE(our_controller.GetEntryAtIndex(0)->site_instance()); | |
2805 | 2801 |
2806 // Timestamp should remain the same before the navigation finishes. | 2802 // Timestamp should remain the same before the navigation finishes. |
2807 EXPECT_EQ(timestamp, our_controller.GetEntryAtIndex(0)->GetTimestamp()); | 2803 EXPECT_EQ(timestamp, our_controller.GetEntryAtIndex(0)->GetTimestamp()); |
2808 | 2804 |
2809 // Say we navigated to that entry. | 2805 // Say we navigated to that entry. |
2810 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 2806 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
2811 params.page_id = 0; | 2807 params.page_id = 0; |
2812 params.nav_entry_id = our_controller.GetPendingEntry()->GetUniqueID(); | 2808 params.nav_entry_id = our_controller.GetPendingEntry()->GetUniqueID(); |
2813 params.did_create_new_entry = false; | 2809 params.did_create_new_entry = false; |
2814 params.url = url; | 2810 params.url = url; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2863 main_test_rfh()->InitializeRenderFrameIfNeeded(); | 2859 main_test_rfh()->InitializeRenderFrameIfNeeded(); |
2864 | 2860 |
2865 // Before navigating to the restored entry, it should have a restore_type | 2861 // Before navigating to the restored entry, it should have a restore_type |
2866 // and no SiteInstance. | 2862 // and no SiteInstance. |
2867 NavigationEntry* entry = our_controller.GetEntryAtIndex(0); | 2863 NavigationEntry* entry = our_controller.GetEntryAtIndex(0); |
2868 EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY, | 2864 EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY, |
2869 our_controller.GetEntryAtIndex(0)->restore_type()); | 2865 our_controller.GetEntryAtIndex(0)->restore_type()); |
2870 EXPECT_FALSE(our_controller.GetEntryAtIndex(0)->site_instance()); | 2866 EXPECT_FALSE(our_controller.GetEntryAtIndex(0)->site_instance()); |
2871 | 2867 |
2872 // After navigating, we should have one entry, and it should be "pending". | 2868 // After navigating, we should have one entry, and it should be "pending". |
2873 // It should now have a SiteInstance and no restore_type. | |
2874 our_controller.GoToIndex(0); | 2869 our_controller.GoToIndex(0); |
2875 EXPECT_EQ(1, our_controller.GetEntryCount()); | 2870 EXPECT_EQ(1, our_controller.GetEntryCount()); |
2876 EXPECT_EQ(our_controller.GetEntryAtIndex(0), | 2871 EXPECT_EQ(our_controller.GetEntryAtIndex(0), |
2877 our_controller.GetPendingEntry()); | 2872 our_controller.GetPendingEntry()); |
2878 EXPECT_EQ(0, our_controller.GetEntryAtIndex(0)->GetPageID()); | 2873 EXPECT_EQ(0, our_controller.GetEntryAtIndex(0)->GetPageID()); |
2879 EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, | |
2880 our_controller.GetEntryAtIndex(0)->restore_type()); | |
2881 EXPECT_TRUE(our_controller.GetEntryAtIndex(0)->site_instance()); | |
2882 | 2874 |
2883 // This pending navigation may have caused a different navigation to fail, | 2875 // This pending navigation may have caused a different navigation to fail, |
2884 // which causes the pending entry to be cleared. | 2876 // which causes the pending entry to be cleared. |
2885 FrameHostMsg_DidFailProvisionalLoadWithError_Params fail_load_params; | 2877 FrameHostMsg_DidFailProvisionalLoadWithError_Params fail_load_params; |
2886 fail_load_params.error_code = net::ERR_ABORTED; | 2878 fail_load_params.error_code = net::ERR_ABORTED; |
2887 fail_load_params.error_description = base::string16(); | 2879 fail_load_params.error_description = base::string16(); |
2888 fail_load_params.url = url; | 2880 fail_load_params.url = url; |
2889 fail_load_params.showing_repost_interstitial = false; | 2881 fail_load_params.showing_repost_interstitial = false; |
2890 main_test_rfh()->InitializeRenderFrameIfNeeded(); | 2882 main_test_rfh()->InitializeRenderFrameIfNeeded(); |
2891 main_test_rfh()->OnMessageReceived( | 2883 main_test_rfh()->OnMessageReceived( |
(...skipping 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5037 EXPECT_EQ(default_ssl_status.connection_status, | 5029 EXPECT_EQ(default_ssl_status.connection_status, |
5038 details.ssl_status.connection_status); | 5030 details.ssl_status.connection_status); |
5039 EXPECT_EQ(default_ssl_status.content_status, | 5031 EXPECT_EQ(default_ssl_status.content_status, |
5040 details.ssl_status.content_status); | 5032 details.ssl_status.content_status); |
5041 EXPECT_EQ(0u, details.ssl_status.signed_certificate_timestamp_ids.size()); | 5033 EXPECT_EQ(0u, details.ssl_status.signed_certificate_timestamp_ids.size()); |
5042 | 5034 |
5043 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count()); | 5035 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count()); |
5044 } | 5036 } |
5045 | 5037 |
5046 } // namespace content | 5038 } // namespace content |
OLD | NEW |