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

Unified Diff: content/browser/web_contents/navigation_controller_impl_unittest.cc

Issue 12086109: Prevent bindings escalation on an existing NavigationEntry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/navigation_controller_impl_unittest.cc
diff --git a/content/browser/web_contents/navigation_controller_impl_unittest.cc b/content/browser/web_contents/navigation_controller_impl_unittest.cc
index 2a4592bd532f92db110687a5b15cbe48b156c763..da9037829482fabec359c476dbdd011b45573358 100644
--- a/content/browser/web_contents/navigation_controller_impl_unittest.cc
+++ b/content/browser/web_contents/navigation_controller_impl_unittest.cc
@@ -300,6 +300,8 @@ TEST_F(NavigationControllerTest, LoadURL) {
EXPECT_FALSE(controller.CanGoBack());
EXPECT_FALSE(controller.CanGoForward());
EXPECT_EQ(contents()->GetMaxPageID(), 0);
+ EXPECT_EQ(0, NavigationEntryImpl::FromNavigationEntry(
+ controller.GetLastCommittedEntry())->bindings());
// The timestamp should have been set.
EXPECT_FALSE(controller.GetActiveEntry()->GetTimestamp().is_null());
@@ -865,6 +867,30 @@ TEST_F(NavigationControllerTest, LoadURL_RedirectAbortDoesntShowPendingURL) {
contents()->SetDelegate(NULL);
}
+// Ensure that NavigationEntries track which bindings their RenderViewHost had
+// at the time they committed. http://crbug.com/173672.
+TEST_F(NavigationControllerTest, LoadURL_WithBindings) {
+ NavigationControllerImpl& controller = controller_impl();
+ TestNotificationTracker notifications;
+ RegisterForAllNavNotifications(&notifications, &controller);
+
+ const GURL url1("http://foo1");
+
+ controller.LoadURL(url1, Referrer(), PAGE_TRANSITION_TYPED, std::string());
+
+ // Set bindings on the underlying RenderViewHost to simulate a privileged url.
+ test_rvh()->AllowBindings(1);
+
+ test_rvh()->SendNavigate(0, url1);
+ EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED));
+
+ // The load should now be committed, and bindings should be remembered.
+ EXPECT_EQ(controller.GetEntryCount(), 1);
+ EXPECT_TRUE(controller.GetLastCommittedEntry());
+ EXPECT_EQ(1, NavigationEntryImpl::FromNavigationEntry(
+ controller.GetLastCommittedEntry())->bindings());
Chris Evans 2013/02/01 22:47:47 Is it possible to actually do a history.back() and
Charlie Reis 2013/02/04 06:03:40 In the first patchset, there's only one entry and
+}
+
TEST_F(NavigationControllerTest, Reload) {
NavigationControllerImpl& controller = controller_impl();
TestNotificationTracker notifications;

Powered by Google App Engine
This is Rietveld 408576698