Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: net/quic/reliable_quic_stream_test.cc

Issue 763833003: Remove using namespace in net/quic/quic_stream_sequencer.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/reliable_quic_stream.h" 5 #include "net/quic/reliable_quic_stream.h"
6 6
7 #include <string>
8
7 #include "net/quic/quic_ack_notifier.h" 9 #include "net/quic/quic_ack_notifier.h"
8 #include "net/quic/quic_connection.h" 10 #include "net/quic/quic_connection.h"
9 #include "net/quic/quic_utils.h" 11 #include "net/quic/quic_utils.h"
10 #include "net/quic/quic_write_blocked_list.h" 12 #include "net/quic/quic_write_blocked_list.h"
11 #include "net/quic/spdy_utils.h" 13 #include "net/quic/spdy_utils.h"
12 #include "net/quic/test_tools/quic_config_peer.h" 14 #include "net/quic/test_tools/quic_config_peer.h"
13 #include "net/quic/test_tools/quic_connection_peer.h" 15 #include "net/quic/test_tools/quic_connection_peer.h"
14 #include "net/quic/test_tools/quic_flow_controller_peer.h" 16 #include "net/quic/test_tools/quic_flow_controller_peer.h"
15 #include "net/quic/test_tools/quic_session_peer.h" 17 #include "net/quic/test_tools/quic_session_peer.h"
16 #include "net/quic/test_tools/quic_test_utils.h" 18 #include "net/quic/test_tools/quic_test_utils.h"
(...skipping 27 matching lines...) Expand all
44 public: 46 public:
45 TestStream(QuicStreamId id, 47 TestStream(QuicStreamId id,
46 QuicSession* session, 48 QuicSession* session,
47 bool should_process_data) 49 bool should_process_data)
48 : ReliableQuicStream(id, session), 50 : ReliableQuicStream(id, session),
49 should_process_data_(should_process_data) {} 51 should_process_data_(should_process_data) {}
50 52
51 uint32 ProcessRawData(const char* data, uint32 data_len) override { 53 uint32 ProcessRawData(const char* data, uint32 data_len) override {
52 EXPECT_NE(0u, data_len); 54 EXPECT_NE(0u, data_len);
53 DVLOG(1) << "ProcessData data_len: " << data_len; 55 DVLOG(1) << "ProcessData data_len: " << data_len;
54 data_ += string(data, data_len); 56 data_ += std::string(data, data_len);
55 return should_process_data_ ? data_len : 0; 57 return should_process_data_ ? data_len : 0;
56 } 58 }
57 59
58 QuicPriority EffectivePriority() const override { 60 QuicPriority EffectivePriority() const override {
59 return QuicUtils::HighestPriority(); 61 return QuicUtils::HighestPriority();
60 } 62 }
61 63
62 using ReliableQuicStream::WriteOrBufferData; 64 using ReliableQuicStream::WriteOrBufferData;
63 using ReliableQuicStream::CloseReadSide; 65 using ReliableQuicStream::CloseReadSide;
64 using ReliableQuicStream::CloseWriteSide; 66 using ReliableQuicStream::CloseWriteSide;
65 using ReliableQuicStream::OnClose; 67 using ReliableQuicStream::OnClose;
66 68
67 private: 69 private:
68 bool should_process_data_; 70 bool should_process_data_;
69 string data_; 71 std::string data_;
70 }; 72 };
71 73
72 class ReliableQuicStreamTest : public ::testing::TestWithParam<bool> { 74 class ReliableQuicStreamTest : public ::testing::TestWithParam<bool> {
73 public: 75 public:
74 ReliableQuicStreamTest() 76 ReliableQuicStreamTest()
75 : initial_flow_control_window_bytes_(kMaxPacketSize), 77 : initial_flow_control_window_bytes_(kMaxPacketSize),
76 zero_(QuicTime::Delta::Zero()), 78 zero_(QuicTime::Delta::Zero()),
77 supported_versions_(QuicSupportedVersions()) { 79 supported_versions_(QuicSupportedVersions()) {
78 headers_[":host"] = "www.google.com"; 80 headers_[":host"] = "www.google.com";
79 headers_[":path"] = "/index.hml"; 81 headers_[":path"] = "/index.hml";
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 *delegate_out = delegate; 434 *delegate_out = delegate;
433 } 435 }
434 436
435 TEST_F(ReliableQuicStreamTest, WriteOrBufferDataWithQuicAckNotifier) { 437 TEST_F(ReliableQuicStreamTest, WriteOrBufferDataWithQuicAckNotifier) {
436 Initialize(kShouldProcessData); 438 Initialize(kShouldProcessData);
437 439
438 scoped_refptr<MockAckNotifierDelegate> delegate( 440 scoped_refptr<MockAckNotifierDelegate> delegate(
439 new StrictMock<MockAckNotifierDelegate>); 441 new StrictMock<MockAckNotifierDelegate>);
440 442
441 const int kDataSize = 16 * 1024; 443 const int kDataSize = 16 * 1024;
442 const string kData(kDataSize, 'a'); 444 const std::string kData(kDataSize, 'a');
443 445
444 const int kFirstWriteSize = 100; 446 const int kFirstWriteSize = 100;
445 const int kSecondWriteSize = 50; 447 const int kSecondWriteSize = 50;
446 const int kLastWriteSize = kDataSize - kFirstWriteSize - kSecondWriteSize; 448 const int kLastWriteSize = kDataSize - kFirstWriteSize - kSecondWriteSize;
447 449
448 // Set a large flow control send window so this doesn't interfere with test. 450 // Set a large flow control send window so this doesn't interfere with test.
449 stream_->flow_controller()->UpdateSendWindowOffset(kDataSize + 1); 451 stream_->flow_controller()->UpdateSendWindowOffset(kDataSize + 1);
450 session_->flow_controller()->UpdateSendWindowOffset(kDataSize + 1); 452 session_->flow_controller()->UpdateSendWindowOffset(kDataSize + 1);
451 453
452 scoped_refptr<QuicAckNotifier::DelegateInterface> proxy_delegate; 454 scoped_refptr<QuicAckNotifier::DelegateInterface> proxy_delegate;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 489
488 // Verify delegate behavior when packets are acked before the 490 // Verify delegate behavior when packets are acked before the
489 // WritevData call that sends out the last byte. 491 // WritevData call that sends out the last byte.
490 TEST_F(ReliableQuicStreamTest, WriteOrBufferDataAckNotificationBeforeFlush) { 492 TEST_F(ReliableQuicStreamTest, WriteOrBufferDataAckNotificationBeforeFlush) {
491 Initialize(kShouldProcessData); 493 Initialize(kShouldProcessData);
492 494
493 scoped_refptr<MockAckNotifierDelegate> delegate( 495 scoped_refptr<MockAckNotifierDelegate> delegate(
494 new StrictMock<MockAckNotifierDelegate>); 496 new StrictMock<MockAckNotifierDelegate>);
495 497
496 const int kDataSize = 16 * 1024; 498 const int kDataSize = 16 * 1024;
497 const string kData(kDataSize, 'a'); 499 const std::string kData(kDataSize, 'a');
498 500
499 const int kInitialWriteSize = 100; 501 const int kInitialWriteSize = 100;
500 502
501 // Set a large flow control send window so this doesn't interfere with test. 503 // Set a large flow control send window so this doesn't interfere with test.
502 stream_->flow_controller()->UpdateSendWindowOffset(kDataSize + 1); 504 stream_->flow_controller()->UpdateSendWindowOffset(kDataSize + 1);
503 session_->flow_controller()->UpdateSendWindowOffset(kDataSize + 1); 505 session_->flow_controller()->UpdateSendWindowOffset(kDataSize + 1);
504 506
505 scoped_refptr<QuicAckNotifier::DelegateInterface> proxy_delegate; 507 scoped_refptr<QuicAckNotifier::DelegateInterface> proxy_delegate;
506 508
507 EXPECT_CALL(*session_, WritevData(kHeadersStreamId, _, _, _, _, _)) 509 EXPECT_CALL(*session_, WritevData(kHeadersStreamId, _, _, _, _, _))
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 645
644 EXPECT_FALSE(stream_->HasFinalReceivedByteOffset()); 646 EXPECT_FALSE(stream_->HasFinalReceivedByteOffset());
645 QuicRstStreamFrame rst_frame(stream_->id(), QUIC_STREAM_CANCELLED, 1234); 647 QuicRstStreamFrame rst_frame(stream_->id(), QUIC_STREAM_CANCELLED, 1234);
646 stream_->OnStreamReset(rst_frame); 648 stream_->OnStreamReset(rst_frame);
647 EXPECT_TRUE(stream_->HasFinalReceivedByteOffset()); 649 EXPECT_TRUE(stream_->HasFinalReceivedByteOffset());
648 } 650 }
649 651
650 } // namespace 652 } // namespace
651 } // namespace test 653 } // namespace test
652 } // namespace net 654 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698