| 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 "chromeos/network/network_state_handler.h" | 5 #include "chromeos/network/network_state_handler.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 manager_test_->RemoveTechnology(shill::kTypeWimax); | 313 manager_test_->RemoveTechnology(shill::kTypeWimax); |
| 314 message_loop_.RunUntilIdle(); | 314 message_loop_.RunUntilIdle(); |
| 315 EXPECT_EQ( | 315 EXPECT_EQ( |
| 316 NetworkStateHandler::TECHNOLOGY_UNAVAILABLE, | 316 NetworkStateHandler::TECHNOLOGY_UNAVAILABLE, |
| 317 network_state_handler_->GetTechnologyState(NetworkTypePattern::Wimax())); | 317 network_state_handler_->GetTechnologyState(NetworkTypePattern::Wimax())); |
| 318 } | 318 } |
| 319 | 319 |
| 320 TEST_F(NetworkStateHandlerTest, ServicePropertyChanged) { | 320 TEST_F(NetworkStateHandlerTest, ServicePropertyChanged) { |
| 321 // Set a service property. | 321 // Set a service property. |
| 322 const std::string eth1 = kShillManagerClientStubDefaultService; | 322 const std::string eth1 = kShillManagerClientStubDefaultService; |
| 323 EXPECT_EQ("", network_state_handler_->GetNetworkState(eth1)->security()); | 323 const NetworkState* ethernet = network_state_handler_->GetNetworkState(eth1); |
| 324 ASSERT_TRUE(ethernet); |
| 325 EXPECT_EQ("", ethernet->security()); |
| 324 EXPECT_EQ(1, test_observer_->PropertyUpdatesForService(eth1)); | 326 EXPECT_EQ(1, test_observer_->PropertyUpdatesForService(eth1)); |
| 325 base::StringValue security_value("TestSecurity"); | 327 base::StringValue security_value("TestSecurity"); |
| 326 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( | 328 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( |
| 327 dbus::ObjectPath(eth1), | 329 dbus::ObjectPath(eth1), |
| 328 shill::kSecurityProperty, security_value, | 330 shill::kSecurityProperty, security_value, |
| 329 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); | 331 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); |
| 330 message_loop_.RunUntilIdle(); | 332 message_loop_.RunUntilIdle(); |
| 331 EXPECT_EQ("TestSecurity", | 333 ethernet = network_state_handler_->GetNetworkState(eth1); |
| 332 network_state_handler_->GetNetworkState(eth1)->security()); | 334 EXPECT_EQ("TestSecurity", ethernet->security()); |
| 333 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService(eth1)); | 335 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService(eth1)); |
| 334 | 336 |
| 335 // Changing a service to the existing value should not trigger an update. | 337 // Changing a service to the existing value should not trigger an update. |
| 336 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( | 338 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( |
| 337 dbus::ObjectPath(eth1), | 339 dbus::ObjectPath(eth1), |
| 338 shill::kSecurityProperty, security_value, | 340 shill::kSecurityProperty, security_value, |
| 339 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); | 341 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); |
| 340 message_loop_.RunUntilIdle(); | 342 message_loop_.RunUntilIdle(); |
| 341 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService(eth1)); | 343 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService(eth1)); |
| 342 } | 344 } |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 // Other networks should have 2 updates (inital + request). | 486 // Other networks should have 2 updates (inital + request). |
| 485 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService( | 487 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService( |
| 486 kShillManagerClientStubDefaultService)); | 488 kShillManagerClientStubDefaultService)); |
| 487 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService( | 489 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService( |
| 488 kShillManagerClientStubWireless2)); | 490 kShillManagerClientStubWireless2)); |
| 489 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService( | 491 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService( |
| 490 kShillManagerClientStubCellular)); | 492 kShillManagerClientStubCellular)); |
| 491 } | 493 } |
| 492 | 494 |
| 493 } // namespace chromeos | 495 } // namespace chromeos |
| OLD | NEW |