| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 QuicInMemoryCache* cache = QuicInMemoryCache::GetInstance(); | 238 QuicInMemoryCache* cache = QuicInMemoryCache::GetInstance(); |
| 239 cache->AddSimpleResponseWithServerPushResources( | 239 cache->AddSimpleResponseWithServerPushResources( |
| 240 request_host, "/", 200, response_body, push_resources); | 240 request_host, "/", 200, response_body, push_resources); |
| 241 string request_url = request_host + "/"; | 241 string request_url = request_host + "/"; |
| 242 list<ServerPushInfo> resources = cache->GetServerPushResources(request_url); | 242 list<ServerPushInfo> resources = cache->GetServerPushResources(request_url); |
| 243 ASSERT_EQ(kNumResources, resources.size()); | 243 ASSERT_EQ(kNumResources, resources.size()); |
| 244 int i = 0; | 244 int i = 0; |
| 245 for (const auto& push_resource : push_resources) { | 245 for (const auto& push_resource : push_resources) { |
| 246 GURL url = resources.front().request_url; | 246 GURL url = resources.front().request_url; |
| 247 string host = url.host(); | 247 string host = url.host(); |
| 248 string path = url.path(); | 248 string path = url.path().as_string(); |
| 249 const QuicInMemoryCache::Response* response = | 249 const QuicInMemoryCache::Response* response = |
| 250 cache->GetResponse(host, path); | 250 cache->GetResponse(host, path); |
| 251 ASSERT_TRUE(response); | 251 ASSERT_TRUE(response); |
| 252 ASSERT_TRUE(ContainsKey(response->headers(), ":status")); | 252 ASSERT_TRUE(ContainsKey(response->headers(), ":status")); |
| 253 EXPECT_EQ(push_response_status[i++], | 253 EXPECT_EQ(push_response_status[i++], |
| 254 response->headers().find(":status")->second); | 254 response->headers().find(":status")->second); |
| 255 EXPECT_EQ(push_resource.body, response->body()); | 255 EXPECT_EQ(push_resource.body, response->body()); |
| 256 resources.pop_front(); | 256 resources.pop_front(); |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 | 259 |
| 260 } // namespace test | 260 } // namespace test |
| 261 } // namespace net | 261 } // namespace net |
| OLD | NEW |