| OLD | NEW |
| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 TestTransaction b; | 114 TestTransaction b; |
| 115 b.Init("Foo: 1\r\nbaR: 2", "HTTP/1.1 200 OK\nVary: foo\nVary: bar\n\n"); | 115 b.Init("Foo: 1\r\nbaR: 2", "HTTP/1.1 200 OK\nVary: foo\nVary: bar\n\n"); |
| 116 | 116 |
| 117 HttpVaryData v; | 117 HttpVaryData v; |
| 118 EXPECT_TRUE(v.Init(a.request, *a.response.get())); | 118 EXPECT_TRUE(v.Init(a.request, *a.response.get())); |
| 119 | 119 |
| 120 EXPECT_TRUE(v.MatchesRequest(b.request, *b.response.get())); | 120 EXPECT_TRUE(v.MatchesRequest(b.request, *b.response.get())); |
| 121 } | 121 } |
| 122 | 122 |
| 123 TEST(HttpVaryDataTest, ImplicitCookieForRedirect) { | 123 TEST(HttpVaryDataTest, DoesntVaryByCookieForRedirect) { |
| 124 TestTransaction a; | 124 TestTransaction a; |
| 125 a.Init("Cookie: 1", "HTTP/1.1 301 Moved\nLocation: x\n\n"); | 125 a.Init("Cookie: 1", "HTTP/1.1 301 Moved\nLocation: x\n\n"); |
| 126 | 126 |
| 127 TestTransaction b; | |
| 128 b.Init("Cookie: 2", "HTTP/1.1 301 Moved\nLocation: x\n\n"); | |
| 129 | |
| 130 HttpVaryData v; | 127 HttpVaryData v; |
| 131 EXPECT_TRUE(v.Init(a.request, *a.response.get())); | 128 EXPECT_FALSE(v.Init(a.request, *a.response.get())); |
| 132 | |
| 133 EXPECT_FALSE(v.MatchesRequest(b.request, *b.response.get())); | |
| 134 } | |
| 135 | |
| 136 TEST(HttpVaryDataTest, ImplicitCookieForRedirect2) { | |
| 137 // This should be no different than the test above | |
| 138 | |
| 139 TestTransaction a; | |
| 140 a.Init("Cookie: 1", "HTTP/1.1 301 Moved\nLocation: x\nVary: coOkie\n\n"); | |
| 141 | |
| 142 TestTransaction b; | |
| 143 b.Init("Cookie: 2", "HTTP/1.1 301 Moved\nLocation: x\nVary: cooKie\n\n"); | |
| 144 | |
| 145 HttpVaryData v; | |
| 146 EXPECT_TRUE(v.Init(a.request, *a.response.get())); | |
| 147 | |
| 148 EXPECT_FALSE(v.MatchesRequest(b.request, *b.response.get())); | |
| 149 } | 129 } |
| 150 | 130 |
| 151 } // namespace net | 131 } // namespace net |
| OLD | NEW |