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

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

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years 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_crypto_stream.h ('k') | net/quic/quic_data_reader.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/macros.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "net/quic/crypto/crypto_handshake.h" 12 #include "net/quic/crypto/crypto_handshake.h"
12 #include "net/quic/crypto/crypto_protocol.h" 13 #include "net/quic/crypto/crypto_protocol.h"
13 #include "net/quic/test_tools/crypto_test_utils.h" 14 #include "net/quic/test_tools/crypto_test_utils.h"
14 #include "net/quic/test_tools/quic_test_utils.h" 15 #include "net/quic/test_tools/quic_test_utils.h"
15 #include "net/quic/test_tools/reliable_quic_stream_peer.h" 16 #include "net/quic/test_tools/reliable_quic_stream_peer.h"
16 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 19
19 using std::string; 20 using std::string;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 ASSERT_EQ(1u, stream_.messages()->size()); 82 ASSERT_EQ(1u, stream_.messages()->size());
82 const CryptoHandshakeMessage& message = (*stream_.messages())[0]; 83 const CryptoHandshakeMessage& message = (*stream_.messages())[0];
83 EXPECT_EQ(kSHLO, message.tag()); 84 EXPECT_EQ(kSHLO, message.tag());
84 EXPECT_EQ(2u, message.tag_value_map().size()); 85 EXPECT_EQ(2u, message.tag_value_map().size());
85 EXPECT_EQ("abc", CryptoTestUtils::GetValueForTag(message, 1)); 86 EXPECT_EQ("abc", CryptoTestUtils::GetValueForTag(message, 1));
86 EXPECT_EQ("def", CryptoTestUtils::GetValueForTag(message, 2)); 87 EXPECT_EQ("def", CryptoTestUtils::GetValueForTag(message, 2));
87 } 88 }
88 89
89 TEST_F(QuicCryptoStreamTest, ProcessBadData) { 90 TEST_F(QuicCryptoStreamTest, ProcessBadData) {
90 string bad(message_data_->data(), message_data_->length()); 91 string bad(message_data_->data(), message_data_->length());
91 const int kFirstTagIndex = sizeof(uint32) + // message tag 92 const int kFirstTagIndex = sizeof(uint32_t) + // message tag
92 sizeof(uint16) + // number of tag-value pairs 93 sizeof(uint16_t) + // number of tag-value pairs
93 sizeof(uint16); // padding 94 sizeof(uint16_t); // padding
94 EXPECT_EQ(1, bad[kFirstTagIndex]); 95 EXPECT_EQ(1, bad[kFirstTagIndex]);
95 bad[kFirstTagIndex] = 0x7F; // out of order tag 96 bad[kFirstTagIndex] = 0x7F; // out of order tag
96 97
97 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_CRYPTO_TAGS_OUT_OF_ORDER)); 98 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_CRYPTO_TAGS_OUT_OF_ORDER));
98 stream_.OnStreamFrame( 99 stream_.OnStreamFrame(
99 QuicStreamFrame(kCryptoStreamId, /*fin=*/false, /*offset=*/0, bad)); 100 QuicStreamFrame(kCryptoStreamId, /*fin=*/false, /*offset=*/0, bad));
100 } 101 }
101 102
102 TEST_F(QuicCryptoStreamTest, NoConnectionLevelFlowControl) { 103 TEST_F(QuicCryptoStreamTest, NoConnectionLevelFlowControl) {
103 EXPECT_FALSE(ReliableQuicStreamPeer::StreamContributesToConnectionFlowControl( 104 EXPECT_FALSE(ReliableQuicStreamPeer::StreamContributesToConnectionFlowControl(
104 &stream_)); 105 &stream_));
105 } 106 }
106 107
107 } // namespace 108 } // namespace
108 } // namespace test 109 } // namespace test
109 } // namespace net 110 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_crypto_stream.h ('k') | net/quic/quic_data_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698