| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/cast_channel/cast_auth_util.h" | 5 #include "extensions/browser/api/cast_channel/cast_auth_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "extensions/common/api/cast_channel/cast_channel.pb.h" | 10 #include "extensions/common/api/cast_channel/cast_channel.pb.h" |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 auth_response, CreatePeerCert()); | 347 auth_response, CreatePeerCert()); |
| 348 EXPECT_TRUE(result.success()); | 348 EXPECT_TRUE(result.success()); |
| 349 } | 349 } |
| 350 | 350 |
| 351 TEST_F(CastAuthUtilTest, VerifyBadCA) { | 351 TEST_F(CastAuthUtilTest, VerifyBadCA) { |
| 352 AuthResponse auth_response = CreateAuthResponse(); | 352 AuthResponse auth_response = CreateAuthResponse(); |
| 353 MangleString(auth_response.mutable_intermediate_certificate(0)); | 353 MangleString(auth_response.mutable_intermediate_certificate(0)); |
| 354 AuthResult result = VerifyCredentials( | 354 AuthResult result = VerifyCredentials( |
| 355 auth_response, CreatePeerCert()); | 355 auth_response, CreatePeerCert()); |
| 356 EXPECT_FALSE(result.success()); | 356 EXPECT_FALSE(result.success()); |
| 357 EXPECT_EQ(AuthResult::ERROR_FINGERPRINT_NOT_FOUND, | 357 EXPECT_EQ(AuthResult::ERROR_CERT_NOT_SIGNED_BY_TRUSTED_CA, result.error_type); |
| 358 result.error_type); | |
| 359 } | 358 } |
| 360 | 359 |
| 361 TEST_F(CastAuthUtilTest, VerifyBadClientAuthCert) { | 360 TEST_F(CastAuthUtilTest, VerifyBadClientAuthCert) { |
| 362 AuthResponse auth_response = CreateAuthResponse(); | 361 AuthResponse auth_response = CreateAuthResponse(); |
| 363 MangleString(auth_response.mutable_client_auth_certificate()); | 362 MangleString(auth_response.mutable_client_auth_certificate()); |
| 364 AuthResult result = VerifyCredentials( | 363 AuthResult result = VerifyCredentials( |
| 365 auth_response, CreatePeerCert()); | 364 auth_response, CreatePeerCert()); |
| 366 EXPECT_FALSE(result.success()); | 365 EXPECT_FALSE(result.success()); |
| 367 EXPECT_EQ(AuthResult::ERROR_CERT_PARSING_FAILED, | 366 EXPECT_EQ(AuthResult::ERROR_CERT_PARSING_FAILED, |
| 368 result.error_type); | 367 result.error_type); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 386 auth_response, peer_cert); | 385 auth_response, peer_cert); |
| 387 EXPECT_FALSE(result.success()); | 386 EXPECT_FALSE(result.success()); |
| 388 EXPECT_EQ(AuthResult::ERROR_SIGNED_BLOBS_MISMATCH, | 387 EXPECT_EQ(AuthResult::ERROR_SIGNED_BLOBS_MISMATCH, |
| 389 result.error_type); | 388 result.error_type); |
| 390 } | 389 } |
| 391 | 390 |
| 392 } // namespace | 391 } // namespace |
| 393 } // namespace cast_channel | 392 } // namespace cast_channel |
| 394 } // namespace core_api | 393 } // namespace core_api |
| 395 } // namespace extensions | 394 } // namespace extensions |
| OLD | NEW |