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/shill_property_handler.h" | 5 #include "chromeos/network/shill_property_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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 AddPropertyUpdate(shill::kServicesProperty, service_path); | 62 AddPropertyUpdate(shill::kServicesProperty, service_path); |
63 } | 63 } |
64 | 64 |
65 virtual void UpdateDeviceProperty( | 65 virtual void UpdateDeviceProperty( |
66 const std::string& device_path, | 66 const std::string& device_path, |
67 const std::string& key, | 67 const std::string& key, |
68 const base::Value& value) OVERRIDE { | 68 const base::Value& value) OVERRIDE { |
69 AddPropertyUpdate(shill::kDevicesProperty, device_path); | 69 AddPropertyUpdate(shill::kDevicesProperty, device_path); |
70 } | 70 } |
71 | 71 |
| 72 virtual void UpdateIPConfigProperties( |
| 73 ManagedState::ManagedType type, |
| 74 const std::string& path, |
| 75 const std::string& ip_config_path, |
| 76 const base::DictionaryValue& properties) OVERRIDE { |
| 77 AddPropertyUpdate(shill::kIPConfigsProperty, ip_config_path); |
| 78 } |
| 79 |
72 virtual void TechnologyListChanged() OVERRIDE { | 80 virtual void TechnologyListChanged() OVERRIDE { |
73 ++technology_list_updates_; | 81 ++technology_list_updates_; |
74 } | 82 } |
75 | 83 |
76 virtual void CheckPortalListChanged( | 84 virtual void CheckPortalListChanged( |
77 const std::string& check_portal_list) OVERRIDE { | 85 const std::string& check_portal_list) OVERRIDE { |
78 } | 86 } |
79 | 87 |
80 virtual void ManagedStateListChanged( | 88 virtual void ManagedStateListChanged( |
81 ManagedState::ManagedType type) OVERRIDE { | 89 ManagedState::ManagedType type) OVERRIDE { |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 message_loop_.RunUntilIdle(); | 464 message_loop_.RunUntilIdle(); |
457 // This is the initial property update. | 465 // This is the initial property update. |
458 EXPECT_EQ(1, listener_->initial_property_updates( | 466 EXPECT_EQ(1, listener_->initial_property_updates( |
459 shill::kServicesProperty)[kTestServicePath1]); | 467 shill::kServicesProperty)[kTestServicePath1]); |
460 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( | 468 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( |
461 dbus::ObjectPath(kTestServicePath1), | 469 dbus::ObjectPath(kTestServicePath1), |
462 shill::kIPConfigProperty, | 470 shill::kIPConfigProperty, |
463 base::StringValue(kTestIPConfigPath), | 471 base::StringValue(kTestIPConfigPath), |
464 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); | 472 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); |
465 message_loop_.RunUntilIdle(); | 473 message_loop_.RunUntilIdle(); |
466 // IPConfig property change on the service should trigger property updates for | 474 // IPConfig property change on the service should trigger an IPConfigs update. |
467 // IP Address, DNS, prefixlen, and gateway. | 475 EXPECT_EQ(1, listener_->property_updates( |
468 EXPECT_EQ(4, listener_->property_updates( | 476 shill::kIPConfigsProperty)[kTestIPConfigPath]); |
469 shill::kServicesProperty)[kTestServicePath1]); | |
470 | 477 |
471 // Now, Add a new watched service with the IPConfig already set. | 478 // Now, Add a new watched service with the IPConfig already set. |
472 const std::string kTestServicePath2("test_wifi_service2"); | 479 const std::string kTestServicePath2("test_wifi_service2"); |
473 AddServiceWithIPConfig(shill::kTypeWifi, kTestServicePath2, | 480 AddServiceWithIPConfig(shill::kTypeWifi, kTestServicePath2, |
474 shill::kStateIdle, kTestIPConfigPath, true); | 481 shill::kStateIdle, kTestIPConfigPath, true); |
475 message_loop_.RunUntilIdle(); | 482 message_loop_.RunUntilIdle(); |
476 // A watched service with the IPConfig property already set must trigger | 483 // A watched service with the IPConfig property already set should trigger an |
477 // property updates for IP Address, DNS, prefixlen, and gateway when added. | 484 // additional IPConfigs update. |
478 EXPECT_EQ(4, listener_->property_updates( | 485 EXPECT_EQ(2, listener_->property_updates( |
479 shill::kServicesProperty)[kTestServicePath2]); | 486 shill::kIPConfigsProperty)[kTestIPConfigPath]); |
480 } | 487 } |
481 | 488 |
482 TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerServiceCompleteList) { | 489 TEST_F(ShillPropertyHandlerTest, ShillPropertyHandlerServiceCompleteList) { |
483 // Add a new entry to the profile only (triggers a Services update). | 490 // Add a new entry to the profile only (triggers a Services update). |
484 const std::string kTestServicePath1("stub_wifi_profile_only1"); | 491 const std::string kTestServicePath1("stub_wifi_profile_only1"); |
485 AddServiceToProfile(shill::kTypeWifi, kTestServicePath1, false); | 492 AddServiceToProfile(shill::kTypeWifi, kTestServicePath1, false); |
486 message_loop_.RunUntilIdle(); | 493 message_loop_.RunUntilIdle(); |
487 | 494 |
488 // Update the Manager properties. This should trigger a single list update | 495 // Update the Manager properties. This should trigger a single list update |
489 // for both Services and ServiceCompleteList, and a single property update | 496 // for both Services and ServiceCompleteList, and a single property update |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 message_loop_.RunUntilIdle(); | 541 message_loop_.RunUntilIdle(); |
535 // Property change should trigger an update for the Network only; no | 542 // Property change should trigger an update for the Network only; no |
536 // property updates pushed by Shill affect Favorites. | 543 // property updates pushed by Shill affect Favorites. |
537 EXPECT_EQ(2, listener_->property_updates( | 544 EXPECT_EQ(2, listener_->property_updates( |
538 shill::kServicesProperty)[kTestServicePath2]); | 545 shill::kServicesProperty)[kTestServicePath2]); |
539 EXPECT_EQ(0, listener_->property_updates( | 546 EXPECT_EQ(0, listener_->property_updates( |
540 shill::kServiceCompleteListProperty)[kTestServicePath2]); | 547 shill::kServiceCompleteListProperty)[kTestServicePath2]); |
541 } | 548 } |
542 | 549 |
543 } // namespace chromeos | 550 } // namespace chromeos |
OLD | NEW |