| 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/core/quic_stream_sequencer.h" | 5 #include "net/quic/core/quic_stream_sequencer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstdint> | 8 #include <cstdint> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/rand_util.h" | 14 #include "base/rand_util.h" |
| 15 #include "net/base/ip_endpoint.h" | 15 #include "net/base/ip_endpoint.h" |
| 16 #include "net/quic/core/quic_flags.h" | 16 #include "net/quic/core/quic_flags.h" |
| 17 #include "net/quic/core/quic_stream.h" |
| 17 #include "net/quic/core/quic_utils.h" | 18 #include "net/quic/core/quic_utils.h" |
| 18 #include "net/quic/core/reliable_quic_stream.h" | |
| 19 #include "net/quic/test_tools/mock_clock.h" | 19 #include "net/quic/test_tools/mock_clock.h" |
| 20 #include "net/quic/test_tools/quic_stream_sequencer_peer.h" | 20 #include "net/quic/test_tools/quic_stream_sequencer_peer.h" |
| 21 #include "net/quic/test_tools/quic_test_utils.h" | 21 #include "net/quic/test_tools/quic_test_utils.h" |
| 22 #include "net/test/gtest_util.h" | 22 #include "net/test/gtest_util.h" |
| 23 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
| 24 #include "testing/gmock_mutant.h" | 24 #include "testing/gmock_mutant.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 26 |
| 27 using base::StringPiece; | 27 using base::StringPiece; |
| 28 using std::min; | 28 using std::min; |
| 29 using std::string; | 29 using std::string; |
| 30 using testing::_; | 30 using testing::_; |
| 31 using testing::AnyNumber; | 31 using testing::AnyNumber; |
| 32 using testing::CreateFunctor; | 32 using testing::CreateFunctor; |
| 33 using testing::InSequence; | 33 using testing::InSequence; |
| 34 using testing::Return; | 34 using testing::Return; |
| 35 using testing::StrEq; | 35 using testing::StrEq; |
| 36 | 36 |
| 37 namespace net { | 37 namespace net { |
| 38 namespace test { | 38 namespace test { |
| 39 | 39 |
| 40 class MockStream : public ReliableQuicStream { | 40 class MockStream : public QuicStream { |
| 41 public: | 41 public: |
| 42 MockStream(QuicSession* session, QuicStreamId id) | 42 MockStream(QuicSession* session, QuicStreamId id) : QuicStream(id, session) {} |
| 43 : ReliableQuicStream(id, session) {} | |
| 44 | 43 |
| 45 MOCK_METHOD0(OnFinRead, void()); | 44 MOCK_METHOD0(OnFinRead, void()); |
| 46 MOCK_METHOD0(OnDataAvailable, void()); | 45 MOCK_METHOD0(OnDataAvailable, void()); |
| 47 MOCK_METHOD2(CloseConnectionWithDetails, | 46 MOCK_METHOD2(CloseConnectionWithDetails, |
| 48 void(QuicErrorCode error, const string& details)); | 47 void(QuicErrorCode error, const string& details)); |
| 49 MOCK_METHOD1(Reset, void(QuicRstStreamErrorCode error)); | 48 MOCK_METHOD1(Reset, void(QuicRstStreamErrorCode error)); |
| 50 MOCK_METHOD0(OnCanWrite, void()); | 49 MOCK_METHOD0(OnCanWrite, void()); |
| 51 virtual bool IsFlowControlEnabled() const { return true; } | 50 virtual bool IsFlowControlEnabled() const { return true; } |
| 52 | 51 |
| 53 const IPEndPoint& PeerAddressOfLatestPacket() const override { | 52 const IPEndPoint& PeerAddressOfLatestPacket() const override { |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 // Pass in a null iovec, expect to tear down connection. | 680 // Pass in a null iovec, expect to tear down connection. |
| 682 EXPECT_CALL(stream_, CloseConnectionWithDetails( | 681 EXPECT_CALL(stream_, CloseConnectionWithDetails( |
| 683 QUIC_STREAM_SEQUENCER_INVALID_STATE, _)); | 682 QUIC_STREAM_SEQUENCER_INVALID_STATE, _)); |
| 684 iovec iov{nullptr, 512}; | 683 iovec iov{nullptr, 512}; |
| 685 sequencer_->Readv(&iov, 1u); | 684 sequencer_->Readv(&iov, 1u); |
| 686 } | 685 } |
| 687 | 686 |
| 688 } // namespace | 687 } // namespace |
| 689 } // namespace test | 688 } // namespace test |
| 690 } // namespace net | 689 } // namespace net |
| OLD | NEW |