OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/spdy/spdy_http_utils.h" | 5 #include "net/spdy/spdy_http_utils.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "net/http/http_request_info.h" | 8 #include "net/http/http_request_info.h" |
9 #include "net/spdy/spdy_framer.h" | 9 #include "net/spdy/spdy_framer.h" |
| 10 #include "net/spdy/spdy_test_utils.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
11 | 12 |
12 namespace net { | 13 namespace net { |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 bool kDirect = true; | 17 bool kDirect = true; |
17 | 18 |
18 } // namespace | 19 } // namespace |
19 | 20 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 HttpRequestInfo request; | 180 HttpRequestInfo request; |
180 request.method = "CONNECT"; | 181 request.method = "CONNECT"; |
181 request.url = url; | 182 request.url = url; |
182 request.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, "Chrome/1.1"); | 183 request.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, "Chrome/1.1"); |
183 SpdyHeaderBlock headers; | 184 SpdyHeaderBlock headers; |
184 CreateSpdyHeadersFromHttpRequest(request, request.extra_headers, HTTP2, | 185 CreateSpdyHeadersFromHttpRequest(request, request.extra_headers, HTTP2, |
185 kDirect, &headers); | 186 kDirect, &headers); |
186 EXPECT_EQ("CONNECT", headers[":method"]); | 187 EXPECT_EQ("CONNECT", headers[":method"]); |
187 EXPECT_TRUE(headers.end() == headers.find(":scheme")); | 188 EXPECT_TRUE(headers.end() == headers.find(":scheme")); |
188 EXPECT_EQ("www.google.com:443", headers[":authority"]); | 189 EXPECT_EQ("www.google.com:443", headers[":authority"]); |
189 EXPECT_EQ(0u, headers.count(":path")); | 190 EXPECT_EQ(headers.end(), headers.find(":path")); |
190 EXPECT_EQ(0u, headers.count(":scheme")); | 191 EXPECT_EQ(headers.end(), headers.find(":scheme")); |
191 EXPECT_TRUE(headers.end() == headers.find(":version")); | 192 EXPECT_TRUE(headers.end() == headers.find(":version")); |
192 EXPECT_EQ("Chrome/1.1", headers["user-agent"]); | 193 EXPECT_EQ("Chrome/1.1", headers["user-agent"]); |
193 } | 194 } |
194 | 195 |
195 } // namespace net | 196 } // namespace net |
OLD | NEW |