| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/tools/quic/quic_http_response_cache.h" | 5 #include "net/tools/quic/quic_http_response_cache.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "net/quic/platform/api/quic_map_util.h" | 9 #include "net/quic/platform/api/quic_map_util.h" |
| 10 #include "net/quic/platform/api/quic_str_cat.h" | 10 #include "net/quic/platform/api/quic_str_cat.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // Connection headers are not valid in HTTP/2. | 99 // Connection headers are not valid in HTTP/2. |
| 100 EXPECT_FALSE(QuicContainsKey(response->headers(), "connection")); | 100 EXPECT_FALSE(QuicContainsKey(response->headers(), "connection")); |
| 101 EXPECT_LT(0U, response->body().length()); | 101 EXPECT_LT(0U, response->body().length()); |
| 102 } | 102 } |
| 103 | 103 |
| 104 TEST_F(QuicHttpResponseCacheTest, ReadsCacheDirWithServerPushResource) { | 104 TEST_F(QuicHttpResponseCacheTest, ReadsCacheDirWithServerPushResource) { |
| 105 cache_.InitializeFromDirectory(CacheDirectory() + "_with_push"); | 105 cache_.InitializeFromDirectory(CacheDirectory() + "_with_push"); |
| 106 std::list<ServerPushInfo> resources = | 106 std::list<ServerPushInfo> resources = |
| 107 cache_.GetServerPushResources("test.example.com/"); | 107 cache_.GetServerPushResources("test.example.com/"); |
| 108 ASSERT_EQ(1UL, resources.size()); | 108 ASSERT_EQ(1UL, resources.size()); |
| 109 EXPECT_FALSE(true); |
| 109 } | 110 } |
| 110 | 111 |
| 111 TEST_F(QuicHttpResponseCacheTest, ReadsCacheDirWithServerPushResources) { | 112 TEST_F(QuicHttpResponseCacheTest, ReadsCacheDirWithServerPushResources) { |
| 112 cache_.InitializeFromDirectory(CacheDirectory() + "_with_push"); | 113 cache_.InitializeFromDirectory(CacheDirectory() + "_with_push"); |
| 113 std::list<ServerPushInfo> resources = | 114 std::list<ServerPushInfo> resources = |
| 114 cache_.GetServerPushResources("test.example.com/index2.html"); | 115 cache_.GetServerPushResources("test.example.com/index2.html"); |
| 115 ASSERT_EQ(2UL, resources.size()); | 116 ASSERT_EQ(2UL, resources.size()); |
| 116 } | 117 } |
| 117 | 118 |
| 118 TEST_F(QuicHttpResponseCacheTest, UsesOriginalUrl) { | 119 TEST_F(QuicHttpResponseCacheTest, UsesOriginalUrl) { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 ASSERT_TRUE(QuicContainsKey(response->headers(), ":status")); | 239 ASSERT_TRUE(QuicContainsKey(response->headers(), ":status")); |
| 239 EXPECT_EQ(push_response_status[i++], | 240 EXPECT_EQ(push_response_status[i++], |
| 240 response->headers().find(":status")->second); | 241 response->headers().find(":status")->second); |
| 241 EXPECT_EQ(push_resource.body, response->body()); | 242 EXPECT_EQ(push_resource.body, response->body()); |
| 242 resources.pop_front(); | 243 resources.pop_front(); |
| 243 } | 244 } |
| 244 } | 245 } |
| 245 | 246 |
| 246 } // namespace test | 247 } // namespace test |
| 247 } // namespace net | 248 } // namespace net |
| OLD | NEW |