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

Unified Diff: content/child/web_url_loader_impl_unittest.cc

Issue 294193002: Set response headers for data URL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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/child/web_url_loader_impl_unittest.cc
diff --git a/content/child/web_url_loader_impl_unittest.cc b/content/child/web_url_loader_impl_unittest.cc
index 81b6779bcb6d77298d0034ae352c28eacb3b9167..1a752d7d4ffadbcc171ae3d24c289d7e84de0506 100644
--- a/content/child/web_url_loader_impl_unittest.cc
+++ b/content/child/web_url_loader_impl_unittest.cc
@@ -7,8 +7,10 @@
#include <string.h>
#include "base/macros.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
+#include "base/time/time.h"
#include "content/child/resource_dispatcher.h"
#include "content/public/child/request_peer.h"
#include "content/public/common/resource_response_info.h"
@@ -52,6 +54,27 @@ const char kMultipartResponse[] =
"Content-type: text/html\n\n"
"ah!";
+TEST(GetInfoFromDataURLTest, Simple) {
darin (slow to review) 2014/08/18 20:23:58 I think the unit testing in src/net/ is sufficient
tyoshino (SeeGerritForStatus) 2014/08/19 13:44:56 OK. Removed.
+ ResourceResponseInfo info;
+ std::string data;
+
+ ASSERT_EQ(net::OK,
+ GetInfoFromDataURL(GURL("data:,Hello"), &info, &data));
+
+ EXPECT_FALSE(info.load_timing.request_start.is_null());
+ EXPECT_FALSE(info.load_timing.request_start_time.is_null());
+ EXPECT_FALSE(info.request_time.is_null());
+ EXPECT_FALSE(info.response_time.is_null());
+ EXPECT_TRUE(info.headers.get());
+ EXPECT_EQ("text/plain", info.mime_type);
+ EXPECT_EQ("US-ASCII", info.charset);
+ EXPECT_TRUE(info.security_info.empty());
+ EXPECT_EQ(5, info.content_length);
+ EXPECT_EQ(0, info.encoded_data_length);
+
+ EXPECT_EQ("Hello", data);
+}
+
class TestBridge : public webkit_glue::ResourceLoaderBridge,
public base::SupportsWeakPtr<TestBridge> {
public:

Powered by Google App Engine
This is Rietveld 408576698