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

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

Issue 2871653002: Remove raw base::DictionaryValue::SetWithoutPathExpansion in //chromeos (Closed)
Patch Set: Minor Fix Created 3 years, 7 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
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 base::RunLoop().RunUntilIdle(); 477 base::RunLoop().RunUntilIdle();
478 } 478 }
479 479
480 TEST_F(NetworkConfigurationHandlerTest, CreateConfiguration) { 480 TEST_F(NetworkConfigurationHandlerTest, CreateConfiguration) {
481 std::string networkName = "MyNetwork"; 481 std::string networkName = "MyNetwork";
482 std::string key = "SSID"; 482 std::string key = "SSID";
483 std::string type = "wifi"; 483 std::string type = "wifi";
484 std::string profile = "profile path"; 484 std::string profile = "profile path";
485 base::DictionaryValue value; 485 base::DictionaryValue value;
486 shill_property_util::SetSSID(networkName, &value); 486 shill_property_util::SetSSID(networkName, &value);
487 value.SetWithoutPathExpansion(shill::kTypeProperty, new base::Value(type)); 487 value.SetStringWithoutPathExpansion(shill::kTypeProperty, type);
488 value.SetWithoutPathExpansion(shill::kProfileProperty, 488 value.SetStringWithoutPathExpansion(shill::kProfileProperty, profile);
489 new base::Value(profile));
490 489
491 EXPECT_CALL(*mock_manager_client_, 490 EXPECT_CALL(*mock_manager_client_,
492 ConfigureServiceForProfile(dbus::ObjectPath(profile), _, _, _)) 491 ConfigureServiceForProfile(dbus::ObjectPath(profile), _, _, _))
493 .WillOnce( 492 .WillOnce(
494 Invoke(this, &NetworkConfigurationHandlerTest::OnConfigureService)); 493 Invoke(this, &NetworkConfigurationHandlerTest::OnConfigureService));
495 CreateConfiguration("/service/2", value); 494 CreateConfiguration("/service/2", value);
496 base::RunLoop().RunUntilIdle(); 495 base::RunLoop().RunUntilIdle();
497 } 496 }
498 497
499 TEST_F(NetworkConfigurationHandlerTest, RemoveConfiguration) { 498 TEST_F(NetworkConfigurationHandlerTest, RemoveConfiguration) {
500 std::string service_path = "/service/2"; 499 std::string service_path = "/service/2";
501 500
502 // Set up network configuration so the associated network service has the 501 // Set up network configuration so the associated network service has the
503 // profile path set to |profile|. 502 // profile path set to |profile|.
504 std::string key = "SSID"; 503 std::string key = "SSID";
505 std::string type = "wifi"; 504 std::string type = "wifi";
506 base::DictionaryValue value; 505 base::DictionaryValue value;
507 shill_property_util::SetSSID("Service", &value); 506 shill_property_util::SetSSID("Service", &value);
508 value.SetWithoutPathExpansion(shill::kTypeProperty, new base::Value(type)); 507 value.SetStringWithoutPathExpansion(shill::kTypeProperty, type);
509 value.SetWithoutPathExpansion(shill::kProfileProperty, 508 value.SetStringWithoutPathExpansion(shill::kProfileProperty, "profile2");
510 new base::Value("profile2"));
511 EXPECT_CALL(*mock_manager_client_, 509 EXPECT_CALL(*mock_manager_client_,
512 ConfigureServiceForProfile(dbus::ObjectPath("profile2"), _, _, _)) 510 ConfigureServiceForProfile(dbus::ObjectPath("profile2"), _, _, _))
513 .WillOnce( 511 .WillOnce(
514 Invoke(this, &NetworkConfigurationHandlerTest::OnConfigureService)); 512 Invoke(this, &NetworkConfigurationHandlerTest::OnConfigureService));
515 513
516 dictionary_value_result_ = &value; 514 dictionary_value_result_ = &value;
517 EXPECT_CALL(*mock_service_client_, GetProperties(_, _)) 515 EXPECT_CALL(*mock_service_client_, GetProperties(_, _))
518 .WillRepeatedly( 516 .WillRepeatedly(
519 Invoke(this, &NetworkConfigurationHandlerTest::OnGetProperties)); 517 Invoke(this, &NetworkConfigurationHandlerTest::OnGetProperties));
520 518
(...skipping 28 matching lines...) Expand all
549 547
550 TEST_F(NetworkConfigurationHandlerTest, RemoveConfigurationFromCurrentProfile) { 548 TEST_F(NetworkConfigurationHandlerTest, RemoveConfigurationFromCurrentProfile) {
551 std::string service_path = "/service/2"; 549 std::string service_path = "/service/2";
552 550
553 // Set up network configuration so the associated network service has the 551 // Set up network configuration so the associated network service has the
554 // profile path set to |profile|. 552 // profile path set to |profile|.
555 std::string key = "SSID"; 553 std::string key = "SSID";
556 std::string type = "wifi"; 554 std::string type = "wifi";
557 base::DictionaryValue value; 555 base::DictionaryValue value;
558 shill_property_util::SetSSID("Service", &value); 556 shill_property_util::SetSSID("Service", &value);
559 value.SetWithoutPathExpansion(shill::kTypeProperty, new base::Value(type)); 557 value.SetStringWithoutPathExpansion(shill::kTypeProperty, type);
560 value.SetWithoutPathExpansion(shill::kProfileProperty, 558 value.SetStringWithoutPathExpansion(shill::kProfileProperty, "profile2");
561 new base::Value("profile2"));
562 EXPECT_CALL(*mock_manager_client_, 559 EXPECT_CALL(*mock_manager_client_,
563 ConfigureServiceForProfile(dbus::ObjectPath("profile2"), _, _, _)) 560 ConfigureServiceForProfile(dbus::ObjectPath("profile2"), _, _, _))
564 .WillOnce( 561 .WillOnce(
565 Invoke(this, &NetworkConfigurationHandlerTest::OnConfigureService)); 562 Invoke(this, &NetworkConfigurationHandlerTest::OnConfigureService));
566 563
567 dictionary_value_result_ = &value; 564 dictionary_value_result_ = &value;
568 EXPECT_CALL(*mock_service_client_, GetProperties(_, _)) 565 EXPECT_CALL(*mock_service_client_, GetProperties(_, _))
569 .WillRepeatedly( 566 .WillRepeatedly(
570 Invoke(this, &NetworkConfigurationHandlerTest::OnGetProperties)); 567 Invoke(this, &NetworkConfigurationHandlerTest::OnGetProperties));
571 568
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 EXPECT_FALSE(test_observer->HasConfiguration(service_path)); 912 EXPECT_FALSE(test_observer->HasConfiguration(service_path));
916 EXPECT_FALSE(test_observer->HasConfigurationInProfile( 913 EXPECT_FALSE(test_observer->HasConfigurationInProfile(
917 service_path, NetworkProfileHandler::GetSharedProfilePath())); 914 service_path, NetworkProfileHandler::GetSharedProfilePath()));
918 EXPECT_FALSE( 915 EXPECT_FALSE(
919 test_observer->HasConfigurationInProfile(service_path, user_profile)); 916 test_observer->HasConfigurationInProfile(service_path, user_profile));
920 917
921 network_configuration_handler_->RemoveObserver(test_observer.get()); 918 network_configuration_handler_->RemoveObserver(test_observer.get());
922 } 919 }
923 920
924 } // namespace chromeos 921 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/managed_network_configuration_handler_unittest.cc ('k') | chromeos/network/network_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698