OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/tools/quic/quic_spdy_server_stream_base.h" | 5 #include "net/tools/quic/quic_spdy_server_stream_base.h" |
6 | 6 |
7 #include "net/quic/platform/api/quic_ptr_util.h" | 7 #include "net/quic/platform/api/quic_ptr_util.h" |
| 8 #include "net/quic/platform/api/quic_test.h" |
8 #include "net/quic/test_tools/quic_test_utils.h" | 9 #include "net/quic/test_tools/quic_test_utils.h" |
9 #include "testing/gmock/include/gmock/gmock.h" | |
10 #include "testing/gtest/include/gtest/gtest.h" | |
11 | 10 |
12 using testing::_; | 11 using testing::_; |
13 | 12 |
14 namespace net { | 13 namespace net { |
15 namespace test { | 14 namespace test { |
16 namespace { | 15 namespace { |
17 | 16 |
18 class TestQuicSpdyServerStream : public QuicSpdyServerStreamBase { | 17 class TestQuicSpdyServerStream : public QuicSpdyServerStreamBase { |
19 public: | 18 public: |
20 TestQuicSpdyServerStream(QuicStreamId id, QuicSpdySession* session) | 19 TestQuicSpdyServerStream(QuicStreamId id, QuicSpdySession* session) |
21 : QuicSpdyServerStreamBase(id, session) {} | 20 : QuicSpdyServerStreamBase(id, session) {} |
22 | 21 |
23 void OnDataAvailable() override {} | 22 void OnDataAvailable() override {} |
24 }; | 23 }; |
25 | 24 |
26 class QuicSpdyServerStreamBaseTest : public ::testing::Test { | 25 class QuicSpdyServerStreamBaseTest : public QuicTest { |
27 protected: | 26 protected: |
28 QuicSpdyServerStreamBaseTest() | 27 QuicSpdyServerStreamBaseTest() |
29 : session_(new MockQuicConnection(&helper_, | 28 : session_(new MockQuicConnection(&helper_, |
30 &alarm_factory_, | 29 &alarm_factory_, |
31 Perspective::IS_SERVER)) { | 30 Perspective::IS_SERVER)) { |
32 stream_ = new TestQuicSpdyServerStream(kClientDataStreamId1, &session_); | 31 stream_ = new TestQuicSpdyServerStream(kClientDataStreamId1, &session_); |
33 session_.ActivateStream(QuicWrapUnique(stream_)); | 32 session_.ActivateStream(QuicWrapUnique(stream_)); |
34 } | 33 } |
35 | 34 |
36 QuicSpdyServerStreamBase* stream_ = nullptr; | 35 QuicSpdyServerStreamBase* stream_ = nullptr; |
(...skipping 19 matching lines...) Expand all Loading... |
56 QuicRstStreamFrame rst_frame(stream_->id(), QUIC_STREAM_CANCELLED, 1234); | 55 QuicRstStreamFrame rst_frame(stream_->id(), QUIC_STREAM_CANCELLED, 1234); |
57 stream_->OnStreamReset(rst_frame); | 56 stream_->OnStreamReset(rst_frame); |
58 | 57 |
59 EXPECT_TRUE(stream_->reading_stopped()); | 58 EXPECT_TRUE(stream_->reading_stopped()); |
60 EXPECT_TRUE(stream_->write_side_closed()); | 59 EXPECT_TRUE(stream_->write_side_closed()); |
61 } | 60 } |
62 | 61 |
63 } // namespace | 62 } // namespace |
64 } // namespace test | 63 } // namespace test |
65 } // namespace net | 64 } // namespace net |
OLD | NEW |