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

Side by Side Diff: net/quic/core/quic_stream_sequencer_test.cc

Issue 2611613003: Add quic_logging (Closed)
Patch Set: fix failed test? Created 3 years, 11 months 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
« no previous file with comments | « net/quic/core/quic_stream_sequencer_buffer_test.cc ('k') | net/quic/core/quic_stream_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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"
14 #include "net/base/ip_endpoint.h" 13 #include "net/base/ip_endpoint.h"
15 #include "net/quic/core/quic_flags.h" 14 #include "net/quic/core/quic_flags.h"
16 #include "net/quic/core/quic_stream.h" 15 #include "net/quic/core/quic_stream.h"
17 #include "net/quic/core/quic_utils.h" 16 #include "net/quic/core/quic_utils.h"
17 #include "net/quic/platform/api/quic_logging.h"
18 #include "net/quic/test_tools/mock_clock.h" 18 #include "net/quic/test_tools/mock_clock.h"
19 #include "net/quic/test_tools/quic_stream_sequencer_peer.h" 19 #include "net/quic/test_tools/quic_stream_sequencer_peer.h"
20 #include "net/quic/test_tools/quic_test_utils.h" 20 #include "net/quic/test_tools/quic_test_utils.h"
21 #include "net/test/gtest_util.h" 21 #include "net/test/gtest_util.h"
22 #include "testing/gmock/include/gmock/gmock.h" 22 #include "testing/gmock/include/gmock/gmock.h"
23 #include "testing/gmock_mutant.h" 23 #include "testing/gmock_mutant.h"
24 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
25 25
26 using base::StringPiece; 26 using base::StringPiece;
27 using std::string; 27 using std::string;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 expected[0].substr(start_position, iovecs[i].iov_len))) { 109 expected[0].substr(start_position, iovecs[i].iov_len))) {
110 return false; 110 return false;
111 } 111 }
112 start_position += iovecs[i].iov_len; 112 start_position += iovecs[i].iov_len;
113 } 113 }
114 return true; 114 return true;
115 } 115 }
116 116
117 bool VerifyIovec(const iovec& iovec, StringPiece expected) { 117 bool VerifyIovec(const iovec& iovec, StringPiece expected) {
118 if (iovec.iov_len != expected.length()) { 118 if (iovec.iov_len != expected.length()) {
119 LOG(ERROR) << "Invalid length: " << iovec.iov_len << " vs " 119 QUIC_LOG(ERROR) << "Invalid length: " << iovec.iov_len << " vs "
120 << expected.length(); 120 << expected.length();
121 return false; 121 return false;
122 } 122 }
123 if (memcmp(iovec.iov_base, expected.data(), expected.length()) != 0) { 123 if (memcmp(iovec.iov_base, expected.data(), expected.length()) != 0) {
124 LOG(ERROR) << "Invalid data: " << static_cast<char*>(iovec.iov_base) 124 QUIC_LOG(ERROR) << "Invalid data: " << static_cast<char*>(iovec.iov_base)
125 << " vs " << expected; 125 << " vs " << expected;
126 return false; 126 return false;
127 } 127 }
128 return true; 128 return true;
129 } 129 }
130 130
131 void OnFinFrame(QuicStreamOffset byte_offset, const char* data) { 131 void OnFinFrame(QuicStreamOffset byte_offset, const char* data) {
132 QuicStreamFrame frame; 132 QuicStreamFrame frame;
133 frame.stream_id = 1; 133 frame.stream_id = 1;
134 frame.offset = byte_offset; 134 frame.offset = byte_offset;
135 frame.data_buffer = data; 135 frame.data_buffer = data;
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 // Infinite buffering, so all frames are acked right away. 431 // Infinite buffering, so all frames are acked right away.
432 TEST_F(QuicSequencerRandomTest, RandomFramesNoDroppingNoBackup) { 432 TEST_F(QuicSequencerRandomTest, RandomFramesNoDroppingNoBackup) {
433 InSequence s; 433 InSequence s;
434 EXPECT_CALL(stream_, OnDataAvailable()) 434 EXPECT_CALL(stream_, OnDataAvailable())
435 .Times(AnyNumber()) 435 .Times(AnyNumber())
436 .WillRepeatedly( 436 .WillRepeatedly(
437 Invoke(this, &QuicSequencerRandomTest::ReadAvailableData)); 437 Invoke(this, &QuicSequencerRandomTest::ReadAvailableData));
438 438
439 while (!list_.empty()) { 439 while (!list_.empty()) {
440 int index = OneToN(list_.size()) - 1; 440 int index = OneToN(list_.size()) - 1;
441 LOG(ERROR) << "Sending index " << index << " " << list_[index].second; 441 QUIC_LOG(ERROR) << "Sending index " << index << " " << list_[index].second;
442 OnFrame(list_[index].first, list_[index].second.data()); 442 OnFrame(list_[index].first, list_[index].second.data());
443 443
444 list_.erase(list_.begin() + index); 444 list_.erase(list_.begin() + index);
445 } 445 }
446 446
447 ASSERT_EQ(arraysize(kPayload) - 1, output_.size()); 447 ASSERT_EQ(arraysize(kPayload) - 1, output_.size());
448 EXPECT_EQ(kPayload, output_); 448 EXPECT_EQ(kPayload, output_);
449 } 449 }
450 450
451 TEST_F(QuicSequencerRandomTest, RandomFramesNoDroppingBackup) { 451 TEST_F(QuicSequencerRandomTest, RandomFramesNoDroppingBackup) {
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 source.set(nullptr, 5u); 672 source.set(nullptr, 5u);
673 QuicStreamFrame frame(kClientDataStreamId1, false, 1, source); 673 QuicStreamFrame frame(kClientDataStreamId1, false, 1, source);
674 EXPECT_CALL(stream_, CloseConnectionWithDetails( 674 EXPECT_CALL(stream_, CloseConnectionWithDetails(
675 QUIC_STREAM_SEQUENCER_INVALID_STATE, _)); 675 QUIC_STREAM_SEQUENCER_INVALID_STATE, _));
676 sequencer_->OnStreamFrame(frame); 676 sequencer_->OnStreamFrame(frame);
677 } 677 }
678 678
679 } // namespace 679 } // namespace
680 } // namespace test 680 } // namespace test
681 } // namespace net 681 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_stream_sequencer_buffer_test.cc ('k') | net/quic/core/quic_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698