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

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

Issue 24348002: Migrate DBus service constants from flimflam namespace to shill namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased to ToT Created 7 years, 2 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 | « no previous file | chromeos/network/client_cert_util.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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 message_loop_.message_loop_proxy()); 138 message_loop_.message_loop_proxy());
139 139
140 profile_test_->AddProfile(kUserProfilePath, kUserHash); 140 profile_test_->AddProfile(kUserProfilePath, kUserHash);
141 } 141 }
142 142
143 void SetupWifi() { 143 void SetupWifi() {
144 const bool add_to_visible = true; 144 const bool add_to_visible = true;
145 const bool add_to_watchlist = true; 145 const bool add_to_watchlist = true;
146 service_test_->AddService(kWifiStub, 146 service_test_->AddService(kWifiStub,
147 kWifiSSID, 147 kWifiSSID,
148 flimflam::kTypeWifi, 148 shill::kTypeWifi,
149 flimflam::kStateOnline, 149 shill::kStateOnline,
150 add_to_visible, 150 add_to_visible,
151 add_to_watchlist); 151 add_to_watchlist);
152 service_test_->SetServiceProperty( 152 service_test_->SetServiceProperty(
153 kWifiStub, flimflam::kGuidProperty, base::StringValue(kWifiStub)); 153 kWifiStub, shill::kGuidProperty, base::StringValue(kWifiStub));
154 154
155 profile_test_->AddService(kUserProfilePath, kWifiStub); 155 profile_test_->AddService(kUserProfilePath, kWifiStub);
156 } 156 }
157 157
158 // Setup a policy with a certificate pattern that matches any client cert that 158 // Setup a policy with a certificate pattern that matches any client cert that
159 // is signed by the test CA cert (stored in |test_ca_cert_pem_|). In 159 // is signed by the test CA cert (stored in |test_ca_cert_pem_|). In
160 // particular it will match the test client cert. 160 // particular it will match the test client cert.
161 void SetupPolicy() { 161 void SetupPolicy() {
162 const char* kTestPolicyTemplate = 162 const char* kTestPolicyTemplate =
163 "[ { \"GUID\": \"wifi_stub\"," 163 "[ { \"GUID\": \"wifi_stub\","
(...skipping 25 matching lines...) Expand all
189 managed_config_handler_->SetPolicy( 189 managed_config_handler_->SetPolicy(
190 onc::ONC_SOURCE_USER_POLICY, kUserHash, *policy); 190 onc::ONC_SOURCE_USER_POLICY, kUserHash, *policy);
191 } 191 }
192 192
193 void GetClientCertProperties(std::string* pkcs11_id) { 193 void GetClientCertProperties(std::string* pkcs11_id) {
194 pkcs11_id->clear(); 194 pkcs11_id->clear();
195 const base::DictionaryValue* properties = 195 const base::DictionaryValue* properties =
196 service_test_->GetServiceProperties(kWifiStub); 196 service_test_->GetServiceProperties(kWifiStub);
197 if (!properties) 197 if (!properties)
198 return; 198 return;
199 properties->GetStringWithoutPathExpansion(flimflam::kEapCertIdProperty, 199 properties->GetStringWithoutPathExpansion(shill::kEapCertIdProperty,
200 pkcs11_id); 200 pkcs11_id);
201 } 201 }
202 202
203 ShillServiceClient::TestInterface* service_test_; 203 ShillServiceClient::TestInterface* service_test_;
204 ShillProfileClient::TestInterface* profile_test_; 204 ShillProfileClient::TestInterface* profile_test_;
205 std::string test_pkcs11_id_; 205 std::string test_pkcs11_id_;
206 scoped_refptr<net::X509Certificate> test_ca_cert_; 206 scoped_refptr<net::X509Certificate> test_ca_cert_;
207 std::string test_ca_cert_pem_; 207 std::string test_ca_cert_pem_;
208 base::MessageLoop message_loop_; 208 base::MessageLoop message_loop_;
209 209
(...skipping 62 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 | « no previous file | chromeos/network/client_cert_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698