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

Side by Side Diff: net/quic/core/quic_crypto_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_crypto_server_stream_test.cc ('k') | net/quic/core/quic_data_writer_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_crypto_stream.h" 5 #include "net/quic/core/quic_crypto_stream.h"
6 6
7 #include <cstdint> 7 #include <cstdint>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "net/quic/core/crypto/crypto_handshake.h" 13 #include "net/quic/core/crypto/crypto_handshake.h"
14 #include "net/quic/core/crypto/crypto_protocol.h" 14 #include "net/quic/core/crypto/crypto_protocol.h"
15 #include "net/quic/platform/api/quic_socket_address.h" 15 #include "net/quic/platform/api/quic_socket_address.h"
16 #include "net/quic/platform/api/quic_test.h"
16 #include "net/quic/test_tools/crypto_test_utils.h" 17 #include "net/quic/test_tools/crypto_test_utils.h"
17 #include "net/quic/test_tools/quic_stream_peer.h" 18 #include "net/quic/test_tools/quic_stream_peer.h"
18 #include "net/quic/test_tools/quic_test_utils.h" 19 #include "net/quic/test_tools/quic_test_utils.h"
19 #include "testing/gmock/include/gmock/gmock.h"
20 #include "testing/gtest/include/gtest/gtest.h"
21 20
22 using std::string; 21 using std::string;
23 22
24 namespace net { 23 namespace net {
25 namespace test { 24 namespace test {
26 namespace { 25 namespace {
27 26
28 class MockQuicCryptoStream : public QuicCryptoStream { 27 class MockQuicCryptoStream : public QuicCryptoStream {
29 public: 28 public:
30 explicit MockQuicCryptoStream(QuicSession* session) 29 explicit MockQuicCryptoStream(QuicSession* session)
31 : QuicCryptoStream(session) {} 30 : QuicCryptoStream(session) {}
32 31
33 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override { 32 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override {
34 messages_.push_back(message); 33 messages_.push_back(message);
35 } 34 }
36 35
37 std::vector<CryptoHandshakeMessage>* messages() { return &messages_; } 36 std::vector<CryptoHandshakeMessage>* messages() { return &messages_; }
38 37
39 private: 38 private:
40 std::vector<CryptoHandshakeMessage> messages_; 39 std::vector<CryptoHandshakeMessage> messages_;
41 40
42 DISALLOW_COPY_AND_ASSIGN(MockQuicCryptoStream); 41 DISALLOW_COPY_AND_ASSIGN(MockQuicCryptoStream);
43 }; 42 };
44 43
45 class QuicCryptoStreamTest : public ::testing::Test { 44 class QuicCryptoStreamTest : public QuicTest {
46 public: 45 public:
47 QuicCryptoStreamTest() 46 QuicCryptoStreamTest()
48 : connection_(new MockQuicConnection(&helper_, 47 : connection_(new MockQuicConnection(&helper_,
49 &alarm_factory_, 48 &alarm_factory_,
50 Perspective::IS_CLIENT)), 49 Perspective::IS_CLIENT)),
51 session_(connection_), 50 session_(connection_),
52 stream_(&session_) { 51 stream_(&session_) {
53 message_.set_tag(kSHLO); 52 message_.set_tag(kSHLO);
54 message_.SetStringPiece(1, "abc"); 53 message_.SetStringPiece(1, "abc");
55 message_.SetStringPiece(2, "def"); 54 message_.SetStringPiece(2, "def");
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 106 }
108 107
109 TEST_F(QuicCryptoStreamTest, NoConnectionLevelFlowControl) { 108 TEST_F(QuicCryptoStreamTest, NoConnectionLevelFlowControl) {
110 EXPECT_FALSE( 109 EXPECT_FALSE(
111 QuicStreamPeer::StreamContributesToConnectionFlowControl(&stream_)); 110 QuicStreamPeer::StreamContributesToConnectionFlowControl(&stream_));
112 } 111 }
113 112
114 } // namespace 113 } // namespace
115 } // namespace test 114 } // namespace test
116 } // namespace net 115 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_crypto_server_stream_test.cc ('k') | net/quic/core/quic_data_writer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698