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

Side by Side Diff: net/http/http_vary_data_unittest.cc

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « net/http/http_util_unittest.cc ('k') | net/http/transport_security_state_static.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <algorithm> 5 #include <algorithm>
6 6
7 #include "net/http/http_request_info.h" 7 #include "net/http/http_request_info.h"
8 #include "net/http/http_response_headers.h" 8 #include "net/http/http_response_headers.h"
9 #include "net/http/http_vary_data.h" 9 #include "net/http/http_vary_data.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 14 matching lines...) Expand all
25 25
26 request.extra_headers.Clear(); 26 request.extra_headers.Clear();
27 request.extra_headers.AddHeadersFromString(request_headers); 27 request.extra_headers.AddHeadersFromString(request_headers);
28 } 28 }
29 }; 29 };
30 30
31 } // namespace 31 } // namespace
32 32
33 TEST(HttpVaryDataTest, IsInvalid) { 33 TEST(HttpVaryDataTest, IsInvalid) {
34 // All of these responses should result in an invalid vary data object. 34 // All of these responses should result in an invalid vary data object.
35 const char* kTestResponses[] = { 35 const char* const kTestResponses[] = {
36 "HTTP/1.1 200 OK\n\n", 36 "HTTP/1.1 200 OK\n\n",
37 "HTTP/1.1 200 OK\nVary: *\n\n", 37 "HTTP/1.1 200 OK\nVary: *\n\n",
38 "HTTP/1.1 200 OK\nVary: cookie, *, bar\n\n", 38 "HTTP/1.1 200 OK\nVary: cookie, *, bar\n\n",
39 "HTTP/1.1 200 OK\nVary: cookie\nFoo: 1\nVary: *\n\n", 39 "HTTP/1.1 200 OK\nVary: cookie\nFoo: 1\nVary: *\n\n",
40 }; 40 };
41 41
42 for (size_t i = 0; i < arraysize(kTestResponses); ++i) { 42 for (size_t i = 0; i < arraysize(kTestResponses); ++i) {
43 TestTransaction t; 43 TestTransaction t;
44 t.Init(std::string(), kTestResponses[i]); 44 t.Init(std::string(), kTestResponses[i]);
45 45
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 a.Init("Cookie: 1", "HTTP/1.1 301 Moved\nLocation: x\nVary: coOkie\n\n"); 138 a.Init("Cookie: 1", "HTTP/1.1 301 Moved\nLocation: x\nVary: coOkie\n\n");
139 139
140 TestTransaction b; 140 TestTransaction b;
141 b.Init("Cookie: 2", "HTTP/1.1 301 Moved\nLocation: x\nVary: cooKie\n\n"); 141 b.Init("Cookie: 2", "HTTP/1.1 301 Moved\nLocation: x\nVary: cooKie\n\n");
142 142
143 net::HttpVaryData v; 143 net::HttpVaryData v;
144 EXPECT_TRUE(v.Init(a.request, *a.response.get())); 144 EXPECT_TRUE(v.Init(a.request, *a.response.get()));
145 145
146 EXPECT_FALSE(v.MatchesRequest(b.request, *b.response.get())); 146 EXPECT_FALSE(v.MatchesRequest(b.request, *b.response.get()));
147 } 147 }
OLDNEW
« no previous file with comments | « net/http/http_util_unittest.cc ('k') | net/http/transport_security_state_static.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698