| 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/quic/quartc/quartc_stream.h" | 5 #include "net/quic/quartc/quartc_stream.h" |
| 6 | 6 |
| 7 #include "base/threading/thread_task_runner_handle.h" | 7 #include "base/threading/thread_task_runner_handle.h" |
| 8 #include "net/quic/core/crypto/quic_random.h" | 8 #include "net/quic/core/crypto/quic_random.h" |
| 9 #include "net/quic/core/quic_session.h" | 9 #include "net/quic/core/quic_session.h" |
| 10 #include "net/quic/core/quic_simple_buffer_allocator.h" | 10 #include "net/quic/core/quic_simple_buffer_allocator.h" |
| 11 #include "net/quic/platform/impl/quic_chromium_clock.h" |
| 11 #include "net/quic/quartc/quartc_alarm_factory.h" | 12 #include "net/quic/quartc/quartc_alarm_factory.h" |
| 12 #include "net/quic/quartc/quartc_stream_interface.h" | 13 #include "net/quic/quartc/quartc_stream_interface.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 15 |
| 15 namespace net { | 16 namespace net { |
| 16 namespace test { | 17 namespace test { |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 static const SpdyPriority kDefaultPriority = 3; | 20 static const SpdyPriority kDefaultPriority = 3; |
| 20 static const QuicStreamId kStreamId = 5; | 21 static const QuicStreamId kStreamId = 5; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 std::unique_ptr<MockQuartcStreamDelegate> mock_stream_delegate_; | 187 std::unique_ptr<MockQuartcStreamDelegate> mock_stream_delegate_; |
| 187 std::unique_ptr<MockQuicSession> session_; | 188 std::unique_ptr<MockQuicSession> session_; |
| 188 // Data written by the ReliableQuicStreamAdapterTest. | 189 // Data written by the ReliableQuicStreamAdapterTest. |
| 189 std::string write_buffer_; | 190 std::string write_buffer_; |
| 190 // Data read by the ReliableQuicStreamAdapterTest. | 191 // Data read by the ReliableQuicStreamAdapterTest. |
| 191 std::string read_buffer_; | 192 std::string read_buffer_; |
| 192 std::unique_ptr<QuartcAlarmFactory> alarm_factory_; | 193 std::unique_ptr<QuartcAlarmFactory> alarm_factory_; |
| 193 std::unique_ptr<QuicConnection> connection_; | 194 std::unique_ptr<QuicConnection> connection_; |
| 194 // Used to implement the QuicConnectionHelperInterface. | 195 // Used to implement the QuicConnectionHelperInterface. |
| 195 SimpleBufferAllocator buffer_allocator_; | 196 SimpleBufferAllocator buffer_allocator_; |
| 196 QuicClock clock_; | 197 QuicChromiumClock clock_; |
| 197 }; | 198 }; |
| 198 | 199 |
| 199 // Write an entire string. | 200 // Write an entire string. |
| 200 TEST_F(QuartcStreamTest, WriteDataWhole) { | 201 TEST_F(QuartcStreamTest, WriteDataWhole) { |
| 201 CreateReliableQuicStream(); | 202 CreateReliableQuicStream(); |
| 202 stream_->Write("Foo bar", 7, kDefaultParam); | 203 stream_->Write("Foo bar", 7, kDefaultParam); |
| 203 EXPECT_EQ("Foo bar", write_buffer_); | 204 EXPECT_EQ("Foo bar", write_buffer_); |
| 204 } | 205 } |
| 205 | 206 |
| 206 // Write part of a string. | 207 // Write part of a string. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 TEST_F(QuartcStreamTest, CloseStream) { | 255 TEST_F(QuartcStreamTest, CloseStream) { |
| 255 CreateReliableQuicStream(); | 256 CreateReliableQuicStream(); |
| 256 EXPECT_FALSE(mock_stream_delegate_->closed()); | 257 EXPECT_FALSE(mock_stream_delegate_->closed()); |
| 257 stream_->OnClose(); | 258 stream_->OnClose(); |
| 258 EXPECT_TRUE(mock_stream_delegate_->closed()); | 259 EXPECT_TRUE(mock_stream_delegate_->closed()); |
| 259 } | 260 } |
| 260 | 261 |
| 261 } // namespace | 262 } // namespace |
| 262 } // namespace test | 263 } // namespace test |
| 263 } // namespace net | 264 } // namespace net |
| OLD | NEW |