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

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

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
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 15 matching lines...) Expand all
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* kTestResponses[] = {
36 "HTTP/1.1 200 OK\n\n", 36 "HTTP/1.1 200 OK\n\n", "HTTP/1.1 200 OK\nVary: *\n\n",
37 "HTTP/1.1 200 OK\nVary: *\n\n", 37 "HTTP/1.1 200 OK\nVary: cookie, *, bar\n\n",
38 "HTTP/1.1 200 OK\nVary: cookie, *, bar\n\n", 38 "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 }; 39 };
41 40
42 for (size_t i = 0; i < arraysize(kTestResponses); ++i) { 41 for (size_t i = 0; i < arraysize(kTestResponses); ++i) {
43 TestTransaction t; 42 TestTransaction t;
44 t.Init(std::string(), kTestResponses[i]); 43 t.Init(std::string(), kTestResponses[i]);
45 44
46 net::HttpVaryData v; 45 net::HttpVaryData v;
47 EXPECT_FALSE(v.is_valid()); 46 EXPECT_FALSE(v.is_valid());
48 EXPECT_FALSE(v.Init(t.request, *t.response.get())); 47 EXPECT_FALSE(v.Init(t.request, *t.response.get()));
49 EXPECT_FALSE(v.is_valid()); 48 EXPECT_FALSE(v.is_valid());
(...skipping 88 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"); 137 a.Init("Cookie: 1", "HTTP/1.1 301 Moved\nLocation: x\nVary: coOkie\n\n");
139 138
140 TestTransaction b; 139 TestTransaction b;
141 b.Init("Cookie: 2", "HTTP/1.1 301 Moved\nLocation: x\nVary: cooKie\n\n"); 140 b.Init("Cookie: 2", "HTTP/1.1 301 Moved\nLocation: x\nVary: cooKie\n\n");
142 141
143 net::HttpVaryData v; 142 net::HttpVaryData v;
144 EXPECT_TRUE(v.Init(a.request, *a.response.get())); 143 EXPECT_TRUE(v.Init(a.request, *a.response.get()));
145 144
146 EXPECT_FALSE(v.MatchesRequest(b.request, *b.response.get())); 145 EXPECT_FALSE(v.MatchesRequest(b.request, *b.response.get()));
147 } 146 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698