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

Side by Side Diff: chromeos/network/client_cert_resolver_unittest.cc

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome_frame/test/urlmon_moniker_unittest.cc ('k') | chromeos/network/onc/onc_test_utils.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "chromeos/network/client_cert_resolver.h" 4 #include "chromeos/network/client_cert_resolver.h"
5 5
6 #include <cert.h> 6 #include <cert.h>
7 #include <pk11pub.h> 7 #include <pk11pub.h>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 ca_cert_list, net::NSSCertDatabase::TRUST_DEFAULT, &failures)); 97 ca_cert_list, net::NSSCertDatabase::TRUST_DEFAULT, &failures));
98 ASSERT_TRUE(failures.empty()) << net::ErrorToString(failures[0].net_error); 98 ASSERT_TRUE(failures.empty()) << net::ErrorToString(failures[0].net_error);
99 99
100 net::X509Certificate::GetPEMEncoded(ca_cert_list[0]->os_cert_handle(), 100 net::X509Certificate::GetPEMEncoded(ca_cert_list[0]->os_cert_handle(),
101 &test_ca_cert_pem_); 101 &test_ca_cert_pem_);
102 ASSERT_TRUE(!test_ca_cert_pem_.empty()); 102 ASSERT_TRUE(!test_ca_cert_pem_.empty());
103 103
104 // Import a client cert signed by that CA. 104 // Import a client cert signed by that CA.
105 scoped_refptr<net::CryptoModule> crypt_module = cert_db->GetPrivateModule(); 105 scoped_refptr<net::CryptoModule> crypt_module = cert_db->GetPrivateModule();
106 std::string pkcs12_data; 106 std::string pkcs12_data;
107 ASSERT_TRUE(file_util::ReadFileToString( 107 ASSERT_TRUE(base::ReadFileToString(
108 net::GetTestCertsDirectory().Append("websocket_client_cert.p12"), 108 net::GetTestCertsDirectory().Append("websocket_client_cert.p12"),
109 &pkcs12_data)); 109 &pkcs12_data));
110 110
111 net::CertificateList client_cert_list; 111 net::CertificateList client_cert_list;
112 ASSERT_EQ(net::OK, 112 ASSERT_EQ(net::OK,
113 cert_db->ImportFromPKCS12(crypt_module.get(), 113 cert_db->ImportFromPKCS12(crypt_module.get(),
114 pkcs12_data, 114 pkcs12_data,
115 string16(), 115 string16(),
116 false, 116 false,
117 &client_cert_list)); 117 &client_cert_list));
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 message_loop_.RunUntilIdle(); 272 message_loop_.RunUntilIdle();
273 273
274 // Verify that the resolver positively matched the pattern in the policy with 274 // Verify that the resolver positively matched the pattern in the policy with
275 // the test client cert and configured the network. 275 // the test client cert and configured the network.
276 std::string pkcs11_id; 276 std::string pkcs11_id;
277 GetClientCertProperties(&pkcs11_id); 277 GetClientCertProperties(&pkcs11_id);
278 EXPECT_EQ(test_pkcs11_id_, pkcs11_id); 278 EXPECT_EQ(test_pkcs11_id_, pkcs11_id);
279 } 279 }
280 280
281 } // namespace chromeos 281 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome_frame/test/urlmon_moniker_unittest.cc ('k') | chromeos/network/onc/onc_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698