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

Side by Side Diff: remoting/protocol/negotiating_authenticator_unittest.cc

Issue 418173004: Enable and fix CRLSet and remoting tests on non-Android OpenSSL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Also build crl_set.cc on NaCl Created 6 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) 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "net/base/net_errors.h" 6 #include "net/base/net_errors.h"
7 #include "remoting/base/rsa_key_pair.h" 7 #include "remoting/base/rsa_key_pair.h"
8 #include "remoting/protocol/authenticator_test_base.h" 8 #include "remoting/protocol/authenticator_test_base.h"
9 #include "remoting/protocol/channel_authenticator.h" 9 #include "remoting/protocol/channel_authenticator.h"
10 #include "remoting/protocol/connection_tester.h" 10 #include "remoting/protocol/connection_tester.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 // Use a bare pointer because the storage is managed by the base class. 141 // Use a bare pointer because the storage is managed by the base class.
142 NegotiatingClientAuthenticator* client_as_negotiating_authenticator_; 142 NegotiatingClientAuthenticator* client_as_negotiating_authenticator_;
143 143
144 private: 144 private:
145 scoped_refptr<PairingRegistry> pairing_registry_; 145 scoped_refptr<PairingRegistry> pairing_registry_;
146 146
147 DISALLOW_COPY_AND_ASSIGN(NegotiatingAuthenticatorTest); 147 DISALLOW_COPY_AND_ASSIGN(NegotiatingAuthenticatorTest);
148 }; 148 };
149 149
150 // These tests use net::SSLServerSocket which is not implemented for OpenSSL. 150 TEST_F(NegotiatingAuthenticatorTest, SuccessfulAuthHmac) {
151 #if defined(USE_OPENSSL)
152 #define MAYBE(x) DISABLED_##x
153 #else
154 #define MAYBE(x) x
155 #endif
156
157 TEST_F(NegotiatingAuthenticatorTest, MAYBE(SuccessfulAuthHmac)) {
158 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( 151 ASSERT_NO_FATAL_FAILURE(InitAuthenticators(
159 kNoClientId, kNoPairedSecret, kTestPin, kTestPin, 152 kNoClientId, kNoPairedSecret, kTestPin, kTestPin,
160 AuthenticationMethod::HMAC_SHA256, false)); 153 AuthenticationMethod::HMAC_SHA256, false));
161 VerifyAccepted( 154 VerifyAccepted(
162 AuthenticationMethod::Spake2(AuthenticationMethod::HMAC_SHA256)); 155 AuthenticationMethod::Spake2(AuthenticationMethod::HMAC_SHA256));
163 } 156 }
164 157
165 TEST_F(NegotiatingAuthenticatorTest, MAYBE(SuccessfulAuthPlain)) { 158 TEST_F(NegotiatingAuthenticatorTest, SuccessfulAuthPlain) {
166 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( 159 ASSERT_NO_FATAL_FAILURE(InitAuthenticators(
167 kNoClientId, kNoPairedSecret, kTestPin, kTestPin, 160 kNoClientId, kNoPairedSecret, kTestPin, kTestPin,
168 AuthenticationMethod::NONE, false)); 161 AuthenticationMethod::NONE, false));
169 VerifyAccepted(AuthenticationMethod::Spake2(AuthenticationMethod::NONE)); 162 VerifyAccepted(AuthenticationMethod::Spake2(AuthenticationMethod::NONE));
170 } 163 }
171 164
172 TEST_F(NegotiatingAuthenticatorTest, MAYBE(InvalidSecretHmac)) { 165 TEST_F(NegotiatingAuthenticatorTest, InvalidSecretHmac) {
173 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( 166 ASSERT_NO_FATAL_FAILURE(InitAuthenticators(
174 kNoClientId, kNoPairedSecret, kTestPinBad, kTestPin, 167 kNoClientId, kNoPairedSecret, kTestPinBad, kTestPin,
175 AuthenticationMethod::HMAC_SHA256, false)); 168 AuthenticationMethod::HMAC_SHA256, false));
176 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); 169 ASSERT_NO_FATAL_FAILURE(RunAuthExchange());
177 170
178 VerifyRejected(Authenticator::INVALID_CREDENTIALS); 171 VerifyRejected(Authenticator::INVALID_CREDENTIALS);
179 } 172 }
180 173
181 TEST_F(NegotiatingAuthenticatorTest, MAYBE(InvalidSecretPlain)) { 174 TEST_F(NegotiatingAuthenticatorTest, InvalidSecretPlain) {
182 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( 175 ASSERT_NO_FATAL_FAILURE(InitAuthenticators(
183 kNoClientId, kNoPairedSecret, kTestPin, kTestPinBad, 176 kNoClientId, kNoPairedSecret, kTestPin, kTestPinBad,
184 AuthenticationMethod::NONE, false)); 177 AuthenticationMethod::NONE, false));
185 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); 178 ASSERT_NO_FATAL_FAILURE(RunAuthExchange());
186 179
187 VerifyRejected(Authenticator::INVALID_CREDENTIALS); 180 VerifyRejected(Authenticator::INVALID_CREDENTIALS);
188 } 181 }
189 182
190 TEST_F(NegotiatingAuthenticatorTest, MAYBE(IncompatibleMethods)) { 183 TEST_F(NegotiatingAuthenticatorTest, IncompatibleMethods) {
191 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( 184 ASSERT_NO_FATAL_FAILURE(InitAuthenticators(
192 kNoClientId, kNoPairedSecret, kTestPin, kTestPinBad, 185 kNoClientId, kNoPairedSecret, kTestPin, kTestPinBad,
193 AuthenticationMethod::NONE, true)); 186 AuthenticationMethod::NONE, true));
194 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); 187 ASSERT_NO_FATAL_FAILURE(RunAuthExchange());
195 188
196 VerifyRejected(Authenticator::PROTOCOL_ERROR); 189 VerifyRejected(Authenticator::PROTOCOL_ERROR);
197 } 190 }
198 191
199 TEST_F(NegotiatingAuthenticatorTest, MAYBE(PairingNotSupported)) { 192 TEST_F(NegotiatingAuthenticatorTest, PairingNotSupported) {
200 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( 193 ASSERT_NO_FATAL_FAILURE(InitAuthenticators(
201 kTestClientId, kTestPairedSecret, kTestPin, kTestPin, 194 kTestClientId, kTestPairedSecret, kTestPin, kTestPin,
202 AuthenticationMethod::HMAC_SHA256, false)); 195 AuthenticationMethod::HMAC_SHA256, false));
203 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); 196 ASSERT_NO_FATAL_FAILURE(RunAuthExchange());
204 VerifyAccepted( 197 VerifyAccepted(
205 AuthenticationMethod::Spake2(AuthenticationMethod::HMAC_SHA256)); 198 AuthenticationMethod::Spake2(AuthenticationMethod::HMAC_SHA256));
206 } 199 }
207 200
208 TEST_F(NegotiatingAuthenticatorTest, MAYBE(PairingSupportedButNotPaired)) { 201 TEST_F(NegotiatingAuthenticatorTest, PairingSupportedButNotPaired) {
209 CreatePairingRegistry(false); 202 CreatePairingRegistry(false);
210 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( 203 ASSERT_NO_FATAL_FAILURE(InitAuthenticators(
211 kNoClientId, kNoPairedSecret, kTestPin, kTestPin, 204 kNoClientId, kNoPairedSecret, kTestPin, kTestPin,
212 AuthenticationMethod::HMAC_SHA256, false)); 205 AuthenticationMethod::HMAC_SHA256, false));
213 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); 206 ASSERT_NO_FATAL_FAILURE(RunAuthExchange());
214 VerifyAccepted(AuthenticationMethod::Spake2Pair()); 207 VerifyAccepted(AuthenticationMethod::Spake2Pair());
215 } 208 }
216 209
217 TEST_F(NegotiatingAuthenticatorTest, MAYBE(PairingRevokedPinOkay)) { 210 TEST_F(NegotiatingAuthenticatorTest, PairingRevokedPinOkay) {
218 CreatePairingRegistry(false); 211 CreatePairingRegistry(false);
219 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( 212 ASSERT_NO_FATAL_FAILURE(InitAuthenticators(
220 kTestClientId, kTestPairedSecret, kTestPin, kTestPin, 213 kTestClientId, kTestPairedSecret, kTestPin, kTestPin,
221 AuthenticationMethod::HMAC_SHA256, false)); 214 AuthenticationMethod::HMAC_SHA256, false));
222 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); 215 ASSERT_NO_FATAL_FAILURE(RunAuthExchange());
223 VerifyAccepted(AuthenticationMethod::Spake2Pair()); 216 VerifyAccepted(AuthenticationMethod::Spake2Pair());
224 } 217 }
225 218
226 TEST_F(NegotiatingAuthenticatorTest, MAYBE(PairingRevokedPinBad)) { 219 TEST_F(NegotiatingAuthenticatorTest, PairingRevokedPinBad) {
227 CreatePairingRegistry(false); 220 CreatePairingRegistry(false);
228 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( 221 ASSERT_NO_FATAL_FAILURE(InitAuthenticators(
229 kTestClientId, kTestPairedSecret, kTestPinBad, kTestPin, 222 kTestClientId, kTestPairedSecret, kTestPinBad, kTestPin,
230 AuthenticationMethod::HMAC_SHA256, false)); 223 AuthenticationMethod::HMAC_SHA256, false));
231 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); 224 ASSERT_NO_FATAL_FAILURE(RunAuthExchange());
232 VerifyRejected(Authenticator::INVALID_CREDENTIALS); 225 VerifyRejected(Authenticator::INVALID_CREDENTIALS);
233 } 226 }
234 227
235 TEST_F(NegotiatingAuthenticatorTest, MAYBE(PairingSucceeded)) { 228 TEST_F(NegotiatingAuthenticatorTest, PairingSucceeded) {
236 CreatePairingRegistry(true); 229 CreatePairingRegistry(true);
237 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( 230 ASSERT_NO_FATAL_FAILURE(InitAuthenticators(
238 kTestClientId, kTestPairedSecret, kTestPinBad, kTestPin, 231 kTestClientId, kTestPairedSecret, kTestPinBad, kTestPin,
239 AuthenticationMethod::HMAC_SHA256, false)); 232 AuthenticationMethod::HMAC_SHA256, false));
240 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); 233 ASSERT_NO_FATAL_FAILURE(RunAuthExchange());
241 VerifyAccepted(AuthenticationMethod::Spake2Pair()); 234 VerifyAccepted(AuthenticationMethod::Spake2Pair());
242 } 235 }
243 236
244 TEST_F(NegotiatingAuthenticatorTest, 237 TEST_F(NegotiatingAuthenticatorTest,
245 MAYBE(PairingSucceededInvalidSecretButPinOkay)) { 238 PairingSucceededInvalidSecretButPinOkay) {
246 CreatePairingRegistry(true); 239 CreatePairingRegistry(true);
247 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( 240 ASSERT_NO_FATAL_FAILURE(InitAuthenticators(
248 kTestClientId, kTestPairedSecretBad, kTestPin, kTestPin, 241 kTestClientId, kTestPairedSecretBad, kTestPin, kTestPin,
249 AuthenticationMethod::HMAC_SHA256, false)); 242 AuthenticationMethod::HMAC_SHA256, false));
250 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); 243 ASSERT_NO_FATAL_FAILURE(RunAuthExchange());
251 VerifyAccepted(AuthenticationMethod::Spake2Pair()); 244 VerifyAccepted(AuthenticationMethod::Spake2Pair());
252 } 245 }
253 246
254 TEST_F(NegotiatingAuthenticatorTest, MAYBE(PairingFailedInvalidSecretAndPin)) { 247 TEST_F(NegotiatingAuthenticatorTest, PairingFailedInvalidSecretAndPin) {
255 CreatePairingRegistry(true); 248 CreatePairingRegistry(true);
256 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( 249 ASSERT_NO_FATAL_FAILURE(InitAuthenticators(
257 kTestClientId, kTestPairedSecretBad, kTestPinBad, kTestPin, 250 kTestClientId, kTestPairedSecretBad, kTestPinBad, kTestPin,
258 AuthenticationMethod::HMAC_SHA256, false)); 251 AuthenticationMethod::HMAC_SHA256, false));
259 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); 252 ASSERT_NO_FATAL_FAILURE(RunAuthExchange());
260 VerifyRejected(Authenticator::INVALID_CREDENTIALS); 253 VerifyRejected(Authenticator::INVALID_CREDENTIALS);
261 } 254 }
262 255
263 } // namespace protocol 256 } // namespace protocol
264 } // namespace remoting 257 } // namespace remoting
OLDNEW
« no previous file with comments | « net/url_request/url_request_unittest.cc ('k') | remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698