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

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

Issue 2445113002: Add HTTP/2 error code NO_ERROR. (Closed)
Patch Set: Rebase. Created 4 years, 1 month 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/spdy/spdy_framer.cc ('k') | net/spdy/spdy_network_transaction_unittest.cc » ('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_framer.h" 5 #include "net/spdy/spdy_framer.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 5167 matching lines...) Expand 10 before | Expand all | Expand 10 after
5178 "SPDY_INVALID_DATA_FRAME_FLAGS", 5178 "SPDY_INVALID_DATA_FRAME_FLAGS",
5179 SpdyFramer::ErrorCodeToString(SpdyFramer::SPDY_INVALID_DATA_FRAME_FLAGS)); 5179 SpdyFramer::ErrorCodeToString(SpdyFramer::SPDY_INVALID_DATA_FRAME_FLAGS));
5180 EXPECT_STREQ("SPDY_INVALID_CONTROL_FRAME_FLAGS", 5180 EXPECT_STREQ("SPDY_INVALID_CONTROL_FRAME_FLAGS",
5181 SpdyFramer::ErrorCodeToString( 5181 SpdyFramer::ErrorCodeToString(
5182 SpdyFramer::SPDY_INVALID_CONTROL_FRAME_FLAGS)); 5182 SpdyFramer::SPDY_INVALID_CONTROL_FRAME_FLAGS));
5183 EXPECT_STREQ("UNKNOWN_ERROR", 5183 EXPECT_STREQ("UNKNOWN_ERROR",
5184 SpdyFramer::ErrorCodeToString(SpdyFramer::LAST_ERROR)); 5184 SpdyFramer::ErrorCodeToString(SpdyFramer::LAST_ERROR));
5185 } 5185 }
5186 5186
5187 TEST_P(SpdyFramerTest, StatusCodeToStringTest) { 5187 TEST_P(SpdyFramerTest, StatusCodeToStringTest) {
5188 EXPECT_STREQ("INVALID", SpdyFramer::StatusCodeToString(RST_STREAM_INVALID)); 5188 EXPECT_STREQ("NO_ERROR", SpdyFramer::StatusCodeToString(RST_STREAM_NO_ERROR));
5189 EXPECT_STREQ("PROTOCOL_ERROR", 5189 EXPECT_STREQ("PROTOCOL_ERROR",
5190 SpdyFramer::StatusCodeToString(RST_STREAM_PROTOCOL_ERROR)); 5190 SpdyFramer::StatusCodeToString(RST_STREAM_PROTOCOL_ERROR));
5191 EXPECT_STREQ("INVALID_STREAM", 5191 EXPECT_STREQ("INVALID_STREAM",
5192 SpdyFramer::StatusCodeToString(RST_STREAM_INVALID_STREAM)); 5192 SpdyFramer::StatusCodeToString(RST_STREAM_INVALID_STREAM));
5193 EXPECT_STREQ("REFUSED_STREAM", 5193 EXPECT_STREQ("REFUSED_STREAM",
5194 SpdyFramer::StatusCodeToString(RST_STREAM_REFUSED_STREAM)); 5194 SpdyFramer::StatusCodeToString(RST_STREAM_REFUSED_STREAM));
5195 EXPECT_STREQ("UNSUPPORTED_VERSION", 5195 EXPECT_STREQ("UNSUPPORTED_VERSION",
5196 SpdyFramer::StatusCodeToString(RST_STREAM_UNSUPPORTED_VERSION)); 5196 SpdyFramer::StatusCodeToString(RST_STREAM_UNSUPPORTED_VERSION));
5197 EXPECT_STREQ("CANCEL", SpdyFramer::StatusCodeToString(RST_STREAM_CANCEL)); 5197 EXPECT_STREQ("CANCEL", SpdyFramer::StatusCodeToString(RST_STREAM_CANCEL));
5198 EXPECT_STREQ("INTERNAL_ERROR", 5198 EXPECT_STREQ("INTERNAL_ERROR",
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
5861 0x00, // Flags: none 5861 0x00, // Flags: none
5862 0x00, 0x00, 0x00, 0x01, // Stream: 1 5862 0x00, 0x00, 0x00, 0x01, // Stream: 1
5863 0x00, 0x00, 0x00, 0xff, // Error: 255 5863 0x00, 0x00, 0x00, 0xff, // Error: 255
5864 }; 5864 };
5865 5865
5866 testing::StrictMock<test::MockSpdyFramerVisitor> visitor; 5866 testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
5867 SpdyFramer framer(spdy_version_); 5867 SpdyFramer framer(spdy_version_);
5868 framer.set_visitor(&visitor); 5868 framer.set_visitor(&visitor);
5869 5869
5870 if (IsSpdy3()) { 5870 if (IsSpdy3()) {
5871 EXPECT_CALL(visitor, OnRstStream(1, RST_STREAM_INVALID)); 5871 EXPECT_CALL(visitor, OnRstStream(1, RST_STREAM_NO_ERROR));
5872 framer.ProcessInput(reinterpret_cast<const char*>(kV3RstStreamInvalid), 5872 framer.ProcessInput(reinterpret_cast<const char*>(kV3RstStreamInvalid),
5873 arraysize(kV3RstStreamInvalid)); 5873 arraysize(kV3RstStreamInvalid));
5874 } else { 5874 } else {
5875 EXPECT_CALL(visitor, OnRstStream(1, RST_STREAM_INTERNAL_ERROR)); 5875 EXPECT_CALL(visitor, OnRstStream(1, RST_STREAM_NO_ERROR));
5876 framer.ProcessInput(reinterpret_cast<const char*>(kH2RstStreamInvalid), 5876 framer.ProcessInput(reinterpret_cast<const char*>(kH2RstStreamInvalid),
5877 arraysize(kH2RstStreamInvalid)); 5877 arraysize(kH2RstStreamInvalid));
5878 } 5878 }
5879 EXPECT_EQ(SpdyFramer::SPDY_READY_FOR_FRAME, framer.state()); 5879 EXPECT_EQ(SpdyFramer::SPDY_READY_FOR_FRAME, framer.state());
5880 EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code()) 5880 EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code())
5881 << SpdyFramer::ErrorCodeToString(framer.error_code()); 5881 << SpdyFramer::ErrorCodeToString(framer.error_code());
5882 5882
5883 framer.Reset(); 5883 framer.Reset();
5884 5884
5885 if (IsSpdy3()) { 5885 if (IsSpdy3()) {
5886 EXPECT_CALL(visitor, OnRstStream(1, RST_STREAM_INVALID)); 5886 EXPECT_CALL(visitor, OnRstStream(1, RST_STREAM_NO_ERROR));
5887 framer.ProcessInput( 5887 framer.ProcessInput(
5888 reinterpret_cast<const char*>(kV3RstStreamNumStatusCodes), 5888 reinterpret_cast<const char*>(kV3RstStreamNumStatusCodes),
5889 arraysize(kV3RstStreamNumStatusCodes)); 5889 arraysize(kV3RstStreamNumStatusCodes));
5890 } else { 5890 } else {
5891 EXPECT_CALL(visitor, OnRstStream(1, RST_STREAM_INTERNAL_ERROR)); 5891 EXPECT_CALL(visitor, OnRstStream(1, RST_STREAM_INTERNAL_ERROR));
5892 framer.ProcessInput( 5892 framer.ProcessInput(
5893 reinterpret_cast<const char*>(kH2RstStreamNumStatusCodes), 5893 reinterpret_cast<const char*>(kH2RstStreamNumStatusCodes),
5894 arraysize(kH2RstStreamNumStatusCodes)); 5894 arraysize(kH2RstStreamNumStatusCodes));
5895 } 5895 }
5896 EXPECT_EQ(SpdyFramer::SPDY_READY_FOR_FRAME, framer.state()); 5896 EXPECT_EQ(SpdyFramer::SPDY_READY_FOR_FRAME, framer.state());
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
6392 6392
6393 EXPECT_EQ(1, visitor->data_frame_count_); 6393 EXPECT_EQ(1, visitor->data_frame_count_);
6394 EXPECT_EQ(strlen(four_score), static_cast<unsigned>(visitor->data_bytes_)); 6394 EXPECT_EQ(strlen(four_score), static_cast<unsigned>(visitor->data_bytes_));
6395 EXPECT_EQ(0, visitor->headers_frame_count_); 6395 EXPECT_EQ(0, visitor->headers_frame_count_);
6396 } 6396 }
6397 } 6397 }
6398 6398
6399 } // namespace test 6399 } // namespace test
6400 6400
6401 } // namespace net 6401 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_framer.cc ('k') | net/spdy/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698