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

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

Issue 23978003: Delete unneeded pending entries in DidFailProvisionalLoad to prevent a spoof. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only clear the pending entry, not the transient. Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/file_util.h" 7 #include "base/file_util.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 params.frame_id = 1; 1001 params.frame_id = 1;
1002 params.is_main_frame = true; 1002 params.is_main_frame = true;
1003 params.error_code = net::ERR_ABORTED; 1003 params.error_code = net::ERR_ABORTED;
1004 params.error_description = string16(); 1004 params.error_description = string16();
1005 params.url = kRedirectURL; 1005 params.url = kRedirectURL;
1006 params.showing_repost_interstitial = false; 1006 params.showing_repost_interstitial = false;
1007 test_rvh()->OnMessageReceived( 1007 test_rvh()->OnMessageReceived(
1008 ViewHostMsg_DidFailProvisionalLoadWithError(0, // routing_id 1008 ViewHostMsg_DidFailProvisionalLoadWithError(0, // routing_id
1009 params)); 1009 params));
1010 1010
1011 // This should not clear the pending entry or notify of a navigation state 1011 // Because the pending entry is renderer initiated and not visible, we
1012 // change. 1012 // clear it when it fails.
1013 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); 1013 EXPECT_EQ(-1, controller.GetPendingEntryIndex());
1014 EXPECT_TRUE(controller.GetPendingEntry()); 1014 EXPECT_FALSE(controller.GetPendingEntry());
1015 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); 1015 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex());
1016 EXPECT_EQ(0, delegate->navigation_state_change_count()); 1016 EXPECT_EQ(0, delegate->navigation_state_change_count());
1017 1017
1018 // The visible entry should be the last committed URL, not the pending one, 1018 // The visible entry should be the last committed URL, not the pending one,
1019 // so that no spoof is possible. 1019 // so that no spoof is possible.
1020 EXPECT_EQ(kExistingURL, controller.GetVisibleEntry()->GetURL()); 1020 EXPECT_EQ(kExistingURL, controller.GetVisibleEntry()->GetURL());
1021 1021
1022 contents()->SetDelegate(NULL); 1022 contents()->SetDelegate(NULL);
1023 } 1023 }
1024 1024
(...skipping 2926 matching lines...) Expand 10 before | Expand all | Expand 10 after
3951 PAGE_TRANSITION_LINK); 3951 PAGE_TRANSITION_LINK);
3952 session_helper_.AssertNavigationEquals(nav, 3952 session_helper_.AssertNavigationEquals(nav,
3953 windows_[0]->tabs[0]->navigations[0]); 3953 windows_[0]->tabs[0]->navigations[0]);
3954 nav.set_url(url2); 3954 nav.set_url(url2);
3955 session_helper_.AssertNavigationEquals(nav, 3955 session_helper_.AssertNavigationEquals(nav,
3956 windows_[0]->tabs[0]->navigations[1]); 3956 windows_[0]->tabs[0]->navigations[1]);
3957 } 3957 }
3958 */ 3958 */
3959 3959
3960 } // namespace content 3960 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/navigation_controller_impl.cc ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698