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

Side by Side Diff: net/quic/crypto/crypto_server_test.cc

Issue 22647002: Add support to QUIC for QUIC_VERSION_8: for RSA-PSS signatures, set (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 4 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "base/strings/string_number_conversions.h" 5 #include "base/strings/string_number_conversions.h"
6 #include "net/quic/crypto/crypto_server_config.h" 6 #include "net/quic/crypto/crypto_server_config.h"
7 #include "net/quic/crypto/crypto_utils.h" 7 #include "net/quic/crypto/crypto_utils.h"
8 #include "net/quic/crypto/quic_random.h" 8 #include "net/quic/crypto/quic_random.h"
9 #include "net/quic/test_tools/crypto_test_utils.h" 9 #include "net/quic/test_tools/crypto_test_utils.h"
10 #include "net/quic/test_tools/mock_clock.h" 10 #include "net/quic/test_tools/mock_clock.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 server_config_.reset(CryptoFramer::ParseMessage(scfg)); 65 server_config_.reset(CryptoFramer::ParseMessage(scfg));
66 66
67 StringPiece scid; 67 StringPiece scid;
68 ASSERT_TRUE(server_config_->GetStringPiece(kSCID, &scid)); 68 ASSERT_TRUE(server_config_->GetStringPiece(kSCID, &scid));
69 scid_hex_ = "#" + base::HexEncode(scid.data(), scid.size()); 69 scid_hex_ = "#" + base::HexEncode(scid.data(), scid.size());
70 } 70 }
71 71
72 void ShouldSucceed(const CryptoHandshakeMessage& message) { 72 void ShouldSucceed(const CryptoHandshakeMessage& message) {
73 string error_details; 73 string error_details;
74 QuicErrorCode error = config_.ProcessClientHello( 74 QuicErrorCode error = config_.ProcessClientHello(
75 message, 1 /* GUID */, addr_, &clock_, 75 message, QuicVersionMax(), 1 /* GUID */, addr_,
76 rand_, &params_, &out_, &error_details); 76 &clock_, rand_, &params_, &out_, &error_details);
77 77
78 ASSERT_EQ(error, QUIC_NO_ERROR) 78 ASSERT_EQ(error, QUIC_NO_ERROR)
79 << "Message failed with error " << error_details << ": " 79 << "Message failed with error " << error_details << ": "
80 << message.DebugString(); 80 << message.DebugString();
81 } 81 }
82 82
83 void ShouldFailMentioning(const char* error_substr, 83 void ShouldFailMentioning(const char* error_substr,
84 const CryptoHandshakeMessage& message) { 84 const CryptoHandshakeMessage& message) {
85 string error_details; 85 string error_details;
86 QuicErrorCode error = config_.ProcessClientHello( 86 QuicErrorCode error = config_.ProcessClientHello(
87 message, 1 /* GUID */, addr_, &clock_, 87 message, QuicVersionMax(), 1 /* GUID */, addr_,
88 rand_, &params_, &out_, &error_details); 88 &clock_, rand_, &params_, &out_, &error_details);
89 89
90 ASSERT_NE(error, QUIC_NO_ERROR) 90 ASSERT_NE(error, QUIC_NO_ERROR)
91 << "Message didn't fail: " << message.DebugString(); 91 << "Message didn't fail: " << message.DebugString();
92 92
93 EXPECT_TRUE(error_details.find(error_substr) != string::npos) 93 EXPECT_TRUE(error_details.find(error_substr) != string::npos)
94 << error_substr << " not in " << error_details; 94 << error_substr << " not in " << error_details;
95 } 95 }
96 96
97 CryptoHandshakeMessage InchoateClientHello(const char* message_tag, ...) { 97 CryptoHandshakeMessage InchoateClientHello(const char* message_tag, ...) {
98 va_list ap; 98 va_list ap;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 }; 247 };
248 248
249 TEST_F(CryptoServerTestNoConfig, DontCrash) { 249 TEST_F(CryptoServerTestNoConfig, DontCrash) {
250 ShouldFailMentioning("No config", InchoateClientHello( 250 ShouldFailMentioning("No config", InchoateClientHello(
251 "CHLO", 251 "CHLO",
252 NULL)); 252 NULL));
253 } 253 }
254 254
255 } // namespace test 255 } // namespace test
256 } // namespace net 256 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698