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

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

Issue 2848203002: Add a platform implementation of QuicTest and QuicTestWithParam (Closed)
Patch Set: net/quic/platform/impl/quic_test_impl.cc Created 3 years, 7 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_spdy_stream_test.cc ('k') | net/quic/core/quic_stream_sequencer_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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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_buffer.h" 5 #include "net/quic/core/quic_stream_sequencer_buffer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "net/quic/platform/api/quic_logging.h" 14 #include "net/quic/platform/api/quic_logging.h"
15 #include "net/quic/platform/api/quic_str_cat.h" 15 #include "net/quic/platform/api/quic_str_cat.h"
16 #include "net/quic/platform/api/quic_test.h"
16 #include "net/quic/test_tools/mock_clock.h" 17 #include "net/quic/test_tools/mock_clock.h"
17 #include "net/quic/test_tools/quic_stream_sequencer_buffer_peer.h" 18 #include "net/quic/test_tools/quic_stream_sequencer_buffer_peer.h"
18 #include "net/quic/test_tools/quic_test_utils.h" 19 #include "net/quic/test_tools/quic_test_utils.h"
19 #include "net/test/gtest_util.h" 20 #include "net/test/gtest_util.h"
20 #include "testing/gmock/include/gmock/gmock.h"
21 #include "testing/gmock_mutant.h" 21 #include "testing/gmock_mutant.h"
22 #include "testing/gtest/include/gtest/gtest.h"
23 22
24 using std::string; 23 using std::string;
25 24
26 namespace net { 25 namespace net {
27 26
28 namespace test { 27 namespace test {
29 28
30 char GetCharFromIOVecs(size_t offset, iovec iov[], size_t count) { 29 char GetCharFromIOVecs(size_t offset, iovec iov[], size_t count) {
31 size_t start_offset = 0; 30 size_t start_offset = 0;
32 for (size_t i = 0; i < count; i++) { 31 for (size_t i = 0; i < count; i++) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 73 }
75 74
76 // Use 2.5 here to make sure the buffer has more than one block and its end 75 // Use 2.5 here to make sure the buffer has more than one block and its end
77 // doesn't align with the end of a block in order to test all the offset 76 // doesn't align with the end of a block in order to test all the offset
78 // calculation. 77 // calculation.
79 size_t max_capacity_bytes_ = 2.5 * kBlockSizeBytes; 78 size_t max_capacity_bytes_ = 2.5 * kBlockSizeBytes;
80 79
81 MockClock clock_; 80 MockClock clock_;
82 std::unique_ptr<QuicStreamSequencerBuffer> buffer_; 81 std::unique_ptr<QuicStreamSequencerBuffer> buffer_;
83 std::unique_ptr<QuicStreamSequencerBufferPeer> helper_; 82 std::unique_ptr<QuicStreamSequencerBufferPeer> helper_;
84 QuicFlagSaver flag_saver_;
85 string error_details_; 83 string error_details_;
86 }; 84 };
87 85
88 TEST_F(QuicStreamSequencerBufferTest, InitializationWithDifferentSizes) { 86 TEST_F(QuicStreamSequencerBufferTest, InitializationWithDifferentSizes) {
89 const size_t kCapacity = 2 * QuicStreamSequencerBuffer::kBlockSizeBytes; 87 const size_t kCapacity = 2 * QuicStreamSequencerBuffer::kBlockSizeBytes;
90 ResetMaxCapacityBytes(kCapacity); 88 ResetMaxCapacityBytes(kCapacity);
91 EXPECT_EQ(max_capacity_bytes_, helper_->max_buffer_capacity()); 89 EXPECT_EQ(max_capacity_bytes_, helper_->max_buffer_capacity());
92 EXPECT_TRUE(helper_->CheckInitialState()); 90 EXPECT_TRUE(helper_->CheckInitialState());
93 91
94 const size_t kCapacity1 = 8 * QuicStreamSequencerBuffer::kBlockSizeBytes; 92 const size_t kCapacity1 = 8 * QuicStreamSequencerBuffer::kBlockSizeBytes;
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 EXPECT_LE(bytes_to_buffer_, total_bytes_read_) << "iterations: " 1027 EXPECT_LE(bytes_to_buffer_, total_bytes_read_) << "iterations: "
1030 << iterations; 1028 << iterations;
1031 EXPECT_LE(bytes_to_buffer_, total_bytes_written_); 1029 EXPECT_LE(bytes_to_buffer_, total_bytes_written_);
1032 } 1030 }
1033 1031
1034 } // anonymous namespace 1032 } // anonymous namespace
1035 1033
1036 } // namespace test 1034 } // namespace test
1037 1035
1038 } // namespace net 1036 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_spdy_stream_test.cc ('k') | net/quic/core/quic_stream_sequencer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698