| OLD | NEW |
| 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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 base::RunLoop().RunUntilIdle(); | 472 base::RunLoop().RunUntilIdle(); |
| 473 } | 473 } |
| 474 | 474 |
| 475 TEST_F(NetworkConfigurationHandlerTest, CreateConfiguration) { | 475 TEST_F(NetworkConfigurationHandlerTest, CreateConfiguration) { |
| 476 std::string networkName = "MyNetwork"; | 476 std::string networkName = "MyNetwork"; |
| 477 std::string key = "SSID"; | 477 std::string key = "SSID"; |
| 478 std::string type = "wifi"; | 478 std::string type = "wifi"; |
| 479 std::string profile = "profile path"; | 479 std::string profile = "profile path"; |
| 480 base::DictionaryValue value; | 480 base::DictionaryValue value; |
| 481 shill_property_util::SetSSID(networkName, &value); | 481 shill_property_util::SetSSID(networkName, &value); |
| 482 value.SetWithoutPathExpansion(shill::kTypeProperty, new base::Value(type)); | 482 value.SetStringWithoutPathExpansion(shill::kTypeProperty, type); |
| 483 value.SetWithoutPathExpansion(shill::kProfileProperty, | 483 value.SetStringWithoutPathExpansion(shill::kProfileProperty, profile); |
| 484 new base::Value(profile)); | |
| 485 | 484 |
| 486 EXPECT_CALL(*mock_manager_client_, | 485 EXPECT_CALL(*mock_manager_client_, |
| 487 ConfigureServiceForProfile(dbus::ObjectPath(profile), _, _, _)) | 486 ConfigureServiceForProfile(dbus::ObjectPath(profile), _, _, _)) |
| 488 .WillOnce( | 487 .WillOnce( |
| 489 Invoke(this, &NetworkConfigurationHandlerTest::OnConfigureService)); | 488 Invoke(this, &NetworkConfigurationHandlerTest::OnConfigureService)); |
| 490 CreateConfiguration("/service/2", value); | 489 CreateConfiguration("/service/2", value); |
| 491 base::RunLoop().RunUntilIdle(); | 490 base::RunLoop().RunUntilIdle(); |
| 492 } | 491 } |
| 493 | 492 |
| 494 TEST_F(NetworkConfigurationHandlerTest, RemoveConfiguration) { | 493 TEST_F(NetworkConfigurationHandlerTest, RemoveConfiguration) { |
| 495 std::string service_path = "/service/2"; | 494 std::string service_path = "/service/2"; |
| 496 | 495 |
| 497 // Set up network configuration so the associated network service has the | 496 // Set up network configuration so the associated network service has the |
| 498 // profile path set to |profile|. | 497 // profile path set to |profile|. |
| 499 std::string key = "SSID"; | 498 std::string key = "SSID"; |
| 500 std::string type = "wifi"; | 499 std::string type = "wifi"; |
| 501 base::DictionaryValue value; | 500 base::DictionaryValue value; |
| 502 shill_property_util::SetSSID("Service", &value); | 501 shill_property_util::SetSSID("Service", &value); |
| 503 value.SetWithoutPathExpansion(shill::kTypeProperty, new base::Value(type)); | 502 value.SetStringWithoutPathExpansion(shill::kTypeProperty, type); |
| 504 value.SetWithoutPathExpansion(shill::kProfileProperty, | 503 value.SetStringWithoutPathExpansion(shill::kProfileProperty, "profile2"); |
| 505 new base::Value("profile2")); | |
| 506 EXPECT_CALL(*mock_manager_client_, | 504 EXPECT_CALL(*mock_manager_client_, |
| 507 ConfigureServiceForProfile(dbus::ObjectPath("profile2"), _, _, _)) | 505 ConfigureServiceForProfile(dbus::ObjectPath("profile2"), _, _, _)) |
| 508 .WillOnce( | 506 .WillOnce( |
| 509 Invoke(this, &NetworkConfigurationHandlerTest::OnConfigureService)); | 507 Invoke(this, &NetworkConfigurationHandlerTest::OnConfigureService)); |
| 510 | 508 |
| 511 dictionary_value_result_ = &value; | 509 dictionary_value_result_ = &value; |
| 512 EXPECT_CALL(*mock_service_client_, GetProperties(_, _)) | 510 EXPECT_CALL(*mock_service_client_, GetProperties(_, _)) |
| 513 .WillRepeatedly( | 511 .WillRepeatedly( |
| 514 Invoke(this, &NetworkConfigurationHandlerTest::OnGetProperties)); | 512 Invoke(this, &NetworkConfigurationHandlerTest::OnGetProperties)); |
| 515 | 513 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 544 | 542 |
| 545 TEST_F(NetworkConfigurationHandlerTest, RemoveConfigurationFromCurrentProfile) { | 543 TEST_F(NetworkConfigurationHandlerTest, RemoveConfigurationFromCurrentProfile) { |
| 546 std::string service_path = "/service/2"; | 544 std::string service_path = "/service/2"; |
| 547 | 545 |
| 548 // Set up network configuration so the associated network service has the | 546 // Set up network configuration so the associated network service has the |
| 549 // profile path set to |profile|. | 547 // profile path set to |profile|. |
| 550 std::string key = "SSID"; | 548 std::string key = "SSID"; |
| 551 std::string type = "wifi"; | 549 std::string type = "wifi"; |
| 552 base::DictionaryValue value; | 550 base::DictionaryValue value; |
| 553 shill_property_util::SetSSID("Service", &value); | 551 shill_property_util::SetSSID("Service", &value); |
| 554 value.SetWithoutPathExpansion(shill::kTypeProperty, new base::Value(type)); | 552 value.SetStringWithoutPathExpansion(shill::kTypeProperty, type); |
| 555 value.SetWithoutPathExpansion(shill::kProfileProperty, | 553 value.SetStringWithoutPathExpansion(shill::kProfileProperty, "profile2"); |
| 556 new base::Value("profile2")); | |
| 557 EXPECT_CALL(*mock_manager_client_, | 554 EXPECT_CALL(*mock_manager_client_, |
| 558 ConfigureServiceForProfile(dbus::ObjectPath("profile2"), _, _, _)) | 555 ConfigureServiceForProfile(dbus::ObjectPath("profile2"), _, _, _)) |
| 559 .WillOnce( | 556 .WillOnce( |
| 560 Invoke(this, &NetworkConfigurationHandlerTest::OnConfigureService)); | 557 Invoke(this, &NetworkConfigurationHandlerTest::OnConfigureService)); |
| 561 | 558 |
| 562 dictionary_value_result_ = &value; | 559 dictionary_value_result_ = &value; |
| 563 EXPECT_CALL(*mock_service_client_, GetProperties(_, _)) | 560 EXPECT_CALL(*mock_service_client_, GetProperties(_, _)) |
| 564 .WillRepeatedly( | 561 .WillRepeatedly( |
| 565 Invoke(this, &NetworkConfigurationHandlerTest::OnGetProperties)); | 562 Invoke(this, &NetworkConfigurationHandlerTest::OnGetProperties)); |
| 566 | 563 |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 EXPECT_FALSE(test_observer->HasConfiguration(service_path)); | 907 EXPECT_FALSE(test_observer->HasConfiguration(service_path)); |
| 911 EXPECT_FALSE(test_observer->HasConfigurationInProfile( | 908 EXPECT_FALSE(test_observer->HasConfigurationInProfile( |
| 912 service_path, NetworkProfileHandler::GetSharedProfilePath())); | 909 service_path, NetworkProfileHandler::GetSharedProfilePath())); |
| 913 EXPECT_FALSE( | 910 EXPECT_FALSE( |
| 914 test_observer->HasConfigurationInProfile(service_path, user_profile)); | 911 test_observer->HasConfigurationInProfile(service_path, user_profile)); |
| 915 | 912 |
| 916 network_configuration_handler_->RemoveObserver(test_observer.get()); | 913 network_configuration_handler_->RemoveObserver(test_observer.get()); |
| 917 } | 914 } |
| 918 | 915 |
| 919 } // namespace chromeos | 916 } // namespace chromeos |
| OLD | NEW |