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

Side by Side Diff: net/tools/quic/chlo_extractor_test.cc

Issue 2681793002: Landing Recent QUIC changes until 5:30 PM, Feb 3, 2017 UTC-5 (Closed)
Patch Set: sync and rebase Created 3 years, 10 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/test_tools/quic_test_utils.cc ('k') | net/tools/quic/end_to_end_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) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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/tools/quic/chlo_extractor.h" 5 #include "net/tools/quic/chlo_extractor.h"
6 6
7 #include "net/quic/core/quic_framer.h" 7 #include "net/quic/core/quic_framer.h"
8 #include "net/quic/test_tools/crypto_test_utils.h" 8 #include "net/quic/test_tools/crypto_test_utils.h"
9 #include "net/quic/test_tools/quic_test_utils.h" 9 #include "net/quic/test_tools/quic_test_utils.h"
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 void MakePacket(QuicStreamFrame* stream_frame) { 57 void MakePacket(QuicStreamFrame* stream_frame) {
58 QuicFrame frame(stream_frame); 58 QuicFrame frame(stream_frame);
59 QuicFrames frames; 59 QuicFrames frames;
60 frames.push_back(frame); 60 frames.push_back(frame);
61 QuicFramer framer(SupportedVersions(header_.public_header.versions.front()), 61 QuicFramer framer(SupportedVersions(header_.public_header.versions.front()),
62 QuicTime::Zero(), Perspective::IS_CLIENT); 62 QuicTime::Zero(), Perspective::IS_CLIENT);
63 std::unique_ptr<QuicPacket> packet( 63 std::unique_ptr<QuicPacket> packet(
64 BuildUnsizedDataPacket(&framer, header_, frames)); 64 BuildUnsizedDataPacket(&framer, header_, frames));
65 EXPECT_TRUE(packet != nullptr); 65 EXPECT_TRUE(packet != nullptr);
66 size_t encrypted_length = framer.EncryptPayload( 66 size_t encrypted_length =
67 ENCRYPTION_NONE, header_.path_id, header_.packet_number, *packet, 67 framer.EncryptPayload(ENCRYPTION_NONE, header_.packet_number, *packet,
68 buffer_, arraysize(buffer_)); 68 buffer_, arraysize(buffer_));
69 ASSERT_NE(0u, encrypted_length); 69 ASSERT_NE(0u, encrypted_length);
70 packet_.reset(new QuicEncryptedPacket(buffer_, encrypted_length)); 70 packet_.reset(new QuicEncryptedPacket(buffer_, encrypted_length));
71 EXPECT_TRUE(packet_ != nullptr); 71 EXPECT_TRUE(packet_ != nullptr);
72 delete stream_frame; 72 delete stream_frame;
73 } 73 }
74 74
75 protected: 75 protected:
76 TestDelegate delegate_; 76 TestDelegate delegate_;
77 QuicPacketHeader header_; 77 QuicPacketHeader header_;
78 std::unique_ptr<QuicEncryptedPacket> packet_; 78 std::unique_ptr<QuicEncryptedPacket> packet_;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 TEST_F(ChloExtractorTest, DoesNotFindInvalidChlo) { 126 TEST_F(ChloExtractorTest, DoesNotFindInvalidChlo) {
127 MakePacket(new QuicStreamFrame(kCryptoStreamId, false, 0, "foo")); 127 MakePacket(new QuicStreamFrame(kCryptoStreamId, false, 0, "foo"));
128 EXPECT_FALSE( 128 EXPECT_FALSE(
129 ChloExtractor::Extract(*packet_, AllSupportedVersions(), &delegate_)); 129 ChloExtractor::Extract(*packet_, AllSupportedVersions(), &delegate_));
130 } 130 }
131 131
132 } // namespace 132 } // namespace
133 } // namespace test 133 } // namespace test
134 } // namespace net 134 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_utils.cc ('k') | net/tools/quic/end_to_end_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698