Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: content/browser/frame_host/navigation_controller_impl_unittest.cc

Issue 1250163002: Fix cross-process location.replace for main frames and subframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and remove some code Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 pending_entry->set_should_replace_entry(true); 1462 pending_entry->set_should_replace_entry(true);
1463 pending_entry->set_should_clear_history_list(true); 1463 pending_entry->set_should_clear_history_list(true);
1464 EXPECT_EQ(post_data.get(), pending_entry->GetBrowserInitiatedPostData()); 1464 EXPECT_EQ(post_data.get(), pending_entry->GetBrowserInitiatedPostData());
1465 EXPECT_TRUE(pending_entry->is_renderer_initiated()); 1465 EXPECT_TRUE(pending_entry->is_renderer_initiated());
1466 EXPECT_EQ(transfer_id, pending_entry->transferred_global_request_id()); 1466 EXPECT_EQ(transfer_id, pending_entry->transferred_global_request_id());
1467 EXPECT_TRUE(pending_entry->should_replace_entry()); 1467 EXPECT_TRUE(pending_entry->should_replace_entry());
1468 EXPECT_TRUE(pending_entry->should_clear_history_list()); 1468 EXPECT_TRUE(pending_entry->should_clear_history_list());
1469 1469
1470 // Fake a commit response. 1470 // Fake a commit response.
1471 main_test_rfh()->PrepareForCommit(); 1471 main_test_rfh()->PrepareForCommit();
1472 main_test_rfh()->SendNavigate(1, entry_id, true, url1); 1472 main_test_rfh()->SendNavigateWithReplacement(1, entry_id, true, url1);
1473 1473
1474 // Certain values that are only used for pending entries get reset after 1474 // Certain values that are only used for pending entries get reset after
1475 // commit. 1475 // commit.
1476 NavigationEntryImpl* committed_entry = controller.GetLastCommittedEntry(); 1476 NavigationEntryImpl* committed_entry = controller.GetLastCommittedEntry();
1477 EXPECT_FALSE(committed_entry->GetBrowserInitiatedPostData()); 1477 EXPECT_FALSE(committed_entry->GetBrowserInitiatedPostData());
1478 EXPECT_FALSE(committed_entry->is_renderer_initiated()); 1478 EXPECT_FALSE(committed_entry->is_renderer_initiated());
1479 EXPECT_EQ(GlobalRequestID(-1, -1), 1479 EXPECT_EQ(GlobalRequestID(-1, -1),
1480 committed_entry->transferred_global_request_id()); 1480 committed_entry->transferred_global_request_id());
1481 EXPECT_FALSE(committed_entry->should_replace_entry()); 1481 EXPECT_FALSE(committed_entry->should_replace_entry());
1482 EXPECT_FALSE(committed_entry->should_clear_history_list()); 1482 EXPECT_FALSE(committed_entry->should_clear_history_list());
(...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after
3350 // http://crbug.com/308444. 3350 // http://crbug.com/308444.
3351 navigator->DidStartProvisionalLoad(main_test_rfh(), url1, 3351 navigator->DidStartProvisionalLoad(main_test_rfh(), url1,
3352 base::TimeTicks::Now()); 3352 base::TimeTicks::Now());
3353 controller.GetPendingEntry()->set_should_replace_entry(true); 3353 controller.GetPendingEntry()->set_should_replace_entry(true);
3354 3354
3355 main_test_rfh()->SendRendererInitiatedNavigationRequest(url2, false); 3355 main_test_rfh()->SendRendererInitiatedNavigationRequest(url2, false);
3356 main_test_rfh()->PrepareForCommit(); 3356 main_test_rfh()->PrepareForCommit();
3357 navigator->DidStartProvisionalLoad(main_test_rfh(), url2, 3357 navigator->DidStartProvisionalLoad(main_test_rfh(), url2,
3358 base::TimeTicks::Now()); 3358 base::TimeTicks::Now());
3359 EXPECT_TRUE(controller.GetPendingEntry()->should_replace_entry()); 3359 EXPECT_TRUE(controller.GetPendingEntry()->should_replace_entry());
3360 main_test_rfh()->SendNavigate(0, 0, false, url2); 3360 main_test_rfh()->SendNavigateWithReplacement(0, 0, false, url2);
3361 EXPECT_EQ(url2, controller.GetLastCommittedEntry()->GetURL()); 3361 EXPECT_EQ(url2, controller.GetLastCommittedEntry()->GetURL());
3362 } 3362 }
3363 3363
3364 // Tests that the URLs for renderer-initiated navigations are not displayed to 3364 // Tests that the URLs for renderer-initiated navigations are not displayed to
3365 // the user until the navigation commits, to prevent URL spoof attacks. 3365 // the user until the navigation commits, to prevent URL spoof attacks.
3366 // See http://crbug.com/99016. 3366 // See http://crbug.com/99016.
3367 TEST_F(NavigationControllerTest, DontShowRendererURLUntilCommit) { 3367 TEST_F(NavigationControllerTest, DontShowRendererURLUntilCommit) {
3368 NavigationControllerImpl& controller = controller_impl(); 3368 NavigationControllerImpl& controller = controller_impl();
3369 TestNotificationTracker notifications; 3369 TestNotificationTracker notifications;
3370 RegisterForAllNavNotifications(&notifications, &controller); 3370 RegisterForAllNavNotifications(&notifications, &controller);
(...skipping 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after
5121 EXPECT_EQ(default_ssl_status.connection_status, 5121 EXPECT_EQ(default_ssl_status.connection_status,
5122 details.ssl_status.connection_status); 5122 details.ssl_status.connection_status);
5123 EXPECT_EQ(default_ssl_status.content_status, 5123 EXPECT_EQ(default_ssl_status.content_status,
5124 details.ssl_status.content_status); 5124 details.ssl_status.content_status);
5125 EXPECT_EQ(0u, details.ssl_status.signed_certificate_timestamp_ids.size()); 5125 EXPECT_EQ(0u, details.ssl_status.signed_certificate_timestamp_ids.size());
5126 5126
5127 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count()); 5127 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count());
5128 } 5128 }
5129 5129
5130 } // namespace content 5130 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl_browsertest.cc ('k') | content/common/frame_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698