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

Side by Side Diff: net/tools/quic/quic_http_response_cache_test.cc

Issue 2591143003: Add QuicStrCat. (Closed)
Patch Set: correct quic_client_bin.cc Created 4 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 unified diff | Download patch
OLDNEW
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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 string request_host = "www.foo.com"; 172 string request_host = "www.foo.com";
173 string response_body("hello response"); 173 string response_body("hello response");
174 const size_t kNumResources = 5; 174 const size_t kNumResources = 5;
175 int NumResources = 5; 175 int NumResources = 5;
176 std::list<QuicHttpResponseCache::ServerPushInfo> push_resources; 176 std::list<QuicHttpResponseCache::ServerPushInfo> push_resources;
177 string scheme = "http"; 177 string scheme = "http";
178 for (int i = 0; i < NumResources; ++i) { 178 for (int i = 0; i < NumResources; ++i) {
179 string path = "/server_push_src" + base::IntToString(i); 179 string path = "/server_push_src" + base::IntToString(i);
180 string url = scheme + "://" + request_host + path; 180 string url = scheme + "://" + request_host + path;
181 GURL resource_url(url); 181 GURL resource_url(url);
182 string body = "This is server push response body for " + path; 182 string body = QuicStrCat("This is server push response body for ", path);
183 SpdyHeaderBlock response_headers; 183 SpdyHeaderBlock response_headers;
184 response_headers[":version"] = "HTTP/1.1"; 184 response_headers[":version"] = "HTTP/1.1";
185 response_headers[":status"] = "200"; 185 response_headers[":status"] = "200";
186 response_headers["content-length"] = base::UintToString(body.size()); 186 response_headers["content-length"] = base::UintToString(body.size());
187 push_resources.push_back( 187 push_resources.push_back(
188 ServerPushInfo(resource_url, response_headers.Clone(), i, body)); 188 ServerPushInfo(resource_url, response_headers.Clone(), i, body));
189 } 189 }
190 190
191 cache_.AddSimpleResponseWithServerPushResources( 191 cache_.AddSimpleResponseWithServerPushResources(
192 request_host, "/", 200, response_body, push_resources); 192 request_host, "/", 200, response_body, push_resources);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 ASSERT_TRUE(ContainsKey(response->headers(), ":status")); 239 ASSERT_TRUE(ContainsKey(response->headers(), ":status"));
240 EXPECT_EQ(push_response_status[i++], 240 EXPECT_EQ(push_response_status[i++],
241 response->headers().find(":status")->second); 241 response->headers().find(":status")->second);
242 EXPECT_EQ(push_resource.body, response->body()); 242 EXPECT_EQ(push_resource.body, response->body());
243 resources.pop_front(); 243 resources.pop_front();
244 } 244 }
245 } 245 }
246 246
247 } // namespace test 247 } // namespace test
248 } // namespace net 248 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698