| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_headers_block_parser.h" | 5 #include "net/spdy/spdy_headers_block_parser.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 StringPiece, | 31 StringPiece, |
| 32 StringPiece)); | 32 StringPiece)); |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 class SpdyHeadersBlockParserTest : | 35 class SpdyHeadersBlockParserTest : |
| 36 public ::testing::TestWithParam<SpdyMajorVersion> { | 36 public ::testing::TestWithParam<SpdyMajorVersion> { |
| 37 public: | 37 public: |
| 38 virtual ~SpdyHeadersBlockParserTest() {} | 38 virtual ~SpdyHeadersBlockParserTest() {} |
| 39 | 39 |
| 40 protected: | 40 protected: |
| 41 virtual void SetUp() { | 41 void SetUp() override { |
| 42 // Create a parser using the mock handler. | 42 // Create a parser using the mock handler. |
| 43 spdy_version_ = GetParam(); | 43 spdy_version_ = GetParam(); |
| 44 parser_.reset(new SpdyHeadersBlockParser(spdy_version_, &handler_)); | 44 parser_.reset(new SpdyHeadersBlockParser(spdy_version_, &handler_)); |
| 45 length_field_size_ = | 45 length_field_size_ = |
| 46 SpdyHeadersBlockParser::LengthFieldSizeForVersion(spdy_version_); | 46 SpdyHeadersBlockParser::LengthFieldSizeForVersion(spdy_version_); |
| 47 } | 47 } |
| 48 | 48 |
| 49 // Create a header block with a specified number of headers. | 49 // Create a header block with a specified number of headers. |
| 50 string CreateHeaders(uint32_t num_headers, bool insert_nulls) { | 50 string CreateHeaders(uint32_t num_headers, bool insert_nulls) { |
| 51 string headers; | 51 string headers; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 string expect_value = kBaseValue + IntToString(0); | 250 string expect_value = kBaseValue + IntToString(0); |
| 251 EXPECT_CALL(handler_, OnHeader(1, StringPiece(expect_key), | 251 EXPECT_CALL(handler_, OnHeader(1, StringPiece(expect_key), |
| 252 StringPiece(expect_value))).Times(1); | 252 StringPiece(expect_value))).Times(1); |
| 253 | 253 |
| 254 EXPECT_FALSE(parser_-> | 254 EXPECT_FALSE(parser_-> |
| 255 HandleControlFrameHeadersData(1, headers.c_str(), headers.length())); | 255 HandleControlFrameHeadersData(1, headers.c_str(), headers.length())); |
| 256 EXPECT_EQ(SpdyHeadersBlockParser::TOO_MUCH_DATA, parser_->get_error()); | 256 EXPECT_EQ(SpdyHeadersBlockParser::TOO_MUCH_DATA, parser_->get_error()); |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace net | 259 } // namespace net |
| OLD | NEW |