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

Unified Diff: ios/web/navigation/history_state_operations_inttest.mm

Issue 2607053002: Remove POST data from navigations for which the state is replaced. (Closed)
Patch Set: rebase + fixes Created 3 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
« no previous file with comments | « ios/web/navigation/crw_session_controller.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/navigation/history_state_operations_inttest.mm
diff --git a/ios/web/navigation/history_state_operations_inttest.mm b/ios/web/navigation/history_state_operations_inttest.mm
index a305cf3b3a3e3e5c80992120181440eccfc7115d..d823e70b61b9e497f9cf2ccad7d9b57df776d3e0 100644
--- a/ios/web/navigation/history_state_operations_inttest.mm
+++ b/ios/web/navigation/history_state_operations_inttest.mm
@@ -370,3 +370,25 @@ void WaitForNoOpText() {
GetIndexOfNavigationItem(GetLastCommittedItem()));
EXPECT_EQ(NSNotFound, GetIndexOfNavigationItem(about_blank_item));
}
+
+// Tests that performing a replaceState() on a page created with a POST request
+// resets the page to a GET request.
+TEST_F(HistoryStateOperationsTest, ReplaceStatePostRequest) {
+ // Add POST data to the current NavigationItem.
+ base::scoped_nsobject<NSData> post_data([NSData data]);
+ static_cast<web::NavigationItemImpl*>(GetLastCommittedItem())
+ ->SetPostData(post_data);
+ ASSERT_TRUE(GetLastCommittedItem()->HasPostData());
+ // Set up the state parameters and tap the replace state button.
+ std::string new_state("STATE OBJECT");
+ std::string empty_title;
+ GURL new_url = state_operations_url().Resolve("path");
+ SetStateParams(new_state, empty_title, new_url);
+ ASSERT_TRUE(web::test::TapWebViewElementWithId(web_state(), kReplaceStateId));
+ // Verify that url has been replaced.
+ base::test::ios::WaitUntilCondition(^bool {
+ return GetLastCommittedItem()->GetURL() == new_url;
+ });
+ // Verify that the NavigationItem no longer has POST data.
+ EXPECT_FALSE(GetLastCommittedItem()->HasPostData());
+}
« no previous file with comments | « ios/web/navigation/crw_session_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698