OLD | NEW |
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/network_cert_migrator.h" | 5 #include "chromeos/network/network_cert_migrator.h" |
6 | 6 |
7 #include <cert.h> | 7 #include <cert.h> |
8 #include <pk11pub.h> | 8 #include <pk11pub.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 const std::string& state) { | 100 const std::string& state) { |
101 service_test_->AddService(network_id /* service_path */, | 101 service_test_->AddService(network_id /* service_path */, |
102 network_id /* guid */, | 102 network_id /* guid */, |
103 network_id /* name */, | 103 network_id /* name */, |
104 type, | 104 type, |
105 state, | 105 state, |
106 true /* add_to_visible */); | 106 true /* add_to_visible */); |
107 | 107 |
108 // Ensure that the service appears as 'configured', i.e. is associated to a | 108 // Ensure that the service appears as 'configured', i.e. is associated to a |
109 // Shill profile. | 109 // Shill profile. |
110 service_test_->SetServiceProperty( | 110 service_test_->SetServiceProperty(network_id, shill::kProfileProperty, |
111 network_id, shill::kProfileProperty, base::StringValue(kProfile)); | 111 base::Value(kProfile)); |
112 } | 112 } |
113 | 113 |
114 void SetupNetworkWithEapCertId(bool wifi, const std::string& cert_id) { | 114 void SetupNetworkWithEapCertId(bool wifi, const std::string& cert_id) { |
115 std::string type = wifi ? shill::kTypeWifi: shill::kTypeEthernetEap; | 115 std::string type = wifi ? shill::kTypeWifi: shill::kTypeEthernetEap; |
116 std::string name = wifi ? kWifiStub : kEthernetEapStub; | 116 std::string name = wifi ? kWifiStub : kEthernetEapStub; |
117 AddService(name, type, shill::kStateOnline); | 117 AddService(name, type, shill::kStateOnline); |
118 service_test_->SetServiceProperty( | 118 service_test_->SetServiceProperty(name, shill::kEapCertIdProperty, |
119 name, shill::kEapCertIdProperty, base::StringValue(cert_id)); | 119 base::Value(cert_id)); |
120 service_test_->SetServiceProperty( | 120 service_test_->SetServiceProperty(name, shill::kEapKeyIdProperty, |
121 name, shill::kEapKeyIdProperty, base::StringValue(cert_id)); | 121 base::Value(cert_id)); |
122 | 122 |
123 if (wifi) { | 123 if (wifi) { |
124 service_test_->SetServiceProperty( | 124 service_test_->SetServiceProperty(name, shill::kSecurityClassProperty, |
125 name, | 125 base::Value(shill::kSecurity8021x)); |
126 shill::kSecurityClassProperty, | |
127 base::StringValue(shill::kSecurity8021x)); | |
128 } | 126 } |
129 } | 127 } |
130 | 128 |
131 void GetEapCertId(bool wifi, std::string* cert_id) { | 129 void GetEapCertId(bool wifi, std::string* cert_id) { |
132 cert_id->clear(); | 130 cert_id->clear(); |
133 | 131 |
134 std::string name = wifi ? kWifiStub : kEthernetEapStub; | 132 std::string name = wifi ? kWifiStub : kEthernetEapStub; |
135 const base::DictionaryValue* properties = | 133 const base::DictionaryValue* properties = |
136 service_test_->GetServiceProperties(name); | 134 service_test_->GetServiceProperties(name); |
137 properties->GetStringWithoutPathExpansion(shill::kEapCertIdProperty, | 135 properties->GetStringWithoutPathExpansion(shill::kEapCertIdProperty, |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 base::RunLoop().RunUntilIdle(); | 330 base::RunLoop().RunUntilIdle(); |
333 | 331 |
334 std::string pkcs11_id; | 332 std::string pkcs11_id; |
335 std::string slot_id; | 333 std::string slot_id; |
336 GetVpnCertId(false /* IPsec */, &slot_id, &pkcs11_id); | 334 GetVpnCertId(false /* IPsec */, &slot_id, &pkcs11_id); |
337 EXPECT_EQ(test_client_cert_pkcs11_id_, pkcs11_id); | 335 EXPECT_EQ(test_client_cert_pkcs11_id_, pkcs11_id); |
338 EXPECT_EQ(test_client_cert_slot_id_, slot_id); | 336 EXPECT_EQ(test_client_cert_slot_id_, slot_id); |
339 } | 337 } |
340 | 338 |
341 } // namespace chromeos | 339 } // namespace chromeos |
OLD | NEW |