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

Unified Diff: net/tools/quic/quic_in_memory_cache_test.cc

Issue 1499673003: Adds response trailers to the QuicInMemoryCache's Responses. Currently unused, this is preparation … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@108726817
Patch Set: Created 5 years 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/tools/quic/quic_in_memory_cache.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/quic_in_memory_cache_test.cc
diff --git a/net/tools/quic/quic_in_memory_cache_test.cc b/net/tools/quic/quic_in_memory_cache_test.cc
index 1f5e8b6d5d20eabc4f29f426b66f05397386115b..faf5a105512196ea13ddeeb51d6f2d7e7045cda8 100644
--- a/net/tools/quic/quic_in_memory_cache_test.cc
+++ b/net/tools/quic/quic_in_memory_cache_test.cc
@@ -76,6 +76,32 @@ TEST_F(QuicInMemoryCacheTest, AddSimpleResponseGetResponse) {
EXPECT_EQ(response_body.size(), response->body().length());
}
+TEST_F(QuicInMemoryCacheTest, AddResponse) {
+ const string kRequestHost = "www.foo.com";
+ const string kRequestPath = "/";
+ const string kResponseBody("hello response");
+
+ SpdyHeaderBlock response_headers;
+ response_headers[":version"] = "HTTP/1.1";
+ response_headers[":status"] = "200";
+ response_headers["content-length"] = IntToString(kResponseBody.size());
+
+ SpdyHeaderBlock response_trailers;
+ response_trailers["key-1"] = "value-1";
+ response_trailers["key-2"] = "value-2";
+ response_trailers["key-3"] = "value-3";
+
+ QuicInMemoryCache* cache = QuicInMemoryCache::GetInstance();
+ cache->AddResponse(kRequestHost, "/", response_headers, kResponseBody,
+ response_trailers);
+
+ const QuicInMemoryCache::Response* response =
+ cache->GetResponse(kRequestHost, kRequestPath);
+ EXPECT_EQ(response->headers(), response_headers);
+ EXPECT_EQ(response->body(), kResponseBody);
+ EXPECT_EQ(response->trailers(), response_trailers);
+}
+
TEST_F(QuicInMemoryCacheTest, ReadsCacheDir) {
QuicInMemoryCache::GetInstance()->InitializeFromDirectory(CacheDirectory());
const QuicInMemoryCache::Response* response =
« no previous file with comments | « net/tools/quic/quic_in_memory_cache.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698