| 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 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1521 pending_entry->set_should_replace_entry(true); | 1521 pending_entry->set_should_replace_entry(true); |
| 1522 pending_entry->set_should_clear_history_list(true); | 1522 pending_entry->set_should_clear_history_list(true); |
| 1523 EXPECT_EQ(post_data.get(), pending_entry->GetBrowserInitiatedPostData()); | 1523 EXPECT_EQ(post_data.get(), pending_entry->GetBrowserInitiatedPostData()); |
| 1524 EXPECT_TRUE(pending_entry->is_renderer_initiated()); | 1524 EXPECT_TRUE(pending_entry->is_renderer_initiated()); |
| 1525 EXPECT_EQ(transfer_id, pending_entry->transferred_global_request_id()); | 1525 EXPECT_EQ(transfer_id, pending_entry->transferred_global_request_id()); |
| 1526 EXPECT_TRUE(pending_entry->should_replace_entry()); | 1526 EXPECT_TRUE(pending_entry->should_replace_entry()); |
| 1527 EXPECT_TRUE(pending_entry->should_clear_history_list()); | 1527 EXPECT_TRUE(pending_entry->should_clear_history_list()); |
| 1528 | 1528 |
| 1529 // Fake a commit response. | 1529 // Fake a commit response. |
| 1530 main_test_rfh()->PrepareForCommit(); | 1530 main_test_rfh()->PrepareForCommit(); |
| 1531 main_test_rfh()->SendNavigate(1, entry_id, true, url1); | 1531 main_test_rfh()->SendNavigateWithReplacement(1, entry_id, true, url1); |
| 1532 | 1532 |
| 1533 // Certain values that are only used for pending entries get reset after | 1533 // Certain values that are only used for pending entries get reset after |
| 1534 // commit. | 1534 // commit. |
| 1535 NavigationEntryImpl* committed_entry = controller.GetLastCommittedEntry(); | 1535 NavigationEntryImpl* committed_entry = controller.GetLastCommittedEntry(); |
| 1536 EXPECT_FALSE(committed_entry->GetBrowserInitiatedPostData()); | 1536 EXPECT_FALSE(committed_entry->GetBrowserInitiatedPostData()); |
| 1537 EXPECT_FALSE(committed_entry->is_renderer_initiated()); | 1537 EXPECT_FALSE(committed_entry->is_renderer_initiated()); |
| 1538 EXPECT_EQ(GlobalRequestID(-1, -1), | 1538 EXPECT_EQ(GlobalRequestID(-1, -1), |
| 1539 committed_entry->transferred_global_request_id()); | 1539 committed_entry->transferred_global_request_id()); |
| 1540 EXPECT_FALSE(committed_entry->should_replace_entry()); | 1540 EXPECT_FALSE(committed_entry->should_replace_entry()); |
| 1541 EXPECT_FALSE(committed_entry->should_clear_history_list()); | 1541 EXPECT_FALSE(committed_entry->should_clear_history_list()); |
| (...skipping 1871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3413 // http://crbug.com/308444. | 3413 // http://crbug.com/308444. |
| 3414 navigator->DidStartProvisionalLoad(main_test_rfh(), url1, | 3414 navigator->DidStartProvisionalLoad(main_test_rfh(), url1, |
| 3415 base::TimeTicks::Now()); | 3415 base::TimeTicks::Now()); |
| 3416 controller.GetPendingEntry()->set_should_replace_entry(true); | 3416 controller.GetPendingEntry()->set_should_replace_entry(true); |
| 3417 | 3417 |
| 3418 main_test_rfh()->SendRendererInitiatedNavigationRequest(url2, false); | 3418 main_test_rfh()->SendRendererInitiatedNavigationRequest(url2, false); |
| 3419 main_test_rfh()->PrepareForCommit(); | 3419 main_test_rfh()->PrepareForCommit(); |
| 3420 navigator->DidStartProvisionalLoad(main_test_rfh(), url2, | 3420 navigator->DidStartProvisionalLoad(main_test_rfh(), url2, |
| 3421 base::TimeTicks::Now()); | 3421 base::TimeTicks::Now()); |
| 3422 EXPECT_TRUE(controller.GetPendingEntry()->should_replace_entry()); | 3422 EXPECT_TRUE(controller.GetPendingEntry()->should_replace_entry()); |
| 3423 main_test_rfh()->SendNavigate(0, 0, false, url2); | 3423 main_test_rfh()->SendNavigateWithReplacement(0, 0, false, url2); |
| 3424 EXPECT_EQ(url2, controller.GetLastCommittedEntry()->GetURL()); | 3424 EXPECT_EQ(url2, controller.GetLastCommittedEntry()->GetURL()); |
| 3425 } | 3425 } |
| 3426 | 3426 |
| 3427 // Tests that the URLs for renderer-initiated navigations are not displayed to | 3427 // Tests that the URLs for renderer-initiated navigations are not displayed to |
| 3428 // the user until the navigation commits, to prevent URL spoof attacks. | 3428 // the user until the navigation commits, to prevent URL spoof attacks. |
| 3429 // See http://crbug.com/99016. | 3429 // See http://crbug.com/99016. |
| 3430 TEST_F(NavigationControllerTest, DontShowRendererURLUntilCommit) { | 3430 TEST_F(NavigationControllerTest, DontShowRendererURLUntilCommit) { |
| 3431 NavigationControllerImpl& controller = controller_impl(); | 3431 NavigationControllerImpl& controller = controller_impl(); |
| 3432 TestNotificationTracker notifications; | 3432 TestNotificationTracker notifications; |
| 3433 RegisterForAllNavNotifications(¬ifications, &controller); | 3433 RegisterForAllNavNotifications(¬ifications, &controller); |
| (...skipping 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5201 EXPECT_EQ(default_ssl_status.content_status, | 5201 EXPECT_EQ(default_ssl_status.content_status, |
| 5202 observer.details().ssl_status.content_status); | 5202 observer.details().ssl_status.content_status); |
| 5203 EXPECT_EQ( | 5203 EXPECT_EQ( |
| 5204 0u, | 5204 0u, |
| 5205 observer.details().ssl_status.signed_certificate_timestamp_ids.size()); | 5205 observer.details().ssl_status.signed_certificate_timestamp_ids.size()); |
| 5206 | 5206 |
| 5207 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count()); | 5207 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count()); |
| 5208 } | 5208 } |
| 5209 | 5209 |
| 5210 } // namespace content | 5210 } // namespace content |
| OLD | NEW |