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

Side by Side Diff: extensions/browser/api/cast_channel/cast_auth_util_unittest.cc

Issue 853663003: Revert of Refactoring of Cast-related crypto code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
OLDNEW
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
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_CERT_NOT_SIGNED_BY_TRUSTED_CA, result.error_type); 357 EXPECT_EQ(AuthResult::ERROR_FINGERPRINT_NOT_FOUND,
358 result.error_type);
358 } 359 }
359 360
360 TEST_F(CastAuthUtilTest, VerifyBadClientAuthCert) { 361 TEST_F(CastAuthUtilTest, VerifyBadClientAuthCert) {
361 AuthResponse auth_response = CreateAuthResponse(); 362 AuthResponse auth_response = CreateAuthResponse();
362 MangleString(auth_response.mutable_client_auth_certificate()); 363 MangleString(auth_response.mutable_client_auth_certificate());
363 AuthResult result = VerifyCredentials( 364 AuthResult result = VerifyCredentials(
364 auth_response, CreatePeerCert()); 365 auth_response, CreatePeerCert());
365 EXPECT_FALSE(result.success()); 366 EXPECT_FALSE(result.success());
366 EXPECT_EQ(AuthResult::ERROR_CERT_PARSING_FAILED, 367 EXPECT_EQ(AuthResult::ERROR_CERT_PARSING_FAILED,
367 result.error_type); 368 result.error_type);
(...skipping 17 matching lines...) Expand all
385 auth_response, peer_cert); 386 auth_response, peer_cert);
386 EXPECT_FALSE(result.success()); 387 EXPECT_FALSE(result.success());
387 EXPECT_EQ(AuthResult::ERROR_SIGNED_BLOBS_MISMATCH, 388 EXPECT_EQ(AuthResult::ERROR_SIGNED_BLOBS_MISMATCH,
388 result.error_type); 389 result.error_type);
389 } 390 }
390 391
391 } // namespace 392 } // namespace
392 } // namespace cast_channel 393 } // namespace cast_channel
393 } // namespace core_api 394 } // namespace core_api
394 } // namespace extensions 395 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/cast_channel/cast_auth_util_openssl.cc ('k') | extensions/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698