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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 EXPECT_EQ(kNumShillManagerClientStubImplServices + 1, | 322 EXPECT_EQ(kNumShillManagerClientStubImplServices + 1, |
323 listener_->entries(flimflam::kServicesProperty).size()); | 323 listener_->entries(flimflam::kServicesProperty).size()); |
324 // Change a property. | 324 // Change a property. |
325 base::FundamentalValue scan_interval(3); | 325 base::FundamentalValue scan_interval(3); |
326 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( | 326 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( |
327 dbus::ObjectPath(kTestServicePath), | 327 dbus::ObjectPath(kTestServicePath), |
328 flimflam::kScanIntervalProperty, | 328 flimflam::kScanIntervalProperty, |
329 scan_interval, | 329 scan_interval, |
330 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); | 330 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); |
331 message_loop_.RunUntilIdle(); | 331 message_loop_.RunUntilIdle(); |
332 // Property change should NOT trigger an update. | 332 // Property change should trigger an update. |
333 EXPECT_EQ(0, listener_-> | |
334 property_updates(flimflam::kServicesProperty)[kTestServicePath]); | |
335 | |
336 // Add the existing service to the watch list. | |
337 AddService(flimflam::kTypeWifi, kTestServicePath, | |
338 flimflam::kStateIdle, true); | |
339 message_loop_.RunUntilIdle(); | |
340 // No new updates or services: | |
341 EXPECT_EQ(1, listener_->manager_updates()); | |
342 EXPECT_EQ(2, listener_->list_updates(flimflam::kServicesProperty)); | |
343 EXPECT_EQ(kNumShillManagerClientStubImplServices + 1, | |
344 listener_->entries(flimflam::kServicesProperty).size()); | |
345 // Change a property. | |
346 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( | |
347 dbus::ObjectPath(kTestServicePath), | |
348 flimflam::kScanIntervalProperty, | |
349 scan_interval, | |
350 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); | |
351 message_loop_.RunUntilIdle(); | |
352 // Property change SHOULD trigger an update. | |
353 EXPECT_EQ(1, listener_-> | 333 EXPECT_EQ(1, listener_-> |
354 property_updates(flimflam::kServicesProperty)[kTestServicePath]); | 334 property_updates(flimflam::kServicesProperty)[kTestServicePath]); |
355 | 335 |
356 // Remove a service | 336 // Remove a service |
357 RemoveService(kTestServicePath); | 337 RemoveService(kTestServicePath); |
358 message_loop_.RunUntilIdle(); | 338 message_loop_.RunUntilIdle(); |
359 EXPECT_EQ(3, listener_->list_updates(flimflam::kServicesProperty)); | 339 EXPECT_EQ(3, listener_->list_updates(flimflam::kServicesProperty)); |
360 EXPECT_EQ(kNumShillManagerClientStubImplServices, | 340 EXPECT_EQ(kNumShillManagerClientStubImplServices, |
361 listener_->entries(flimflam::kServicesProperty).size()); | 341 listener_->entries(flimflam::kServicesProperty).size()); |
362 | 342 |
363 EXPECT_EQ(0, listener_->errors()); | 343 EXPECT_EQ(0, listener_->errors()); |
364 } | 344 } |
365 | 345 |
366 // TODO(stevenjb): Test IP Configs. | 346 // TODO(stevenjb): Test IP Configs. |
367 | 347 |
368 } // namespace chromeos | 348 } // namespace chromeos |
OLD | NEW |