| 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 manager_test->RemoveTechnology(shill::kTypeWimax); | 290 manager_test->RemoveTechnology(shill::kTypeWimax); |
| 291 message_loop_.RunUntilIdle(); | 291 message_loop_.RunUntilIdle(); |
| 292 EXPECT_EQ( | 292 EXPECT_EQ( |
| 293 NetworkStateHandler::TECHNOLOGY_UNAVAILABLE, | 293 NetworkStateHandler::TECHNOLOGY_UNAVAILABLE, |
| 294 network_state_handler_->GetTechnologyState(NetworkTypePattern::Wimax())); | 294 network_state_handler_->GetTechnologyState(NetworkTypePattern::Wimax())); |
| 295 } | 295 } |
| 296 | 296 |
| 297 TEST_F(NetworkStateHandlerTest, ServicePropertyChanged) { | 297 TEST_F(NetworkStateHandlerTest, ServicePropertyChanged) { |
| 298 // Set a service property. | 298 // Set a service property. |
| 299 const std::string eth1 = kShillManagerClientStubDefaultService; | 299 const std::string eth1 = kShillManagerClientStubDefaultService; |
| 300 EXPECT_EQ("", network_state_handler_->GetNetworkState(eth1)->security()); | 300 const NetworkState* ethernet = network_state_handler_->GetNetworkState(eth1); |
| 301 ASSERT_TRUE(ethernet); |
| 302 EXPECT_EQ("", ethernet->security()); |
| 301 EXPECT_EQ(1, test_observer_->PropertyUpdatesForService(eth1)); | 303 EXPECT_EQ(1, test_observer_->PropertyUpdatesForService(eth1)); |
| 302 base::StringValue security_value("TestSecurity"); | 304 base::StringValue security_value("TestSecurity"); |
| 303 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( | 305 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( |
| 304 dbus::ObjectPath(eth1), | 306 dbus::ObjectPath(eth1), |
| 305 shill::kSecurityProperty, security_value, | 307 shill::kSecurityProperty, security_value, |
| 306 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); | 308 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); |
| 307 message_loop_.RunUntilIdle(); | 309 message_loop_.RunUntilIdle(); |
| 308 EXPECT_EQ("TestSecurity", | 310 ethernet = network_state_handler_->GetNetworkState(eth1); |
| 309 network_state_handler_->GetNetworkState(eth1)->security()); | 311 EXPECT_EQ("TestSecurity", ethernet->security()); |
| 310 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService(eth1)); | 312 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService(eth1)); |
| 311 | 313 |
| 312 // Changing a service to the existing value should not trigger an update. | 314 // Changing a service to the existing value should not trigger an update. |
| 313 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( | 315 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( |
| 314 dbus::ObjectPath(eth1), | 316 dbus::ObjectPath(eth1), |
| 315 shill::kSecurityProperty, security_value, | 317 shill::kSecurityProperty, security_value, |
| 316 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); | 318 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); |
| 317 message_loop_.RunUntilIdle(); | 319 message_loop_.RunUntilIdle(); |
| 318 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService(eth1)); | 320 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService(eth1)); |
| 319 } | 321 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 // Other networks should have 2 updates (inital + request). | 412 // Other networks should have 2 updates (inital + request). |
| 411 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService( | 413 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService( |
| 412 kShillManagerClientStubDefaultService)); | 414 kShillManagerClientStubDefaultService)); |
| 413 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService( | 415 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService( |
| 414 kShillManagerClientStubWireless2)); | 416 kShillManagerClientStubWireless2)); |
| 415 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService( | 417 EXPECT_EQ(2, test_observer_->PropertyUpdatesForService( |
| 416 kShillManagerClientStubCellular)); | 418 kShillManagerClientStubCellular)); |
| 417 } | 419 } |
| 418 | 420 |
| 419 } // namespace chromeos | 421 } // namespace chromeos |
| OLD | NEW |