| 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_pinnable_buffer_piece.h" | 5 #include "net/spdy/spdy_pinnable_buffer_piece.h" |
| 6 | 6 |
| 7 #include "net/spdy/spdy_prefixed_buffer_reader.h" | 7 #include "net/spdy/spdy_prefixed_buffer_reader.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| 11 | 11 |
| 12 namespace test { | 12 namespace test { |
| 13 | 13 |
| 14 using base::StringPiece; | 14 using base::StringPiece; |
| 15 | 15 |
| 16 class SpdyPinnableBufferPieceTest : public ::testing::Test { | 16 class SpdyPinnableBufferPieceTest : public ::testing::Test { |
| 17 protected: | 17 protected: |
| 18 SpdyPrefixedBufferReader Build(std::string prefix, std::string suffix) { | 18 SpdyPrefixedBufferReader Build(const std::string& prefix, |
| 19 const std::string& suffix) { |
| 19 prefix_ = prefix; | 20 prefix_ = prefix; |
| 20 suffix_ = suffix; | 21 suffix_ = suffix; |
| 21 return SpdyPrefixedBufferReader(prefix_.data(), prefix_.length(), | 22 return SpdyPrefixedBufferReader(prefix_.data(), prefix_.length(), |
| 22 suffix_.data(), suffix_.length()); | 23 suffix_.data(), suffix_.length()); |
| 23 } | 24 } |
| 24 std::string prefix_, suffix_; | 25 std::string prefix_, suffix_; |
| 25 }; | 26 }; |
| 26 | 27 |
| 27 TEST_F(SpdyPinnableBufferPieceTest, Pin) { | 28 TEST_F(SpdyPinnableBufferPieceTest, Pin) { |
| 28 SpdyPrefixedBufferReader reader = Build("foobar", ""); | 29 SpdyPrefixedBufferReader reader = Build("foobar", ""); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 SpdyPinnableBufferPiece empty; | 71 SpdyPinnableBufferPiece empty; |
| 71 piece2.Swap(&empty); | 72 piece2.Swap(&empty); |
| 72 | 73 |
| 73 EXPECT_EQ(StringPiece(""), piece2); | 74 EXPECT_EQ(StringPiece(""), piece2); |
| 74 EXPECT_FALSE(piece2.IsPinned()); | 75 EXPECT_FALSE(piece2.IsPinned()); |
| 75 } | 76 } |
| 76 | 77 |
| 77 } // namespace test | 78 } // namespace test |
| 78 | 79 |
| 79 } // namespace net | 80 } // namespace net |
| OLD | NEW |