OLD | NEW |
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 "net/quic/crypto/crypto_handshake.h" | 5 #include "net/quic/crypto/crypto_handshake.h" |
6 | 6 |
7 #include <stdarg.h> | 7 #include <stdarg.h> |
8 | 8 |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" | 10 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 expected.push_back(make_pair(server_config_id, is_primary)); | 82 expected.push_back(make_pair(server_config_id, is_primary)); |
83 } | 83 } |
84 | 84 |
85 va_end(ap); | 85 va_end(ap); |
86 | 86 |
87 base::AutoLock locked(server_config_->configs_lock_); | 87 base::AutoLock locked(server_config_->configs_lock_); |
88 | 88 |
89 ASSERT_EQ(expected.size(), server_config_->configs_.size()) | 89 ASSERT_EQ(expected.size(), server_config_->configs_.size()) |
90 << ConfigsDebug(); | 90 << ConfigsDebug(); |
91 | 91 |
92 for (QuicCryptoServerConfig::ConfigMap::const_iterator i = | 92 for (QuicCryptoServerConfig::ConfigMap::const_iterator |
93 server_config_->configs_.begin(); | 93 i = server_config_->configs_.begin(); |
94 i != server_config_->configs_.end(); ++i) { | 94 i != server_config_->configs_.end(); ++i) { |
95 bool found = false; | 95 bool found = false; |
96 for (vector<pair<ServerConfigID, bool> >::iterator j = expected.begin(); | 96 for (vector<pair<ServerConfigID, bool> >::iterator j = expected.begin(); |
97 j != expected.end(); ++j) { | 97 j != expected.end(); ++j) { |
98 if (i->first == j->first && i->second->is_primary == j->second) { | 98 if (i->first == j->first && i->second->is_primary == j->second) { |
99 found = true; | 99 found = true; |
100 j->first.clear(); | 100 j->first.clear(); |
101 break; | 101 break; |
102 } | 102 } |
103 } | 103 } |
104 | 104 |
105 ASSERT_TRUE(found) << "Failed to find match for " << i->first | 105 ASSERT_TRUE(found) << "Failed to find match for " << i->first |
106 << " in configs:\n" << ConfigsDebug(); | 106 << " in configs:\n" << ConfigsDebug(); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 // ConfigsDebug returns a string that contains debugging information about | 110 // ConfigsDebug returns a string that contains debugging information about |
111 // the set of Configs loaded in |server_config_| and their status. | 111 // the set of Configs loaded in |server_config_| and their status. |
112 // ConfigsDebug() should be called after acquiring | 112 // ConfigsDebug() should be called after acquiring |
113 // server_config_->configs_lock_. | 113 // server_config_->configs_lock_. |
114 string ConfigsDebug() { | 114 string ConfigsDebug() { |
115 if (server_config_->configs_.empty()) { | 115 if (server_config_->configs_.empty()) { |
116 return "No Configs in QuicCryptoServerConfig"; | 116 return "No Configs in QuicCryptoServerConfig"; |
117 } | 117 } |
118 | 118 |
119 string s; | 119 string s; |
120 | 120 |
121 for (QuicCryptoServerConfig::ConfigMap::const_iterator i = | 121 for (QuicCryptoServerConfig::ConfigMap::const_iterator |
122 server_config_->configs_.begin(); | 122 i = server_config_->configs_.begin(); |
123 i != server_config_->configs_.end(); ++i) { | 123 i != server_config_->configs_.end(); ++i) { |
124 const scoped_refptr<QuicCryptoServerConfig::Config> config = i->second; | 124 const scoped_refptr<QuicCryptoServerConfig::Config> config = i->second; |
125 if (config->is_primary) { | 125 if (config->is_primary) { |
126 s += "(primary) "; | 126 s += "(primary) "; |
127 } else { | 127 } else { |
128 s += " "; | 128 s += " "; |
129 } | 129 } |
130 s += config->id; | 130 s += config->id; |
131 s += "\n"; | 131 s += "\n"; |
132 } | 132 } |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 NULL); | 351 NULL); |
352 test_peer_.CheckConfigs( | 352 test_peer_.CheckConfigs( |
353 "a", false, | 353 "a", false, |
354 "b", true, | 354 "b", true, |
355 "c", false, | 355 "c", false, |
356 NULL); | 356 NULL); |
357 } | 357 } |
358 | 358 |
359 } // namespace test | 359 } // namespace test |
360 } // namespace net | 360 } // namespace net |
OLD | NEW |