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

Side by Side Diff: chromeos/network/onc/onc_certificate_importer_impl_unittest.cc

Issue 1353323002: Cleanup: Pass std::string as const reference from chromeos/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't use const& for NetworkConnectionHandler::CheckPendingRequest; Use one more const& in unittests Created 5 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 | « chromeos/network/network_connection_handler.h ('k') | chromeos/network/shill_property_util.h » ('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 4
5 #include "chromeos/network/onc/onc_certificate_importer_impl.h" 5 #include "chromeos/network/onc/onc_certificate_importer_impl.h"
6 6
7 #include <cert.h> 7 #include <cert.h>
8 #include <certdb.h> 8 #include <certdb.h>
9 #include <keyhi.h> 9 #include <keyhi.h>
10 #include <pk11pub.h> 10 #include <pk11pub.h>
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 91
92 protected: 92 protected:
93 void OnImportCompleted(bool expected_success, 93 void OnImportCompleted(bool expected_success,
94 bool success, 94 bool success,
95 const net::CertificateList& onc_trusted_certificates) { 95 const net::CertificateList& onc_trusted_certificates) {
96 EXPECT_EQ(expected_success, success); 96 EXPECT_EQ(expected_success, success);
97 web_trust_certificates_ = onc_trusted_certificates; 97 web_trust_certificates_ = onc_trusted_certificates;
98 } 98 }
99 99
100 void AddCertificatesFromFile(std::string filename, bool expected_success) { 100 void AddCertificatesFromFile(const std::string& filename,
101 bool expected_success) {
101 scoped_ptr<base::DictionaryValue> onc = 102 scoped_ptr<base::DictionaryValue> onc =
102 test_utils::ReadTestDictionary(filename); 103 test_utils::ReadTestDictionary(filename);
103 scoped_ptr<base::Value> certificates_value; 104 scoped_ptr<base::Value> certificates_value;
104 base::ListValue* certificates = NULL; 105 base::ListValue* certificates = NULL;
105 onc->RemoveWithoutPathExpansion(::onc::toplevel_config::kCertificates, 106 onc->RemoveWithoutPathExpansion(::onc::toplevel_config::kCertificates,
106 &certificates_value); 107 &certificates_value);
107 certificates_value.release()->GetAsList(&certificates); 108 certificates_value.release()->GetAsList(&certificates);
108 onc_certificates_.reset(certificates); 109 onc_certificates_.reset(certificates);
109 110
110 web_trust_certificates_.clear(); 111 web_trust_certificates_.clear();
111 CertificateImporterImpl importer(task_runner_, test_nssdb_.get()); 112 CertificateImporterImpl importer(task_runner_, test_nssdb_.get());
112 importer.ImportCertificates( 113 importer.ImportCertificates(
113 *certificates, 114 *certificates,
114 ::onc::ONC_SOURCE_USER_IMPORT, // allow web trust 115 ::onc::ONC_SOURCE_USER_IMPORT, // allow web trust
115 base::Bind(&ONCCertificateImporterImplTest::OnImportCompleted, 116 base::Bind(&ONCCertificateImporterImplTest::OnImportCompleted,
116 base::Unretained(this), 117 base::Unretained(this),
117 expected_success)); 118 expected_success));
118 119
119 task_runner_->RunUntilIdle(); 120 task_runner_->RunUntilIdle();
120 121
121 public_list_ = ListCertsInPublicSlot(); 122 public_list_ = ListCertsInPublicSlot();
122 private_list_ = ListCertsInPrivateSlot(); 123 private_list_ = ListCertsInPrivateSlot();
123 } 124 }
124 125
125 void AddCertificateFromFile(std::string filename, 126 void AddCertificateFromFile(const std::string& filename,
126 net::CertType expected_type, 127 net::CertType expected_type,
127 std::string* guid) { 128 std::string* guid) {
128 std::string guid_temporary; 129 std::string guid_temporary;
129 if (!guid) 130 if (!guid)
130 guid = &guid_temporary; 131 guid = &guid_temporary;
131 132
132 AddCertificatesFromFile(filename, true); 133 AddCertificatesFromFile(filename, true);
133 134
134 if (expected_type == net::SERVER_CERT || expected_type == net::CA_CERT) { 135 if (expected_type == net::SERVER_CERT || expected_type == net::CA_CERT) {
135 ASSERT_EQ(1u, public_list_.size()); 136 ASSERT_EQ(1u, public_list_.size());
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 "certificate-client-update.onc"), 342 "certificate-client-update.onc"),
342 CertParam(net::SERVER_CERT, 343 CertParam(net::SERVER_CERT,
343 "certificate-server.onc", 344 "certificate-server.onc",
344 "certificate-server-update.onc"), 345 "certificate-server-update.onc"),
345 CertParam(net::CA_CERT, 346 CertParam(net::CA_CERT,
346 "certificate-web-authority.onc", 347 "certificate-web-authority.onc",
347 "certificate-web-authority-update.onc"))); 348 "certificate-web-authority-update.onc")));
348 349
349 } // namespace onc 350 } // namespace onc
350 } // namespace chromeos 351 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_connection_handler.h ('k') | chromeos/network/shill_property_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698