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 "net/quic/core/quic_stream.h" | 13 #include "net/quic/core/quic_stream.h" |
14 #include "net/quic/core/quic_utils.h" | 14 #include "net/quic/core/quic_utils.h" |
15 #include "net/quic/platform/api/quic_logging.h" | 15 #include "net/quic/platform/api/quic_logging.h" |
16 #include "net/quic/platform/api/quic_string_piece.h" | 16 #include "net/quic/platform/api/quic_string_piece.h" |
| 17 #include "net/quic/platform/api/quic_test.h" |
17 #include "net/quic/test_tools/mock_clock.h" | 18 #include "net/quic/test_tools/mock_clock.h" |
18 #include "net/quic/test_tools/quic_stream_sequencer_peer.h" | 19 #include "net/quic/test_tools/quic_stream_sequencer_peer.h" |
19 #include "net/quic/test_tools/quic_test_utils.h" | 20 #include "net/quic/test_tools/quic_test_utils.h" |
20 #include "net/test/gtest_util.h" | 21 #include "net/test/gtest_util.h" |
21 #include "testing/gmock/include/gmock/gmock.h" | |
22 #include "testing/gmock_mutant.h" | 22 #include "testing/gmock_mutant.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | |
24 | 23 |
25 using std::string; | 24 using std::string; |
26 using testing::_; | 25 using testing::_; |
27 using testing::AnyNumber; | 26 using testing::AnyNumber; |
28 using testing::CreateFunctor; | 27 using testing::CreateFunctor; |
29 using testing::InSequence; | 28 using testing::InSequence; |
30 using testing::Return; | 29 using testing::Return; |
31 using testing::StrEq; | 30 using testing::StrEq; |
32 | 31 |
33 namespace net { | 32 namespace net { |
(...skipping 18 matching lines...) Expand all Loading... |
52 protected: | 51 protected: |
53 QuicSocketAddress peer_address_ = | 52 QuicSocketAddress peer_address_ = |
54 QuicSocketAddress(QuicIpAddress::Any4(), 65535); | 53 QuicSocketAddress(QuicIpAddress::Any4(), 65535); |
55 }; | 54 }; |
56 | 55 |
57 namespace { | 56 namespace { |
58 | 57 |
59 static const char kPayload[] = | 58 static const char kPayload[] = |
60 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; | 59 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; |
61 | 60 |
62 class QuicStreamSequencerTest : public ::testing::Test { | 61 class QuicStreamSequencerTest : public QuicTest { |
63 public: | 62 public: |
64 void ConsumeData(size_t num_bytes) { | 63 void ConsumeData(size_t num_bytes) { |
65 char buffer[1024]; | 64 char buffer[1024]; |
66 ASSERT_GT(arraysize(buffer), num_bytes); | 65 ASSERT_GT(arraysize(buffer), num_bytes); |
67 struct iovec iov; | 66 struct iovec iov; |
68 iov.iov_base = buffer; | 67 iov.iov_base = buffer; |
69 iov.iov_len = num_bytes; | 68 iov.iov_len = num_bytes; |
70 ASSERT_EQ(static_cast<int>(num_bytes), sequencer_->Readv(&iov, 1)); | 69 ASSERT_EQ(static_cast<int>(num_bytes), sequencer_->Readv(&iov, 1)); |
71 } | 70 } |
72 | 71 |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 source.set(nullptr, 5u); | 671 source.set(nullptr, 5u); |
673 QuicStreamFrame frame(kClientDataStreamId1, false, 1, source); | 672 QuicStreamFrame frame(kClientDataStreamId1, false, 1, source); |
674 EXPECT_CALL(stream_, CloseConnectionWithDetails( | 673 EXPECT_CALL(stream_, CloseConnectionWithDetails( |
675 QUIC_STREAM_SEQUENCER_INVALID_STATE, _)); | 674 QUIC_STREAM_SEQUENCER_INVALID_STATE, _)); |
676 sequencer_->OnStreamFrame(frame); | 675 sequencer_->OnStreamFrame(frame); |
677 } | 676 } |
678 | 677 |
679 } // namespace | 678 } // namespace |
680 } // namespace test | 679 } // namespace test |
681 } // namespace net | 680 } // namespace net |
OLD | NEW |