OLD | NEW |
---|---|
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/quic/quic_reliable_client_stream.h" | 5 #include "net/quic/quic_reliable_client_stream.h" |
6 | 6 |
7 #include "net/base/net_errors.h" | 7 #include "net/base/net_errors.h" |
8 #include "net/quic/quic_client_session.h" | 8 #include "net/quic/quic_client_session.h" |
9 #include "net/quic/quic_utils.h" | 9 #include "net/quic/quic_utils.h" |
10 #include "net/quic/test_tools/quic_test_utils.h" | 10 #include "net/quic/test_tools/quic_test_utils.h" |
(...skipping 17 matching lines...) Expand all Loading... | |
28 MOCK_METHOD1(OnError, void(int)); | 28 MOCK_METHOD1(OnError, void(int)); |
29 | 29 |
30 private: | 30 private: |
31 DISALLOW_COPY_AND_ASSIGN(MockDelegate); | 31 DISALLOW_COPY_AND_ASSIGN(MockDelegate); |
32 }; | 32 }; |
33 | 33 |
34 class QuicReliableClientStreamTest : public ::testing::Test { | 34 class QuicReliableClientStreamTest : public ::testing::Test { |
35 public: | 35 public: |
36 QuicReliableClientStreamTest() | 36 QuicReliableClientStreamTest() |
37 : session_(new MockConnection(1, IPEndPoint()), false), | 37 : session_(new MockConnection(1, IPEndPoint()), false), |
38 stream_(1, &session_) { | 38 stream_(1, &session_, net_log_) { |
eroman
2013/02/05 23:17:30
If the test doesn't use it, you can also pass in B
Ryan Hamilton
2013/02/05 23:35:29
Done.
| |
39 stream_.SetDelegate(&delegate_); | 39 stream_.SetDelegate(&delegate_); |
40 } | 40 } |
41 | 41 |
42 testing::StrictMock<MockDelegate> delegate_; | 42 testing::StrictMock<MockDelegate> delegate_; |
43 BoundNetLog net_log_; | |
43 MockSession session_; | 44 MockSession session_; |
44 QuicReliableClientStream stream_; | 45 QuicReliableClientStream stream_; |
45 }; | 46 }; |
46 | 47 |
47 TEST_F(QuicReliableClientStreamTest, TerminateFromPeer) { | 48 TEST_F(QuicReliableClientStreamTest, TerminateFromPeer) { |
48 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)); | 49 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)); |
49 | 50 |
50 stream_.TerminateFromPeer(true); | 51 stream_.TerminateFromPeer(true); |
51 } | 52 } |
52 | 53 |
(...skipping 19 matching lines...) Expand all Loading... | |
72 TEST_F(QuicReliableClientStreamTest, OnError) { | 73 TEST_F(QuicReliableClientStreamTest, OnError) { |
73 EXPECT_CALL(delegate_, OnError(ERR_INTERNET_DISCONNECTED)); | 74 EXPECT_CALL(delegate_, OnError(ERR_INTERNET_DISCONNECTED)); |
74 | 75 |
75 stream_.OnError(ERR_INTERNET_DISCONNECTED); | 76 stream_.OnError(ERR_INTERNET_DISCONNECTED); |
76 EXPECT_FALSE(stream_.GetDelegate()); | 77 EXPECT_FALSE(stream_.GetDelegate()); |
77 } | 78 } |
78 | 79 |
79 } // namespace | 80 } // namespace |
80 } // namespace test | 81 } // namespace test |
81 } // namespace net | 82 } // namespace net |
OLD | NEW |