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

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

Issue 14816006: Land Recent QUIC changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added missing NET_PRIVATE_EXPORT to QuicWallTime Created 7 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_crypto_stream.cc ('k') | net/quic/quic_framer.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_crypto_stream.h" 5 #include "net/quic/quic_crypto_stream.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 ASSERT_EQ(1u, stream_.messages()->size()); 91 ASSERT_EQ(1u, stream_.messages()->size());
92 const CryptoHandshakeMessage& message = (*stream_.messages())[0]; 92 const CryptoHandshakeMessage& message = (*stream_.messages())[0];
93 EXPECT_EQ(kSHLO, message.tag()); 93 EXPECT_EQ(kSHLO, message.tag());
94 EXPECT_EQ(2u, message.tag_value_map().size()); 94 EXPECT_EQ(2u, message.tag_value_map().size());
95 EXPECT_EQ("abc", CryptoTestUtils::GetValueForTag(message, 1)); 95 EXPECT_EQ("abc", CryptoTestUtils::GetValueForTag(message, 1));
96 EXPECT_EQ("def", CryptoTestUtils::GetValueForTag(message, 2)); 96 EXPECT_EQ("def", CryptoTestUtils::GetValueForTag(message, 2));
97 } 97 }
98 98
99 TEST_F(QuicCryptoStreamTest, ProcessBadData) { 99 TEST_F(QuicCryptoStreamTest, ProcessBadData) {
100 string bad(message_data_->data(), message_data_->length()); 100 string bad(message_data_->data(), message_data_->length());
101 bad[8] = 0x7F; // out of order tag 101 const int kFirstTagIndex = sizeof(uint32) + // message tag
102 sizeof(uint16) + // number of tag-value pairs
103 sizeof(uint16); // padding
104 EXPECT_EQ(1, bad[kFirstTagIndex]);
105 bad[kFirstTagIndex] = 0x7F; // out of order tag
102 106
103 EXPECT_CALL(*connection_, 107 EXPECT_CALL(*connection_,
104 SendConnectionClose(QUIC_CRYPTO_TAGS_OUT_OF_ORDER)); 108 SendConnectionClose(QUIC_CRYPTO_TAGS_OUT_OF_ORDER));
105 EXPECT_EQ(0u, stream_.ProcessData(bad.data(), bad.length())); 109 EXPECT_EQ(0u, stream_.ProcessData(bad.data(), bad.length()));
106 } 110 }
107 111
108 } // namespace 112 } // namespace
109 } // namespace test 113 } // namespace test
110 } // namespace net 114 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_crypto_stream.cc ('k') | net/quic/quic_framer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698