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

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

Issue 23526016: Autoconnect policy for CrOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renamed policy. 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 | Annotate | Revision Log
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"
11 #include "base/json/json_reader.h" 11 #include "base/json/json_reader.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "base/values.h"
14 #include "chromeos/dbus/dbus_thread_manager.h" 15 #include "chromeos/dbus/dbus_thread_manager.h"
15 #include "chromeos/dbus/shill_profile_client.h" 16 #include "chromeos/dbus/shill_profile_client.h"
16 #include "chromeos/dbus/shill_service_client.h" 17 #include "chromeos/dbus/shill_service_client.h"
17 #include "chromeos/login/login_state.h" 18 #include "chromeos/login/login_state.h"
18 #include "chromeos/network/managed_network_configuration_handler_impl.h" 19 #include "chromeos/network/managed_network_configuration_handler_impl.h"
19 #include "chromeos/network/network_configuration_handler.h" 20 #include "chromeos/network/network_configuration_handler.h"
20 #include "chromeos/network/network_profile_handler.h" 21 #include "chromeos/network/network_profile_handler.h"
21 #include "chromeos/network/network_state_handler.h" 22 #include "chromeos/network/network_state_handler.h"
22 #include "crypto/nss_util.h" 23 #include "crypto/nss_util.h"
23 #include "net/base/crypto_module.h" 24 #include "net/base/crypto_module.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 181
181 std::string error; 182 std::string error;
182 scoped_ptr<base::Value> policy_value(base::JSONReader::ReadAndReturnError( 183 scoped_ptr<base::Value> policy_value(base::JSONReader::ReadAndReturnError(
183 policy_json, base::JSON_ALLOW_TRAILING_COMMAS, NULL, &error)); 184 policy_json, base::JSON_ALLOW_TRAILING_COMMAS, NULL, &error));
184 ASSERT_TRUE(policy_value) << error; 185 ASSERT_TRUE(policy_value) << error;
185 186
186 base::ListValue* policy = NULL; 187 base::ListValue* policy = NULL;
187 ASSERT_TRUE(policy_value->GetAsList(&policy)); 188 ASSERT_TRUE(policy_value->GetAsList(&policy));
188 189
189 managed_config_handler_->SetPolicy( 190 managed_config_handler_->SetPolicy(
190 onc::ONC_SOURCE_USER_POLICY, kUserHash, *policy); 191 onc::ONC_SOURCE_USER_POLICY,
192 kUserHash,
193 *policy,
194 base::DictionaryValue() /* no global network config */);
191 } 195 }
192 196
193 void GetClientCertProperties(std::string* pkcs11_id) { 197 void GetClientCertProperties(std::string* pkcs11_id) {
194 pkcs11_id->clear(); 198 pkcs11_id->clear();
195 const base::DictionaryValue* properties = 199 const base::DictionaryValue* properties =
196 service_test_->GetServiceProperties(kWifiStub); 200 service_test_->GetServiceProperties(kWifiStub);
197 if (!properties) 201 if (!properties)
198 return; 202 return;
199 properties->GetStringWithoutPathExpansion(shill::kEapCertIdProperty, 203 properties->GetStringWithoutPathExpansion(shill::kEapCertIdProperty,
200 pkcs11_id); 204 pkcs11_id);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 message_loop_.RunUntilIdle(); 276 message_loop_.RunUntilIdle();
273 277
274 // Verify that the resolver positively matched the pattern in the policy with 278 // Verify that the resolver positively matched the pattern in the policy with
275 // the test client cert and configured the network. 279 // the test client cert and configured the network.
276 std::string pkcs11_id; 280 std::string pkcs11_id;
277 GetClientCertProperties(&pkcs11_id); 281 GetClientCertProperties(&pkcs11_id);
278 EXPECT_EQ(test_pkcs11_id_, pkcs11_id); 282 EXPECT_EQ(test_pkcs11_id_, pkcs11_id);
279 } 283 }
280 284
281 } // namespace chromeos 285 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/net_internals/net_internals_ui.cc ('k') | chromeos/network/managed_network_configuration_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698