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

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

Issue 2671333004: Convert class-full-of-statics CryptoTestUtils into a namespace (Closed)
Patch Set: 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
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>
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 81
82 TEST_F(QuicCryptoStreamTest, ProcessRawData) { 82 TEST_F(QuicCryptoStreamTest, ProcessRawData) {
83 stream_.OnStreamFrame(QuicStreamFrame(kCryptoStreamId, /*fin=*/false, 83 stream_.OnStreamFrame(QuicStreamFrame(kCryptoStreamId, /*fin=*/false,
84 /*offset=*/0, 84 /*offset=*/0,
85 message_data_->AsStringPiece())); 85 message_data_->AsStringPiece()));
86 ASSERT_EQ(1u, stream_.messages()->size()); 86 ASSERT_EQ(1u, stream_.messages()->size());
87 const CryptoHandshakeMessage& message = (*stream_.messages())[0]; 87 const CryptoHandshakeMessage& message = (*stream_.messages())[0];
88 EXPECT_EQ(kSHLO, message.tag()); 88 EXPECT_EQ(kSHLO, message.tag());
89 EXPECT_EQ(2u, message.tag_value_map().size()); 89 EXPECT_EQ(2u, message.tag_value_map().size());
90 EXPECT_EQ("abc", CryptoTestUtils::GetValueForTag(message, 1)); 90 EXPECT_EQ("abc", crypto_test_utils::GetValueForTag(message, 1));
91 EXPECT_EQ("def", CryptoTestUtils::GetValueForTag(message, 2)); 91 EXPECT_EQ("def", crypto_test_utils::GetValueForTag(message, 2));
92 } 92 }
93 93
94 TEST_F(QuicCryptoStreamTest, ProcessBadData) { 94 TEST_F(QuicCryptoStreamTest, ProcessBadData) {
95 string bad(message_data_->data(), message_data_->length()); 95 string bad(message_data_->data(), message_data_->length());
96 const int kFirstTagIndex = sizeof(uint32_t) + // message tag 96 const int kFirstTagIndex = sizeof(uint32_t) + // message tag
97 sizeof(uint16_t) + // number of tag-value pairs 97 sizeof(uint16_t) + // number of tag-value pairs
98 sizeof(uint16_t); // padding 98 sizeof(uint16_t); // padding
99 EXPECT_EQ(1, bad[kFirstTagIndex]); 99 EXPECT_EQ(1, bad[kFirstTagIndex]);
100 bad[kFirstTagIndex] = 0x7F; // out of order tag 100 bad[kFirstTagIndex] = 0x7F; // out of order tag
101 101
102 EXPECT_CALL(*connection_, CloseConnection(QUIC_CRYPTO_TAGS_OUT_OF_ORDER, 102 EXPECT_CALL(*connection_, CloseConnection(QUIC_CRYPTO_TAGS_OUT_OF_ORDER,
103 testing::_, testing::_)); 103 testing::_, testing::_));
104 stream_.OnStreamFrame( 104 stream_.OnStreamFrame(
105 QuicStreamFrame(kCryptoStreamId, /*fin=*/false, /*offset=*/0, bad)); 105 QuicStreamFrame(kCryptoStreamId, /*fin=*/false, /*offset=*/0, bad));
106 } 106 }
107 107
108 TEST_F(QuicCryptoStreamTest, NoConnectionLevelFlowControl) { 108 TEST_F(QuicCryptoStreamTest, NoConnectionLevelFlowControl) {
109 EXPECT_FALSE( 109 EXPECT_FALSE(
110 QuicStreamPeer::StreamContributesToConnectionFlowControl(&stream_)); 110 QuicStreamPeer::StreamContributesToConnectionFlowControl(&stream_));
111 } 111 }
112 112
113 } // namespace 113 } // namespace
114 } // namespace test 114 } // namespace test
115 } // 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_server_session_base_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698