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

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

Issue 10829044: Implement NavigationControllerWebView.PostURL (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: NavigationEntry: clarify comments, return raw pointer Created 8 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 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 e174bf8e83dfceeecfc79f9e193c4acdcf6f274b..f2f5017488727319674da65813aafe22290b81d3 100644
--- a/content/browser/web_contents/navigation_controller_impl_unittest.cc
+++ b/content/browser/web_contents/navigation_controller_impl_unittest.cc
@@ -563,6 +563,31 @@ TEST_F(NavigationControllerTest, LoadURL_RedirectAbortDoesntShowPendingURL) {
contents()->SetDelegate(NULL);
}
+// Test NavigationEntry is constructed correctly. No other logic tested.
+TEST_F(NavigationControllerTest, PostURL) {
+ NavigationControllerImpl& controller = controller_impl();
+
+ const GURL url("http://foo1");
+
+ const int length = 5;
+ const unsigned char* raw_data =
+ reinterpret_cast<const unsigned char*>("d\n\0a2");
+ std::vector<unsigned char> post_data_vector(raw_data, raw_data+length);
+ scoped_refptr<base::RefCountedBytes> data =
+ base::RefCountedBytes::TakeVector(&post_data_vector);
+
+ controller.PostURL(url, content::Referrer(), *data.get(), true);
+
+ NavigationEntryImpl* post_entry =
+ NavigationEntryImpl::FromNavigationEntry(
+ controller.GetPendingEntry());
+
+ EXPECT_TRUE(post_entry);
+ EXPECT_TRUE(post_entry->GetHasPostData());
+ EXPECT_EQ(data->front(),
+ post_entry->GetBrowserInitiatedPostData()->front());
+}
+
TEST_F(NavigationControllerTest, Reload) {
NavigationControllerImpl& controller = controller_impl();
TestNotificationTracker notifications;

Powered by Google App Engine
This is Rietveld 408576698