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

Side by Side Diff: net/spdy/spdy_http_utils_unittest.cc

Issue 1477433005: Remove kuint8max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kint4
Patch Set: rebase Created 5 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
« no previous file with comments | « net/quic/quic_http_utils_test.cc ('k') | sync/internal_api/public/base/node_ordinal.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) 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 <stdint.h>
8
9 #include <limits>
10
8 #include "net/http/http_request_info.h" 11 #include "net/http/http_request_info.h"
9 #include "net/spdy/spdy_framer.h" 12 #include "net/spdy/spdy_framer.h"
10 #include "net/spdy/spdy_test_utils.h" 13 #include "net/spdy/spdy_test_utils.h"
11 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
12 15
13 namespace net { 16 namespace net {
14 17
15 namespace { 18 namespace {
16 19
17 bool kDirect = true; 20 bool kDirect = true;
18 21
19 } // namespace 22 } // namespace
20 23
21 TEST(SpdyHttpUtilsTest, ConvertRequestPriorityToSpdy3Priority) { 24 TEST(SpdyHttpUtilsTest, ConvertRequestPriorityToSpdy3Priority) {
22 EXPECT_EQ(0, ConvertRequestPriorityToSpdyPriority(HIGHEST, SPDY3)); 25 EXPECT_EQ(0, ConvertRequestPriorityToSpdyPriority(HIGHEST, SPDY3));
23 EXPECT_EQ(1, ConvertRequestPriorityToSpdyPriority(MEDIUM, SPDY3)); 26 EXPECT_EQ(1, ConvertRequestPriorityToSpdyPriority(MEDIUM, SPDY3));
24 EXPECT_EQ(2, ConvertRequestPriorityToSpdyPriority(LOW, SPDY3)); 27 EXPECT_EQ(2, ConvertRequestPriorityToSpdyPriority(LOW, SPDY3));
25 EXPECT_EQ(3, ConvertRequestPriorityToSpdyPriority(LOWEST, SPDY3)); 28 EXPECT_EQ(3, ConvertRequestPriorityToSpdyPriority(LOWEST, SPDY3));
26 EXPECT_EQ(4, ConvertRequestPriorityToSpdyPriority(IDLE, SPDY3)); 29 EXPECT_EQ(4, ConvertRequestPriorityToSpdyPriority(IDLE, SPDY3));
27 } 30 }
28 31
29 TEST(SpdyHttpUtilsTest, ConvertSpdy3PriorityToRequestPriority) { 32 TEST(SpdyHttpUtilsTest, ConvertSpdy3PriorityToRequestPriority) {
30 EXPECT_EQ(HIGHEST, ConvertSpdyPriorityToRequestPriority(0, SPDY3)); 33 EXPECT_EQ(HIGHEST, ConvertSpdyPriorityToRequestPriority(0, SPDY3));
31 EXPECT_EQ(MEDIUM, ConvertSpdyPriorityToRequestPriority(1, SPDY3)); 34 EXPECT_EQ(MEDIUM, ConvertSpdyPriorityToRequestPriority(1, SPDY3));
32 EXPECT_EQ(LOW, ConvertSpdyPriorityToRequestPriority(2, SPDY3)); 35 EXPECT_EQ(LOW, ConvertSpdyPriorityToRequestPriority(2, SPDY3));
33 EXPECT_EQ(LOWEST, ConvertSpdyPriorityToRequestPriority(3, SPDY3)); 36 EXPECT_EQ(LOWEST, ConvertSpdyPriorityToRequestPriority(3, SPDY3));
34 EXPECT_EQ(IDLE, ConvertSpdyPriorityToRequestPriority(4, SPDY3)); 37 EXPECT_EQ(IDLE, ConvertSpdyPriorityToRequestPriority(4, SPDY3));
35 // These are invalid values, but we should still handle them 38 // These are invalid values, but we should still handle them
36 // gracefully. 39 // gracefully.
37 for (int i = 5; i < kuint8max; ++i) { 40 for (int i = 5; i < std::numeric_limits<uint8_t>::max(); ++i) {
38 EXPECT_EQ(IDLE, ConvertSpdyPriorityToRequestPriority(i, SPDY3)); 41 EXPECT_EQ(IDLE, ConvertSpdyPriorityToRequestPriority(i, SPDY3));
39 } 42 }
40 } 43 }
41 44
42 TEST(SpdyHttpUtilsTest, CreateSpdyHeadersFromHttpRequestSPDY2) { 45 TEST(SpdyHttpUtilsTest, CreateSpdyHeadersFromHttpRequestSPDY2) {
43 GURL url("https://www.google.com/index.html"); 46 GURL url("https://www.google.com/index.html");
44 HttpRequestInfo request; 47 HttpRequestInfo request;
45 request.method = "GET"; 48 request.method = "GET";
46 request.url = url; 49 request.url = url;
47 request.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, "Chrome/1.1"); 50 request.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, "Chrome/1.1");
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 EXPECT_EQ("CONNECT", headers[":method"]); 190 EXPECT_EQ("CONNECT", headers[":method"]);
188 EXPECT_TRUE(headers.end() == headers.find(":scheme")); 191 EXPECT_TRUE(headers.end() == headers.find(":scheme"));
189 EXPECT_EQ("www.google.com:443", headers[":authority"]); 192 EXPECT_EQ("www.google.com:443", headers[":authority"]);
190 EXPECT_EQ(headers.end(), headers.find(":path")); 193 EXPECT_EQ(headers.end(), headers.find(":path"));
191 EXPECT_EQ(headers.end(), headers.find(":scheme")); 194 EXPECT_EQ(headers.end(), headers.find(":scheme"));
192 EXPECT_TRUE(headers.end() == headers.find(":version")); 195 EXPECT_TRUE(headers.end() == headers.find(":version"));
193 EXPECT_EQ("Chrome/1.1", headers["user-agent"]); 196 EXPECT_EQ("Chrome/1.1", headers["user-agent"]);
194 } 197 }
195 198
196 } // namespace net 199 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_http_utils_test.cc ('k') | sync/internal_api/public/base/node_ordinal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698