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

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

Issue 372403002: Allow "cross-origin" navigations from about:blank in AreURLsInPageNavigation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 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/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 3097 matching lines...) Expand 10 before | Expand all | Expand 10 after
3108 // Going back to the non ref url will be considered in-page if the navigation 3108 // Going back to the non ref url will be considered in-page if the navigation
3109 // type is IN_PAGE. 3109 // type is IN_PAGE.
3110 EXPECT_TRUE(controller.IsURLInPageNavigation(url, true, 3110 EXPECT_TRUE(controller.IsURLInPageNavigation(url, true,
3111 main_test_rfh())); 3111 main_test_rfh()));
3112 3112
3113 // If the renderer says this is a same-origin in-page navigation, believe it. 3113 // If the renderer says this is a same-origin in-page navigation, believe it.
3114 // This is the pushState/replaceState case. 3114 // This is the pushState/replaceState case.
3115 EXPECT_TRUE(controller.IsURLInPageNavigation(other_url, true, 3115 EXPECT_TRUE(controller.IsURLInPageNavigation(other_url, true,
3116 main_test_rfh())); 3116 main_test_rfh()));
3117 3117
3118 // If the renderer navigates from about:blank, believe it. This can happen
3119 // when an iframe is created and populated via document.write(), then tries
3120 // to perform a fragment navigation.
3121 const GURL blank_url(url::kAboutBlankURL);
3122 main_test_rfh()->SendNavigate(0, blank_url);
3123 EXPECT_TRUE(controller.IsURLInPageNavigation(other_url, true,
3124 main_test_rfh()));
3125 main_test_rfh()->SendNavigate(0, url);
3126
3118 // Don't believe the renderer if it claims a cross-origin navigation is 3127 // Don't believe the renderer if it claims a cross-origin navigation is
3119 // in-page. 3128 // in-page.
3120 const GURL different_origin_url("http://www.example.com"); 3129 const GURL different_origin_url("http://www.example.com");
3121 MockRenderProcessHost* rph = 3130 MockRenderProcessHost* rph =
3122 static_cast<MockRenderProcessHost*>(main_test_rfh()->GetProcess()); 3131 static_cast<MockRenderProcessHost*>(main_test_rfh()->GetProcess());
3123 EXPECT_EQ(0, rph->bad_msg_count()); 3132 EXPECT_EQ(0, rph->bad_msg_count());
3124 EXPECT_FALSE(controller.IsURLInPageNavigation(different_origin_url, true, 3133 EXPECT_FALSE(controller.IsURLInPageNavigation(different_origin_url, true,
3125 main_test_rfh())); 3134 main_test_rfh()));
3126 EXPECT_EQ(1, rph->bad_msg_count()); 3135 EXPECT_EQ(1, rph->bad_msg_count());
3127 } 3136 }
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after
4325 params.post_id = -1; 4334 params.post_id = -1;
4326 test_rvh()->SendNavigateWithParams(&params); 4335 test_rvh()->SendNavigateWithParams(&params);
4327 4336
4328 // Now reload. replaceState overrides the POST, so we should not show a 4337 // Now reload. replaceState overrides the POST, so we should not show a
4329 // repost warning dialog. 4338 // repost warning dialog.
4330 controller_impl().Reload(true); 4339 controller_impl().Reload(true);
4331 EXPECT_EQ(0, delegate->repost_form_warning_count()); 4340 EXPECT_EQ(0, delegate->repost_form_warning_count());
4332 } 4341 }
4333 4342
4334 } // namespace content 4343 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698