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

Side by Side Diff: net/quic/core/quic_headers_stream_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_header_list_test.cc ('k') | net/quic/core/quic_one_block_arena_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_headers_stream.h" 5 #include "net/quic/core/quic_headers_stream.h"
6 6
7 #include <cstdint> 7 #include <cstdint>
8 #include <ostream> 8 #include <ostream>
9 #include <string> 9 #include <string>
10 #include <tuple> 10 #include <tuple>
11 #include <utility> 11 #include <utility>
12 12
13 #include "net/quic/core/quic_utils.h" 13 #include "net/quic/core/quic_utils.h"
14 #include "net/quic/core/spdy_utils.h" 14 #include "net/quic/core/spdy_utils.h"
15 #include "net/quic/platform/api/quic_bug_tracker.h" 15 #include "net/quic/platform/api/quic_bug_tracker.h"
16 #include "net/quic/platform/api/quic_flags.h" 16 #include "net/quic/platform/api/quic_flags.h"
17 #include "net/quic/platform/api/quic_logging.h" 17 #include "net/quic/platform/api/quic_logging.h"
18 #include "net/quic/platform/api/quic_ptr_util.h" 18 #include "net/quic/platform/api/quic_ptr_util.h"
19 #include "net/quic/platform/api/quic_str_cat.h" 19 #include "net/quic/platform/api/quic_str_cat.h"
20 #include "net/quic/platform/api/quic_string_piece.h" 20 #include "net/quic/platform/api/quic_string_piece.h"
21 #include "net/quic/platform/api/quic_test.h"
21 #include "net/quic/test_tools/quic_connection_peer.h" 22 #include "net/quic/test_tools/quic_connection_peer.h"
22 #include "net/quic/test_tools/quic_spdy_session_peer.h" 23 #include "net/quic/test_tools/quic_spdy_session_peer.h"
23 #include "net/quic/test_tools/quic_stream_peer.h" 24 #include "net/quic/test_tools/quic_stream_peer.h"
24 #include "net/quic/test_tools/quic_test_utils.h" 25 #include "net/quic/test_tools/quic_test_utils.h"
25 #include "net/spdy/chromium/spdy_flags.h" 26 #include "net/spdy/chromium/spdy_flags.h"
26 #include "net/spdy/core/spdy_alt_svc_wire_format.h" 27 #include "net/spdy/core/spdy_alt_svc_wire_format.h"
27 #include "net/spdy/core/spdy_protocol.h" 28 #include "net/spdy/core/spdy_protocol.h"
28 #include "net/spdy/core/spdy_test_utils.h" 29 #include "net/spdy/core/spdy_test_utils.h"
29 #include "net/test/gtest_util.h" 30 #include "net/test/gtest_util.h"
30 #include "testing/gtest/include/gtest/gtest.h"
31 31
32 using std::string; 32 using std::string;
33 using testing::_; 33 using testing::_;
34 using testing::AtLeast; 34 using testing::AtLeast;
35 using testing::HasSubstr; 35 using testing::HasSubstr;
36 using testing::InSequence; 36 using testing::InSequence;
37 using testing::Invoke; 37 using testing::Invoke;
38 using testing::Return; 38 using testing::Return;
39 using testing::StrictMock; 39 using testing::StrictMock;
40 using testing::WithArgs; 40 using testing::WithArgs;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 << ", http2_decoder: " << http2_decoder 200 << ", http2_decoder: " << http2_decoder
201 << ", hpack_decoder: " << hpack_decoder; 201 << ", hpack_decoder: " << hpack_decoder;
202 } 202 }
203 203
204 QuicVersion version; 204 QuicVersion version;
205 Perspective perspective; 205 Perspective perspective;
206 Http2DecoderChoice http2_decoder; 206 Http2DecoderChoice http2_decoder;
207 HpackDecoderChoice hpack_decoder; 207 HpackDecoderChoice hpack_decoder;
208 }; 208 };
209 209
210 class QuicHeadersStreamTest : public ::testing::TestWithParam<TestParamsTuple> { 210 class QuicHeadersStreamTest : public QuicTestWithParam<TestParamsTuple> {
211 public: 211 public:
212 // Constructing the test_params_ object will set the necessary flags before 212 // Constructing the test_params_ object will set the necessary flags before
213 // the MockQuicConnection is constructed, which we need because the latter 213 // the MockQuicConnection is constructed, which we need because the latter
214 // will construct a SpdyFramer that will use those flags to decide whether 214 // will construct a SpdyFramer that will use those flags to decide whether
215 // to construct a decoder adapter. 215 // to construct a decoder adapter.
216 QuicHeadersStreamTest() 216 QuicHeadersStreamTest()
217 : test_params_(GetParam()), 217 : test_params_(GetParam()),
218 connection_(new StrictMock<MockQuicConnection>(&helper_, 218 connection_(new StrictMock<MockQuicConnection>(&helper_,
219 &alarm_factory_, 219 &alarm_factory_,
220 perspective(), 220 perspective(),
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 368
369 void TearDownLocalConnectionState() { 369 void TearDownLocalConnectionState() {
370 QuicConnectionPeer::TearDownLocalConnectionState(connection_); 370 QuicConnectionPeer::TearDownLocalConnectionState(connection_);
371 } 371 }
372 372
373 QuicStreamId NextPromisedStreamId() { return next_promised_stream_id_ += 2; } 373 QuicStreamId NextPromisedStreamId() { return next_promised_stream_id_ += 2; }
374 374
375 static const bool kFrameComplete = true; 375 static const bool kFrameComplete = true;
376 static const bool kHasPriority = true; 376 static const bool kHasPriority = true;
377 377
378 QuicFlagSaver flags_; // Save/restore all QUIC flag values.
379 const TestParams test_params_; 378 const TestParams test_params_;
380 MockQuicConnectionHelper helper_; 379 MockQuicConnectionHelper helper_;
381 MockAlarmFactory alarm_factory_; 380 MockAlarmFactory alarm_factory_;
382 StrictMock<MockQuicConnection>* connection_; 381 StrictMock<MockQuicConnection>* connection_;
383 StrictMock<MockQuicSpdySession> session_; 382 StrictMock<MockQuicSpdySession> session_;
384 QuicHeadersStream* headers_stream_; 383 QuicHeadersStream* headers_stream_;
385 SpdyHeaderBlock headers_; 384 SpdyHeaderBlock headers_;
386 std::unique_ptr<TestHeadersHandler> headers_handler_; 385 std::unique_ptr<TestHeadersHandler> headers_handler_;
387 string body_; 386 string body_;
388 string saved_data_; 387 string saved_data_;
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 consumed_data = session_.WritevStreamData(id, MakeIOVector(data, &iov), 1030 consumed_data = session_.WritevStreamData(id, MakeIOVector(data, &iov),
1032 offset, fin, nullptr); 1031 offset, fin, nullptr);
1033 1032
1034 EXPECT_EQ(consumed_data.bytes_consumed, 0u); 1033 EXPECT_EQ(consumed_data.bytes_consumed, 0u);
1035 EXPECT_EQ(consumed_data.fin_consumed, false); 1034 EXPECT_EQ(consumed_data.fin_consumed, false);
1036 } 1035 }
1037 1036
1038 } // namespace 1037 } // namespace
1039 } // namespace test 1038 } // namespace test
1040 } // namespace net 1039 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_header_list_test.cc ('k') | net/quic/core/quic_one_block_arena_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698