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

Unified Diff: content/browser/browser_side_navigation_browsertest.cc

Issue 1678303004: PlzNavigate: inform the renderer that a navigation is a POST (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 10 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
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_entry_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_side_navigation_browsertest.cc
diff --git a/content/browser/browser_side_navigation_browsertest.cc b/content/browser/browser_side_navigation_browsertest.cc
index c23b7370d800da24e052387410cc23fab2f2043b..599f3cc5b71d1fa5b408dcb9c36c35c8a32e0010 100644
--- a/content/browser/browser_side_navigation_browsertest.cc
+++ b/content/browser/browser_side_navigation_browsertest.cc
@@ -6,6 +6,7 @@
#include "base/command_line.h"
#include "base/strings/stringprintf.h"
+#include "base/strings/utf_string_conversions.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/site_isolation_policy.h"
#include "content/public/browser/web_contents.h"
@@ -201,4 +202,30 @@ IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, FailedNavigation) {
}
}
+// Ensure that browser side navigation handles POST navigations correctly.
+IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, POSTNavigation) {
+ GURL url(embedded_test_server()->GetURL("/session_history/form.html"));
+ GURL post_url = embedded_test_server()->GetURL("/echotitle");
+
+ // Navigate to a page with a form.
+ TestNavigationObserver observer(shell()->web_contents());
+ NavigateToURL(shell(), url);
+ EXPECT_EQ(url, observer.last_navigation_url());
+ EXPECT_TRUE(observer.last_navigation_succeeded());
+
+ // Submit the form.
+ GURL submit_url("javascript:submitForm('isubmit')");
+ NavigateToURL(shell(), submit_url);
+
+ // Check that a proper POST navigation was done.
+ EXPECT_EQ("text=&select=a",
+ base::UTF16ToASCII(shell()->web_contents()->GetTitle()));
+ EXPECT_EQ(post_url, shell()->web_contents()->GetLastCommittedURL());
+ EXPECT_TRUE(shell()
+ ->web_contents()
+ ->GetController()
+ .GetActiveEntry()
+ ->GetHasPostData());
+}
+
} // namespace content
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_entry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698