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

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

Issue 286313002: Accept and ignore PRIORITY frames in SPDY4+. (Closed) 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
« no previous file with comments | « net/spdy/spdy_protocol.cc ('k') | no next file » | 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_protocol.h" 5 #include "net/spdy/spdy_protocol.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 23 matching lines...) Expand all
34 // Version of SPDY protocol to be used. 34 // Version of SPDY protocol to be used.
35 SpdyMajorVersion spdy_version_; 35 SpdyMajorVersion spdy_version_;
36 }; 36 };
37 37
38 // All tests are run with two different SPDY versions: SPDY/2 and SPDY/3. 38 // All tests are run with two different SPDY versions: SPDY/2 and SPDY/3.
39 INSTANTIATE_TEST_CASE_P(SpdyProtocolTests, 39 INSTANTIATE_TEST_CASE_P(SpdyProtocolTests,
40 SpdyProtocolTest, 40 SpdyProtocolTest,
41 ::testing::Values(SPDY2, SPDY3)); 41 ::testing::Values(SPDY2, SPDY3));
42 42
43 // Test our protocol constants 43 // Test our protocol constants
44 // TODO(hkhalil): Remove this test once we no longer rely on exact values.
44 TEST_P(SpdyProtocolTest, ProtocolConstants) { 45 TEST_P(SpdyProtocolTest, ProtocolConstants) {
45 EXPECT_EQ(1, SYN_STREAM); 46 EXPECT_EQ(1, SYN_STREAM);
46 EXPECT_EQ(2, SYN_REPLY); 47 EXPECT_EQ(2, SYN_REPLY);
47 EXPECT_EQ(3, RST_STREAM); 48 EXPECT_EQ(3, RST_STREAM);
48 EXPECT_EQ(4, SETTINGS); 49 EXPECT_EQ(4, SETTINGS);
49 EXPECT_EQ(5, NOOP); 50 EXPECT_EQ(5, NOOP);
50 EXPECT_EQ(6, PING); 51 EXPECT_EQ(6, PING);
51 EXPECT_EQ(7, GOAWAY); 52 EXPECT_EQ(7, GOAWAY);
52 EXPECT_EQ(8, HEADERS); 53 EXPECT_EQ(8, HEADERS);
53 EXPECT_EQ(9, WINDOW_UPDATE); 54 EXPECT_EQ(9, WINDOW_UPDATE);
54 EXPECT_EQ(10, CREDENTIAL); 55 EXPECT_EQ(10, CREDENTIAL);
55 EXPECT_EQ(11, BLOCKED); 56 EXPECT_EQ(11, BLOCKED);
56 EXPECT_EQ(12, PUSH_PROMISE); 57 EXPECT_EQ(12, PUSH_PROMISE);
57 EXPECT_EQ(13, CONTINUATION); 58 EXPECT_EQ(13, CONTINUATION);
58 EXPECT_EQ(14, ALTSVC); 59 EXPECT_EQ(14, ALTSVC);
59 EXPECT_EQ(14, LAST_CONTROL_TYPE); 60 EXPECT_EQ(15, PRIORITY);
61 EXPECT_EQ(15, LAST_CONTROL_TYPE);
60 EXPECT_EQ(std::numeric_limits<int32>::max(), kSpdyMaximumWindowSize); 62 EXPECT_EQ(std::numeric_limits<int32>::max(), kSpdyMaximumWindowSize);
61 } 63 }
62 64
63 class SpdyProtocolDeathTest : public SpdyProtocolTest {}; 65 class SpdyProtocolDeathTest : public SpdyProtocolTest {};
64 66
65 // All tests are run with two different SPDY versions: SPDY/2 and SPDY/3. 67 // All tests are run with two different SPDY versions: SPDY/2 and SPDY/3.
66 INSTANTIATE_TEST_CASE_P(SpdyProtocolDeathTests, 68 INSTANTIATE_TEST_CASE_P(SpdyProtocolDeathTests,
67 SpdyProtocolDeathTest, 69 SpdyProtocolDeathTest,
68 ::testing::Values(SPDY2, SPDY3)); 70 ::testing::Values(SPDY2, SPDY3));
69 71
70 TEST_P(SpdyProtocolDeathTest, TestSpdySettingsAndIdOutOfBounds) { 72 TEST_P(SpdyProtocolDeathTest, TestSpdySettingsAndIdOutOfBounds) {
71 scoped_ptr<SettingsFlagsAndId> flags_and_id; 73 scoped_ptr<SettingsFlagsAndId> flags_and_id;
72 74
73 EXPECT_DFATAL(flags_and_id.reset(new SettingsFlagsAndId(1, ~0)), 75 EXPECT_DFATAL(flags_and_id.reset(new SettingsFlagsAndId(1, ~0)),
74 "SPDY setting ID too large."); 76 "SPDY setting ID too large.");
75 // Make sure that we get expected values in opt mode. 77 // Make sure that we get expected values in opt mode.
76 if (flags_and_id.get() != NULL) { 78 if (flags_and_id.get() != NULL) {
77 EXPECT_EQ(1, flags_and_id->flags()); 79 EXPECT_EQ(1, flags_and_id->flags());
78 EXPECT_EQ(static_cast<SpdyPingId>(0xffffff), flags_and_id->id()); 80 EXPECT_EQ(static_cast<SpdyPingId>(0xffffff), flags_and_id->id());
79 } 81 }
80 } 82 }
81 83
82 } // namespace net 84 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_protocol.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698