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

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

Issue 1411063004: Remove insecure QUIC support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enough! Created 5 years, 1 month 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/quic_protocol.h ('k') | net/quic/quic_sent_packet_manager.h » ('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/quic_reliable_client_stream.h" 5 #include "net/quic/quic_reliable_client_stream.h"
6 6
7 #include "net/base/net_errors.h" 7 #include "net/base/net_errors.h"
8 #include "net/base/test_completion_callback.h" 8 #include "net/base/test_completion_callback.h"
9 #include "net/quic/quic_chromium_client_session.h" 9 #include "net/quic/quic_chromium_client_session.h"
10 #include "net/quic/quic_utils.h" 10 #include "net/quic/quic_utils.h"
11 #include "net/quic/spdy_utils.h" 11 #include "net/quic/spdy_utils.h"
12 #include "net/quic/test_tools/crypto_test_utils.h"
12 #include "net/quic/test_tools/quic_test_utils.h" 13 #include "net/quic/test_tools/quic_test_utils.h"
13 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gmock_mutant.h" 15 #include "testing/gmock_mutant.h"
15 16
16 using testing::AnyNumber; 17 using testing::AnyNumber;
17 using testing::CreateFunctor; 18 using testing::CreateFunctor;
18 using testing::Invoke; 19 using testing::Invoke;
19 using testing::Return; 20 using testing::Return;
20 using testing::StrEq; 21 using testing::StrEq;
21 using testing::_; 22 using testing::_;
(...skipping 18 matching lines...) Expand all
40 MOCK_METHOD0(HasSendHeadersComplete, bool()); 41 MOCK_METHOD0(HasSendHeadersComplete, bool());
41 42
42 private: 43 private:
43 DISALLOW_COPY_AND_ASSIGN(MockDelegate); 44 DISALLOW_COPY_AND_ASSIGN(MockDelegate);
44 }; 45 };
45 46
46 class QuicReliableClientStreamTest 47 class QuicReliableClientStreamTest
47 : public ::testing::TestWithParam<QuicVersion> { 48 : public ::testing::TestWithParam<QuicVersion> {
48 public: 49 public:
49 QuicReliableClientStreamTest() 50 QuicReliableClientStreamTest()
50 : session_(new MockConnection(&helper_, 51 : crypto_config_(CryptoTestUtils::ProofVerifierForTesting()),
52 session_(new MockConnection(&helper_,
51 Perspective::IS_CLIENT, 53 Perspective::IS_CLIENT,
52 SupportedVersions(GetParam()))) { 54 SupportedVersions(GetParam()))) {
53 stream_ = 55 stream_ =
54 new QuicReliableClientStream(kTestStreamId, &session_, BoundNetLog()); 56 new QuicReliableClientStream(kTestStreamId, &session_, BoundNetLog());
55 session_.ActivateStream(stream_); 57 session_.ActivateStream(stream_);
56 stream_->SetDelegate(&delegate_); 58 stream_->SetDelegate(&delegate_);
57 } 59 }
58 60
59 void InitializeHeaders() { 61 void InitializeHeaders() {
60 headers_[":host"] = "www.google.com"; 62 headers_[":host"] = "www.google.com";
(...skipping 26 matching lines...) Expand all
87 } 89 }
88 90
89 void ReadData(StringPiece expected_data) { 91 void ReadData(StringPiece expected_data) {
90 scoped_refptr<IOBuffer> buffer(new IOBuffer(expected_data.length() + 1)); 92 scoped_refptr<IOBuffer> buffer(new IOBuffer(expected_data.length() + 1));
91 EXPECT_EQ(static_cast<int>(expected_data.length()), 93 EXPECT_EQ(static_cast<int>(expected_data.length()),
92 stream_->Read(buffer.get(), expected_data.length() + 1)); 94 stream_->Read(buffer.get(), expected_data.length() + 1));
93 EXPECT_EQ(expected_data, 95 EXPECT_EQ(expected_data,
94 StringPiece(buffer->data(), expected_data.length())); 96 StringPiece(buffer->data(), expected_data.length()));
95 } 97 }
96 98
99 QuicCryptoClientConfig crypto_config_;
97 testing::StrictMock<MockDelegate> delegate_; 100 testing::StrictMock<MockDelegate> delegate_;
98 MockHelper helper_; 101 MockHelper helper_;
99 MockQuicSpdySession session_; 102 MockQuicSpdySession session_;
100 QuicReliableClientStream* stream_; 103 QuicReliableClientStream* stream_;
101 QuicCryptoClientConfig crypto_config_;
102 SpdyHeaderBlock headers_; 104 SpdyHeaderBlock headers_;
103 }; 105 };
104 106
105 INSTANTIATE_TEST_CASE_P(Version, QuicReliableClientStreamTest, 107 INSTANTIATE_TEST_CASE_P(Version, QuicReliableClientStreamTest,
106 ::testing::ValuesIn(QuicSupportedVersions())); 108 ::testing::ValuesIn(QuicSupportedVersions()));
107 109
108 TEST_P(QuicReliableClientStreamTest, OnFinRead) { 110 TEST_P(QuicReliableClientStreamTest, OnFinRead) {
109 InitializeHeaders(); 111 InitializeHeaders();
110 std::string uncompressed_headers = 112 std::string uncompressed_headers =
111 SpdyUtils::SerializeUncompressedHeaders(headers_); 113 SpdyUtils::SerializeUncompressedHeaders(headers_);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _, _)).WillOnce( 233 EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _, _)).WillOnce(
232 Return(QuicConsumedData(kDataLen, true))); 234 Return(QuicConsumedData(kDataLen, true)));
233 stream_->OnCanWrite(); 235 stream_->OnCanWrite();
234 ASSERT_TRUE(callback.have_result()); 236 ASSERT_TRUE(callback.have_result());
235 EXPECT_EQ(OK, callback.WaitForResult()); 237 EXPECT_EQ(OK, callback.WaitForResult());
236 } 238 }
237 239
238 } // namespace 240 } // namespace
239 } // namespace test 241 } // namespace test
240 } // namespace net 242 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_protocol.h ('k') | net/quic/quic_sent_packet_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698