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 "content/browser/frame_host/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/navigation_controller_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1459 pending_entry->set_should_replace_entry(true); | 1459 pending_entry->set_should_replace_entry(true); |
1460 pending_entry->set_should_clear_history_list(true); | 1460 pending_entry->set_should_clear_history_list(true); |
1461 EXPECT_EQ(post_data.get(), pending_entry->GetBrowserInitiatedPostData()); | 1461 EXPECT_EQ(post_data.get(), pending_entry->GetBrowserInitiatedPostData()); |
1462 EXPECT_TRUE(pending_entry->is_renderer_initiated()); | 1462 EXPECT_TRUE(pending_entry->is_renderer_initiated()); |
1463 EXPECT_EQ(transfer_id, pending_entry->transferred_global_request_id()); | 1463 EXPECT_EQ(transfer_id, pending_entry->transferred_global_request_id()); |
1464 EXPECT_TRUE(pending_entry->should_replace_entry()); | 1464 EXPECT_TRUE(pending_entry->should_replace_entry()); |
1465 EXPECT_TRUE(pending_entry->should_clear_history_list()); | 1465 EXPECT_TRUE(pending_entry->should_clear_history_list()); |
1466 | 1466 |
1467 // Fake a commit response. | 1467 // Fake a commit response. |
1468 main_test_rfh()->PrepareForCommit(); | 1468 main_test_rfh()->PrepareForCommit(); |
1469 main_test_rfh()->SendNavigate(1, entry_id, true, url1); | 1469 main_test_rfh()->SendNavigateWithReplacement(1, entry_id, true, url1); |
1470 | 1470 |
1471 // Certain values that are only used for pending entries get reset after | 1471 // Certain values that are only used for pending entries get reset after |
1472 // commit. | 1472 // commit. |
1473 NavigationEntryImpl* committed_entry = controller.GetLastCommittedEntry(); | 1473 NavigationEntryImpl* committed_entry = controller.GetLastCommittedEntry(); |
1474 EXPECT_FALSE(committed_entry->GetBrowserInitiatedPostData()); | 1474 EXPECT_FALSE(committed_entry->GetBrowserInitiatedPostData()); |
1475 EXPECT_FALSE(committed_entry->is_renderer_initiated()); | 1475 EXPECT_FALSE(committed_entry->is_renderer_initiated()); |
1476 EXPECT_EQ(GlobalRequestID(-1, -1), | 1476 EXPECT_EQ(GlobalRequestID(-1, -1), |
1477 committed_entry->transferred_global_request_id()); | 1477 committed_entry->transferred_global_request_id()); |
1478 EXPECT_FALSE(committed_entry->should_replace_entry()); | 1478 EXPECT_FALSE(committed_entry->should_replace_entry()); |
1479 EXPECT_FALSE(committed_entry->should_clear_history_list()); | 1479 EXPECT_FALSE(committed_entry->should_clear_history_list()); |
(...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3347 // http://crbug.com/308444. | 3347 // http://crbug.com/308444. |
3348 navigator->DidStartProvisionalLoad(main_test_rfh(), url1, | 3348 navigator->DidStartProvisionalLoad(main_test_rfh(), url1, |
3349 base::TimeTicks::Now()); | 3349 base::TimeTicks::Now()); |
3350 controller.GetPendingEntry()->set_should_replace_entry(true); | 3350 controller.GetPendingEntry()->set_should_replace_entry(true); |
3351 | 3351 |
3352 main_test_rfh()->SendRendererInitiatedNavigationRequest(url2, false); | 3352 main_test_rfh()->SendRendererInitiatedNavigationRequest(url2, false); |
3353 main_test_rfh()->PrepareForCommit(); | 3353 main_test_rfh()->PrepareForCommit(); |
3354 navigator->DidStartProvisionalLoad(main_test_rfh(), url2, | 3354 navigator->DidStartProvisionalLoad(main_test_rfh(), url2, |
3355 base::TimeTicks::Now()); | 3355 base::TimeTicks::Now()); |
3356 EXPECT_TRUE(controller.GetPendingEntry()->should_replace_entry()); | 3356 EXPECT_TRUE(controller.GetPendingEntry()->should_replace_entry()); |
3357 main_test_rfh()->SendNavigate(0, 0, false, url2); | 3357 main_test_rfh()->SendNavigateWithReplacement(0, 0, false, url2); |
3358 EXPECT_EQ(url2, controller.GetLastCommittedEntry()->GetURL()); | 3358 EXPECT_EQ(url2, controller.GetLastCommittedEntry()->GetURL()); |
3359 } | 3359 } |
3360 | 3360 |
3361 // Tests that the URLs for renderer-initiated navigations are not displayed to | 3361 // Tests that the URLs for renderer-initiated navigations are not displayed to |
3362 // the user until the navigation commits, to prevent URL spoof attacks. | 3362 // the user until the navigation commits, to prevent URL spoof attacks. |
3363 // See http://crbug.com/99016. | 3363 // See http://crbug.com/99016. |
3364 TEST_F(NavigationControllerTest, DontShowRendererURLUntilCommit) { | 3364 TEST_F(NavigationControllerTest, DontShowRendererURLUntilCommit) { |
3365 NavigationControllerImpl& controller = controller_impl(); | 3365 NavigationControllerImpl& controller = controller_impl(); |
3366 TestNotificationTracker notifications; | 3366 TestNotificationTracker notifications; |
3367 RegisterForAllNavNotifications(¬ifications, &controller); | 3367 RegisterForAllNavNotifications(¬ifications, &controller); |
(...skipping 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5118 EXPECT_EQ(default_ssl_status.connection_status, | 5118 EXPECT_EQ(default_ssl_status.connection_status, |
5119 details.ssl_status.connection_status); | 5119 details.ssl_status.connection_status); |
5120 EXPECT_EQ(default_ssl_status.content_status, | 5120 EXPECT_EQ(default_ssl_status.content_status, |
5121 details.ssl_status.content_status); | 5121 details.ssl_status.content_status); |
5122 EXPECT_EQ(0u, details.ssl_status.signed_certificate_timestamp_ids.size()); | 5122 EXPECT_EQ(0u, details.ssl_status.signed_certificate_timestamp_ids.size()); |
5123 | 5123 |
5124 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count()); | 5124 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count()); |
5125 } | 5125 } |
5126 | 5126 |
5127 } // namespace content | 5127 } // namespace content |
OLD | NEW |