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

Unified Diff: net/http/http_response_headers_unittest.cc

Issue 10399083: Make NetLog take in callbacks that return Values (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix merge error Created 8 years, 6 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 | « net/http/http_response_headers.cc ('k') | net/http/http_stream_parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_response_headers_unittest.cc
===================================================================
--- net/http/http_response_headers_unittest.cc (revision 141317)
+++ net/http/http_response_headers_unittest.cc (working copy)
@@ -7,6 +7,7 @@
#include "base/basictypes.h"
#include "base/pickle.h"
#include "base/time.h"
+#include "base/values.h"
#include "net/http/http_response_headers.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -1756,3 +1757,30 @@
EXPECT_EQ(std::string(tests[i].expected_headers), resulting_headers);
}
}
+
+TEST(HttpResponseHeadersTest, ToNetLogParamAndBackAgain) {
+ std::string headers("HTTP/1.1 404\n"
+ "Content-Length: 450\n"
+ "Connection: keep-alive\n");
+ HeadersToRaw(&headers);
+ scoped_refptr<net::HttpResponseHeaders> parsed(
+ new net::HttpResponseHeaders(headers));
+
+ scoped_ptr<base::Value> event_param(
+ parsed->NetLogCallback(net::NetLog::LOG_ALL_BUT_BYTES));
+ scoped_refptr<net::HttpResponseHeaders> recreated;
+
+ ASSERT_TRUE(net::HttpResponseHeaders::FromNetLogParam(event_param.get(),
+ &recreated));
+ ASSERT_TRUE(recreated.get());
+ EXPECT_EQ(parsed->GetHttpVersion(), recreated->GetHttpVersion());
+ EXPECT_EQ(parsed->response_code(), recreated->response_code());
+ EXPECT_EQ(parsed->GetContentLength(), recreated->GetContentLength());
+ EXPECT_EQ(parsed->IsKeepAlive(), recreated->IsKeepAlive());
+
+ std::string normalized_parsed;
+ parsed->GetNormalizedHeaders(&normalized_parsed);
+ std::string normalized_recreated;
+ parsed->GetNormalizedHeaders(&normalized_recreated);
+ EXPECT_EQ(normalized_parsed, normalized_recreated);
+}
« no previous file with comments | « net/http/http_response_headers.cc ('k') | net/http/http_stream_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698