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

Side by Side Diff: chrome/browser/chromeos/cros/network_library_unittest.cc

Issue 11962048: This adds Cellular to the Shill to ONC translation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing broken unit test Created 7 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <cert.h> 5 #include <cert.h>
6 #include <pk11pub.h> 6 #include <pk11pub.h>
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 EXPECT_FALSE(wifi1->connected()); 314 EXPECT_FALSE(wifi1->connected());
315 EXPECT_TRUE(cros_->CanConnectToNetwork(wifi1)); 315 EXPECT_TRUE(cros_->CanConnectToNetwork(wifi1));
316 cros_->ConnectToWifiNetwork(wifi1); 316 cros_->ConnectToWifiNetwork(wifi1);
317 EXPECT_TRUE(wifi1->connected()); 317 EXPECT_TRUE(wifi1->connected());
318 } 318 }
319 319
320 TEST_F(NetworkLibraryStubTest, NetworkConnectWifiWithCertPattern) { 320 TEST_F(NetworkLibraryStubTest, NetworkConnectWifiWithCertPattern) {
321 scoped_ptr<base::DictionaryValue> onc_root = 321 scoped_ptr<base::DictionaryValue> onc_root =
322 onc::test_utils::ReadTestDictionary("toplevel_wifi_eap_clientcert.onc"); 322 onc::test_utils::ReadTestDictionary("toplevel_wifi_eap_clientcert.onc");
323 base::ListValue* certificates; 323 base::ListValue* certificates;
324 onc_root->GetListWithoutPathExpansion(onc::kCertificates, &certificates); 324 onc_root->GetListWithoutPathExpansion(onc::toplevel_config::kCertificates,
325 &certificates);
325 326
326 onc::CertificateImporter importer(onc::ONC_SOURCE_USER_IMPORT, 327 onc::CertificateImporter importer(onc::ONC_SOURCE_USER_IMPORT,
327 false /* don't allow webtrust */); 328 false /* don't allow webtrust */);
328 ASSERT_EQ(onc::CertificateImporter::IMPORT_OK, 329 ASSERT_EQ(onc::CertificateImporter::IMPORT_OK,
329 importer.ParseAndStoreCertificates(*certificates)); 330 importer.ParseAndStoreCertificates(*certificates));
330 331
331 WifiNetwork* wifi = cros_->FindWifiNetworkByPath("wifi_cert_pattern"); 332 WifiNetwork* wifi = cros_->FindWifiNetworkByPath("wifi_cert_pattern");
332 333
333 StubEnrollmentDelegate* enrollment_delegate = new StubEnrollmentDelegate(); 334 StubEnrollmentDelegate* enrollment_delegate = new StubEnrollmentDelegate();
334 wifi->SetEnrollmentDelegate(enrollment_delegate); 335 wifi->SetEnrollmentDelegate(enrollment_delegate);
335 EXPECT_FALSE(enrollment_delegate->did_enroll); 336 EXPECT_FALSE(enrollment_delegate->did_enroll);
336 EXPECT_FALSE(enrollment_delegate->correct_args); 337 EXPECT_FALSE(enrollment_delegate->correct_args);
337 338
338 ASSERT_NE(static_cast<const WifiNetwork*>(NULL), wifi); 339 ASSERT_NE(static_cast<const WifiNetwork*>(NULL), wifi);
339 EXPECT_FALSE(wifi->connected()); 340 EXPECT_FALSE(wifi->connected());
340 EXPECT_TRUE(cros_->CanConnectToNetwork(wifi)); 341 EXPECT_TRUE(cros_->CanConnectToNetwork(wifi));
341 EXPECT_FALSE(wifi->connected()); 342 EXPECT_FALSE(wifi->connected());
342 wifi->AttemptConnection( 343 wifi->AttemptConnection(
343 base::Bind(&WifiNetworkConnectCallback, cros_, wifi)); 344 base::Bind(&WifiNetworkConnectCallback, cros_, wifi));
344 EXPECT_TRUE(wifi->connected()); 345 EXPECT_TRUE(wifi->connected());
345 EXPECT_TRUE(enrollment_delegate->did_enroll); 346 EXPECT_TRUE(enrollment_delegate->did_enroll);
346 EXPECT_TRUE(enrollment_delegate->correct_args); 347 EXPECT_TRUE(enrollment_delegate->correct_args);
347 } 348 }
348 349
349 TEST_F(NetworkLibraryStubTest, NetworkConnectVPNWithCertPattern) { 350 TEST_F(NetworkLibraryStubTest, NetworkConnectVPNWithCertPattern) {
350 scoped_ptr<base::DictionaryValue> onc_root = 351 scoped_ptr<base::DictionaryValue> onc_root =
351 onc::test_utils::ReadTestDictionary("toplevel_openvpn_clientcert.onc"); 352 onc::test_utils::ReadTestDictionary("toplevel_openvpn_clientcert.onc");
352 base::ListValue* certificates; 353 base::ListValue* certificates;
353 onc_root->GetListWithoutPathExpansion(onc::kCertificates, &certificates); 354 onc_root->GetListWithoutPathExpansion(onc::toplevel_config::kCertificates,
355 &certificates);
354 356
355 onc::CertificateImporter importer(onc::ONC_SOURCE_USER_IMPORT, 357 onc::CertificateImporter importer(onc::ONC_SOURCE_USER_IMPORT,
356 false /* don't allow webtrust */); 358 false /* don't allow webtrust */);
357 ASSERT_EQ(onc::CertificateImporter::IMPORT_OK, 359 ASSERT_EQ(onc::CertificateImporter::IMPORT_OK,
358 importer.ParseAndStoreCertificates(*certificates)); 360 importer.ParseAndStoreCertificates(*certificates));
359 361
360 VirtualNetwork* vpn = cros_->FindVirtualNetworkByPath("vpn_cert_pattern"); 362 VirtualNetwork* vpn = cros_->FindVirtualNetworkByPath("vpn_cert_pattern");
361 363
362 StubEnrollmentDelegate* enrollment_delegate = new StubEnrollmentDelegate(); 364 StubEnrollmentDelegate* enrollment_delegate = new StubEnrollmentDelegate();
363 vpn->SetEnrollmentDelegate(enrollment_delegate); 365 vpn->SetEnrollmentDelegate(enrollment_delegate);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 437
436 TEST_P(LoadOncNetworksTest, VerifyNetworksAndCertificates) { 438 TEST_P(LoadOncNetworksTest, VerifyNetworksAndCertificates) {
437 LoadOncAndVerifyNetworks(GetParam().onc_file, 439 LoadOncAndVerifyNetworks(GetParam().onc_file,
438 GetParam().shill_file, 440 GetParam().shill_file,
439 GetParam().onc_source, 441 GetParam().onc_source,
440 GetParam().expect_import_result); 442 GetParam().expect_import_result);
441 443
442 scoped_ptr<base::DictionaryValue> onc_dict = 444 scoped_ptr<base::DictionaryValue> onc_dict =
443 onc::test_utils::ReadTestDictionary(GetParam().onc_file); 445 onc::test_utils::ReadTestDictionary(GetParam().onc_file);
444 base::ListValue* onc_certs; 446 base::ListValue* onc_certs;
445 onc_dict->GetListWithoutPathExpansion(onc::kCertificates, &onc_certs); 447 onc_dict->GetListWithoutPathExpansion(onc::toplevel_config::kCertificates,
448 &onc_certs);
446 449
447 EXPECT_EQ(onc_certs->GetSize(), 450 EXPECT_EQ(onc_certs->GetSize(),
448 ListCertsInSlot(slot_->os_module_handle()).size()); 451 ListCertsInSlot(slot_->os_module_handle()).size());
449 } 452 }
450 453
451 INSTANTIATE_TEST_CASE_P( 454 INSTANTIATE_TEST_CASE_P(
452 LoadOncNetworksTest, 455 LoadOncNetworksTest,
453 LoadOncNetworksTest, 456 LoadOncNetworksTest,
454 ::testing::Values( 457 ::testing::Values(
455 ImportParams("managed_toplevel1.onc", 458 ImportParams("managed_toplevel1.onc",
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 497
495 // TODO(stevenjb): Test network profiles. 498 // TODO(stevenjb): Test network profiles.
496 499
497 // TODO(stevenjb): Test network devices. 500 // TODO(stevenjb): Test network devices.
498 501
499 // TODO(stevenjb): Test data plans. 502 // TODO(stevenjb): Test data plans.
500 503
501 // TODO(stevenjb): Test monitor network / device. 504 // TODO(stevenjb): Test monitor network / device.
502 505
503 } // namespace chromeos 506 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/network_library_impl_base.cc ('k') | chrome/browser/chromeos/options/vpn_config_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698