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

Side by Side Diff: chrome/common/net/x509_certificate_model_unittest.cc

Issue 511473002: Remove implicit conversions from scoped_refptr to T* in chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move download out Created 6 years, 3 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
« no previous file with comments | « chrome/browser/themes/theme_service.cc ('k') | chrome/service/cloud_print/cloud_print_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/common/net/x509_certificate_model.h" 5 #include "chrome/common/net/x509_certificate_model.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "net/base/test_data_directory.h" 9 #include "net/base/test_data_directory.h"
10 #include "net/test/cert_test_util.h" 10 #include "net/test/cert_test_util.h"
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 pkcs7_string.data(), 314 pkcs7_string.data(),
315 pkcs7_string.size(), 315 pkcs7_string.size(),
316 net::X509Certificate::FORMAT_PKCS7); 316 net::X509Certificate::FORMAT_PKCS7);
317 317
318 ASSERT_EQ(certs.size(), decoded_certs.size()); 318 ASSERT_EQ(certs.size(), decoded_certs.size());
319 #if defined(USE_OPENSSL) 319 #if defined(USE_OPENSSL)
320 for (size_t i = 0; i < certs.size(); ++i) 320 for (size_t i = 0; i < certs.size(); ++i)
321 EXPECT_TRUE(certs[i]->Equals(decoded_certs[i])); 321 EXPECT_TRUE(certs[i]->Equals(decoded_certs[i]));
322 #else 322 #else
323 // NSS sorts the certs before writing the file. 323 // NSS sorts the certs before writing the file.
324 EXPECT_TRUE(certs[0]->Equals(decoded_certs.back())); 324 EXPECT_TRUE(certs[0]->Equals(decoded_certs.back().get()));
325 for (size_t i = 1; i < certs.size(); ++i) 325 for (size_t i = 1; i < certs.size(); ++i)
326 EXPECT_TRUE(certs[i]->Equals(decoded_certs[i-1])); 326 EXPECT_TRUE(certs[i]->Equals(decoded_certs[i - 1].get()));
327 #endif 327 #endif
328 } 328 }
329 329
330 { 330 {
331 // Write only the first cert. 331 // Write only the first cert.
332 std::string pkcs7_string = 332 std::string pkcs7_string =
333 x509_certificate_model::GetCMSString(cert_handles, 0, 1); 333 x509_certificate_model::GetCMSString(cert_handles, 0, 1);
334 334
335 net::CertificateList decoded_certs = 335 net::CertificateList decoded_certs =
336 net::X509Certificate::CreateCertificateListFromBytes( 336 net::X509Certificate::CreateCertificateListFromBytes(
337 pkcs7_string.data(), 337 pkcs7_string.data(),
338 pkcs7_string.size(), 338 pkcs7_string.size(),
339 net::X509Certificate::FORMAT_PKCS7); 339 net::X509Certificate::FORMAT_PKCS7);
340 340
341 ASSERT_EQ(1U, decoded_certs.size()); 341 ASSERT_EQ(1U, decoded_certs.size());
342 EXPECT_TRUE(certs[0]->Equals(decoded_certs[0])); 342 EXPECT_TRUE(certs[0]->Equals(decoded_certs[0].get()));
343 } 343 }
344 } 344 }
345 345
346 TEST(X509CertificateModelTest, ProcessSecAlgorithms) { 346 TEST(X509CertificateModelTest, ProcessSecAlgorithms) {
347 { 347 {
348 scoped_refptr<net::X509Certificate> cert(net::ImportCertFromFile( 348 scoped_refptr<net::X509Certificate> cert(net::ImportCertFromFile(
349 net::GetTestCertsDirectory(), "root_ca_cert.pem")); 349 net::GetTestCertsDirectory(), "root_ca_cert.pem"));
350 ASSERT_TRUE(cert.get()); 350 ASSERT_TRUE(cert.get());
351 EXPECT_EQ("PKCS #1 SHA-1 With RSA Encryption", 351 EXPECT_EQ("PKCS #1 SHA-1 With RSA Encryption",
352 x509_certificate_model::ProcessSecAlgorithmSignature( 352 x509_certificate_model::ProcessSecAlgorithmSignature(
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 "09 6B 5A 6B F1 95 D3 9D 3F E0 42 63 FC B7 32 90\n" 439 "09 6B 5A 6B F1 95 D3 9D 3F E0 42 63 FC B7 32 90\n"
440 "55 56 F2 76 1B 71 38 BD BD FB 3B 23 50 46 4C 2C\n" 440 "55 56 F2 76 1B 71 38 BD BD FB 3B 23 50 46 4C 2C\n"
441 "4E 49 48 52 EA 05 5F 16 F2 98 51 AF 2F 79 36 2A\n" 441 "4E 49 48 52 EA 05 5F 16 F2 98 51 AF 2F 79 36 2A\n"
442 "A0 BA 36 68 1B 29 8B 7B E8 8C EA 73 31 E5 86 D7\n" 442 "A0 BA 36 68 1B 29 8B 7B E8 8C EA 73 31 E5 86 D7\n"
443 "2C D8 56 06 43 D7 72 D2 F0 27 4E 64 0A 2B 27 38\n" 443 "2C D8 56 06 43 D7 72 D2 F0 27 4E 64 0A 2B 27 38\n"
444 "36 CD BE C1 33 DB 74 4B 4E 74 BE 21 BD F6 81 66\n" 444 "36 CD BE C1 33 DB 74 4B 4E 74 BE 21 BD F6 81 66\n"
445 "D2 FD 2B 7F F4 55 36 C0 ED A7 44 CA B1 78 1D 0F", 445 "D2 FD 2B 7F F4 55 36 C0 ED A7 44 CA B1 78 1D 0F",
446 x509_certificate_model::ProcessRawBitsSignatureWrap( 446 x509_certificate_model::ProcessRawBitsSignatureWrap(
447 cert->os_cert_handle())); 447 cert->os_cert_handle()));
448 } 448 }
OLDNEW
« no previous file with comments | « chrome/browser/themes/theme_service.cc ('k') | chrome/service/cloud_print/cloud_print_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698