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

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

Issue 12989038: [SPDY] Remove some setters in SpdyStream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed DISALLOW_COPY_AND_ASSIGN again Created 7 years, 8 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
« no previous file with comments | « net/spdy/spdy_http_utils.cc ('k') | net/spdy/spdy_session.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 "testing/platform_test.h" 7 #include "base/basictypes.h"
8 #include "testing/gtest/include/gtest/gtest.h"
8 9
9 namespace net { 10 namespace net {
10 11
11 namespace test { 12 namespace {
12 13
13 TEST(SpdyHttpUtilsTest, ConvertRequestPriorityToSpdy2Priority) { 14 TEST(SpdyHttpUtilsTest, ConvertRequestPriorityToSpdy2Priority) {
14 EXPECT_EQ(0, ConvertRequestPriorityToSpdyPriority(HIGHEST, 2)); 15 EXPECT_EQ(0, ConvertRequestPriorityToSpdyPriority(HIGHEST, 2));
15 EXPECT_EQ(1, ConvertRequestPriorityToSpdyPriority(MEDIUM, 2)); 16 EXPECT_EQ(1, ConvertRequestPriorityToSpdyPriority(MEDIUM, 2));
16 EXPECT_EQ(2, ConvertRequestPriorityToSpdyPriority(LOW, 2)); 17 EXPECT_EQ(2, ConvertRequestPriorityToSpdyPriority(LOW, 2));
17 EXPECT_EQ(2, ConvertRequestPriorityToSpdyPriority(LOWEST, 2)); 18 EXPECT_EQ(2, ConvertRequestPriorityToSpdyPriority(LOWEST, 2));
18 EXPECT_EQ(3, ConvertRequestPriorityToSpdyPriority(IDLE, 2)); 19 EXPECT_EQ(3, ConvertRequestPriorityToSpdyPriority(IDLE, 2));
19 } 20 }
21
20 TEST(SpdyHttpUtilsTest, ConvertRequestPriorityToSpdy3Priority) { 22 TEST(SpdyHttpUtilsTest, ConvertRequestPriorityToSpdy3Priority) {
21 EXPECT_EQ(0, ConvertRequestPriorityToSpdyPriority(HIGHEST, 3)); 23 EXPECT_EQ(0, ConvertRequestPriorityToSpdyPriority(HIGHEST, 3));
22 EXPECT_EQ(1, ConvertRequestPriorityToSpdyPriority(MEDIUM, 3)); 24 EXPECT_EQ(1, ConvertRequestPriorityToSpdyPriority(MEDIUM, 3));
23 EXPECT_EQ(2, ConvertRequestPriorityToSpdyPriority(LOW, 3)); 25 EXPECT_EQ(2, ConvertRequestPriorityToSpdyPriority(LOW, 3));
24 EXPECT_EQ(3, ConvertRequestPriorityToSpdyPriority(LOWEST, 3)); 26 EXPECT_EQ(3, ConvertRequestPriorityToSpdyPriority(LOWEST, 3));
25 EXPECT_EQ(4, ConvertRequestPriorityToSpdyPriority(IDLE, 3)); 27 EXPECT_EQ(4, ConvertRequestPriorityToSpdyPriority(IDLE, 3));
26 } 28 }
27 29
30 TEST(SpdyHttpUtilsTest, ConvertSpdy2PriorityToRequestPriority) {
31 EXPECT_EQ(HIGHEST, ConvertSpdyPriorityToRequestPriority(0, 2));
32 EXPECT_EQ(MEDIUM, ConvertSpdyPriorityToRequestPriority(1, 2));
33 EXPECT_EQ(LOW, ConvertSpdyPriorityToRequestPriority(2, 2));
34 EXPECT_EQ(IDLE, ConvertSpdyPriorityToRequestPriority(3, 2));
35 // These are invalid values, but we should still handle them
36 // gracefully.
37 for (int i = 4; i < kuint8max; ++i) {
38 EXPECT_EQ(IDLE, ConvertSpdyPriorityToRequestPriority(i, 2));
39 }
40 }
41
42 TEST(SpdyHttpUtilsTest, ConvertSpdy3PriorityToRequestPriority) {
43 EXPECT_EQ(HIGHEST, ConvertSpdyPriorityToRequestPriority(0, 3));
44 EXPECT_EQ(MEDIUM, ConvertSpdyPriorityToRequestPriority(1, 3));
45 EXPECT_EQ(LOW, ConvertSpdyPriorityToRequestPriority(2, 3));
46 EXPECT_EQ(LOWEST, ConvertSpdyPriorityToRequestPriority(3, 3));
47 EXPECT_EQ(IDLE, ConvertSpdyPriorityToRequestPriority(4, 3));
48 // These are invalid values, but we should still handle them
49 // gracefully.
50 for (int i = 5; i < kuint8max; ++i) {
51 EXPECT_EQ(IDLE, ConvertSpdyPriorityToRequestPriority(i, 3));
52 }
53 }
54
28 TEST(SpdyHttpUtilsTest, ShowHttpHeaderValue){ 55 TEST(SpdyHttpUtilsTest, ShowHttpHeaderValue){
29 #if defined(SPDY_PROXY_AUTH_ORIGIN) 56 #if defined(SPDY_PROXY_AUTH_ORIGIN)
30 EXPECT_FALSE(ShouldShowHttpHeaderValue("proxy-authorization")); 57 EXPECT_FALSE(ShouldShowHttpHeaderValue("proxy-authorization"));
31 EXPECT_TRUE(ShouldShowHttpHeaderValue("accept-encoding")); 58 EXPECT_TRUE(ShouldShowHttpHeaderValue("accept-encoding"));
32 #else 59 #else
33 EXPECT_TRUE(ShouldShowHttpHeaderValue("proxy-authorization")); 60 EXPECT_TRUE(ShouldShowHttpHeaderValue("proxy-authorization"));
34 EXPECT_TRUE(ShouldShowHttpHeaderValue("accept-encoding")); 61 EXPECT_TRUE(ShouldShowHttpHeaderValue("accept-encoding"));
35 #endif 62 #endif
36 } 63 }
37 64
38 } // namespace test 65 } // namespace
39 66
40 } // namespace net 67 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_http_utils.cc ('k') | net/spdy/spdy_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698