| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  110  |  110  | 
|  111 // All tests are run with 3 different SPDY versions: SPDY/2, SPDY/3, SPDY/4. |  111 // All tests are run with 3 different SPDY versions: SPDY/2, SPDY/3, SPDY/4. | 
|  112 INSTANTIATE_TEST_CASE_P(SpdyHeadersBlockParserTests, |  112 INSTANTIATE_TEST_CASE_P(SpdyHeadersBlockParserTests, | 
|  113                         SpdyHeadersBlockParserTest, |  113                         SpdyHeadersBlockParserTest, | 
|  114                         ::testing::Values(SPDY2, SPDY3, SPDY4)); |  114                         ::testing::Values(SPDY2, SPDY3, SPDY4)); | 
|  115  |  115  | 
|  116 TEST_P(SpdyHeadersBlockParserTest, BasicTest) { |  116 TEST_P(SpdyHeadersBlockParserTest, BasicTest) { | 
|  117   // Sanity test, verify that we parse out correctly a block with |  117   // Sanity test, verify that we parse out correctly a block with | 
|  118   // a single key-value pair and that we notify when we start and finish |  118   // a single key-value pair and that we notify when we start and finish | 
|  119   // handling a headers block. |  119   // handling a headers block. | 
 |  120   EXPECT_EQ(spdy_version_, parser_->spdy_version()); | 
 |  121  | 
|  120   string headers(CreateHeaders(1, false)); |  122   string headers(CreateHeaders(1, false)); | 
|  121  |  123  | 
|  122   EXPECT_CALL(handler_, OnHeaderBlock(1)).Times(1); |  124   EXPECT_CALL(handler_, OnHeaderBlock(1)).Times(1); | 
|  123  |  125  | 
|  124   std::string expect_key = kBaseKey + IntToString(0); |  126   std::string expect_key = kBaseKey + IntToString(0); | 
|  125   std::string expect_value = kBaseValue + IntToString(0); |  127   std::string expect_value = kBaseValue + IntToString(0); | 
|  126   EXPECT_CALL(handler_, OnHeader(StringPiece(expect_key), |  128   EXPECT_CALL(handler_, OnHeader(StringPiece(expect_key), | 
|  127                                  StringPiece(expect_value))).Times(1); |  129                                  StringPiece(expect_value))).Times(1); | 
|  128   EXPECT_CALL(handler_, OnHeaderBlockEnd(headers.length())).Times(1); |  130   EXPECT_CALL(handler_, OnHeaderBlockEnd(headers.length())).Times(1); | 
|  129  |  131  | 
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  269   string headers(CreateHeaders(kNumHeadersInBlock, false)); |  271   string headers(CreateHeaders(kNumHeadersInBlock, false)); | 
|  270   bool result; |  272   bool result; | 
|  271   EXPECT_DFATAL( |  273   EXPECT_DFATAL( | 
|  272       result = parser_->HandleControlFrameHeadersData(0, headers.data(), 1), |  274       result = parser_->HandleControlFrameHeadersData(0, headers.data(), 1), | 
|  273       "Expected nonzero stream id, saw: 0"); |  275       "Expected nonzero stream id, saw: 0"); | 
|  274   EXPECT_FALSE(result); |  276   EXPECT_FALSE(result); | 
|  275   EXPECT_EQ(SpdyHeadersBlockParser::UNEXPECTED_STREAM_ID, parser_->get_error()); |  277   EXPECT_EQ(SpdyHeadersBlockParser::UNEXPECTED_STREAM_ID, parser_->get_error()); | 
|  276 } |  278 } | 
|  277  |  279  | 
|  278 }  // namespace net |  280 }  // namespace net | 
| OLD | NEW |