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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 AddService(shill::kTypeWifi, kTestServicePath, shill::kStateIdle); | 376 AddService(shill::kTypeWifi, kTestServicePath, shill::kStateIdle); |
377 base::RunLoop().RunUntilIdle(); | 377 base::RunLoop().RunUntilIdle(); |
378 // Add should trigger a service list update and update entries. | 378 // Add should trigger a service list update and update entries. |
379 EXPECT_EQ(1, listener_->list_updates(shill::kServiceCompleteListProperty)); | 379 EXPECT_EQ(1, listener_->list_updates(shill::kServiceCompleteListProperty)); |
380 EXPECT_EQ(kNumShillManagerClientStubImplServices + 1, | 380 EXPECT_EQ(kNumShillManagerClientStubImplServices + 1, |
381 listener_->entries(shill::kServiceCompleteListProperty).size()); | 381 listener_->entries(shill::kServiceCompleteListProperty).size()); |
382 // Service receives an initial property update. | 382 // Service receives an initial property update. |
383 EXPECT_EQ(1, listener_->initial_property_updates( | 383 EXPECT_EQ(1, listener_->initial_property_updates( |
384 shill::kServiceCompleteListProperty)[kTestServicePath]); | 384 shill::kServiceCompleteListProperty)[kTestServicePath]); |
385 // Change a property. | 385 // Change a property. |
386 base::FundamentalValue scan_interval(3); | 386 base::Value scan_interval(3); |
387 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( | 387 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( |
388 dbus::ObjectPath(kTestServicePath), | 388 dbus::ObjectPath(kTestServicePath), |
389 shill::kScanIntervalProperty, | 389 shill::kScanIntervalProperty, |
390 scan_interval, | 390 scan_interval, |
391 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); | 391 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); |
392 base::RunLoop().RunUntilIdle(); | 392 base::RunLoop().RunUntilIdle(); |
393 // Property change triggers an update (but not a service list update). | 393 // Property change triggers an update (but not a service list update). |
394 EXPECT_EQ(1, listener_->property_updates( | 394 EXPECT_EQ(1, listener_->property_updates( |
395 shill::kServiceCompleteListProperty)[kTestServicePath]); | 395 shill::kServiceCompleteListProperty)[kTestServicePath]); |
396 | 396 |
397 // Change the visibility of a service. This will trigger a service list | 397 // Change the visibility of a service. This will trigger a service list |
398 // updates. | 398 // updates. |
399 listener_->reset_list_updates(); | 399 listener_->reset_list_updates(); |
400 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( | 400 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( |
401 dbus::ObjectPath(kTestServicePath), | 401 dbus::ObjectPath(kTestServicePath), shill::kVisibleProperty, |
402 shill::kVisibleProperty, | 402 base::Value(false), base::Bind(&base::DoNothing), |
403 base::FundamentalValue(false), | 403 base::Bind(&ErrorCallbackFunction)); |
404 base::Bind(&base::DoNothing), base::Bind(&ErrorCallbackFunction)); | |
405 base::RunLoop().RunUntilIdle(); | 404 base::RunLoop().RunUntilIdle(); |
406 EXPECT_EQ(1, listener_->list_updates(shill::kServiceCompleteListProperty)); | 405 EXPECT_EQ(1, listener_->list_updates(shill::kServiceCompleteListProperty)); |
407 | 406 |
408 // Remove a service. This will update the entries and signal a service list | 407 // Remove a service. This will update the entries and signal a service list |
409 // update. | 408 // update. |
410 listener_->reset_list_updates(); | 409 listener_->reset_list_updates(); |
411 RemoveService(kTestServicePath); | 410 RemoveService(kTestServicePath); |
412 base::RunLoop().RunUntilIdle(); | 411 base::RunLoop().RunUntilIdle(); |
413 EXPECT_EQ(1, listener_->list_updates(shill::kServiceCompleteListProperty)); | 412 EXPECT_EQ(1, listener_->list_updates(shill::kServiceCompleteListProperty)); |
414 EXPECT_EQ(kNumShillManagerClientStubImplServices, | 413 EXPECT_EQ(kNumShillManagerClientStubImplServices, |
(...skipping 11 matching lines...) Expand all Loading... |
426 dbus::ObjectPath(kTestIPConfigPath), | 425 dbus::ObjectPath(kTestIPConfigPath), |
427 shill::kAddressProperty, ip_address, | 426 shill::kAddressProperty, ip_address, |
428 base::Bind(&DoNothingWithCallStatus)); | 427 base::Bind(&DoNothingWithCallStatus)); |
429 base::ListValue dns_servers; | 428 base::ListValue dns_servers; |
430 dns_servers.AppendString("192.168.1.100"); | 429 dns_servers.AppendString("192.168.1.100"); |
431 dns_servers.AppendString("192.168.1.101"); | 430 dns_servers.AppendString("192.168.1.101"); |
432 DBusThreadManager::Get()->GetShillIPConfigClient()->SetProperty( | 431 DBusThreadManager::Get()->GetShillIPConfigClient()->SetProperty( |
433 dbus::ObjectPath(kTestIPConfigPath), | 432 dbus::ObjectPath(kTestIPConfigPath), |
434 shill::kNameServersProperty, dns_servers, | 433 shill::kNameServersProperty, dns_servers, |
435 base::Bind(&DoNothingWithCallStatus)); | 434 base::Bind(&DoNothingWithCallStatus)); |
436 base::FundamentalValue prefixlen(8); | 435 base::Value prefixlen(8); |
437 DBusThreadManager::Get()->GetShillIPConfigClient()->SetProperty( | 436 DBusThreadManager::Get()->GetShillIPConfigClient()->SetProperty( |
438 dbus::ObjectPath(kTestIPConfigPath), | 437 dbus::ObjectPath(kTestIPConfigPath), |
439 shill::kPrefixlenProperty, prefixlen, | 438 shill::kPrefixlenProperty, prefixlen, |
440 base::Bind(&DoNothingWithCallStatus)); | 439 base::Bind(&DoNothingWithCallStatus)); |
441 base::StringValue gateway("192.0.0.1"); | 440 base::StringValue gateway("192.0.0.1"); |
442 DBusThreadManager::Get()->GetShillIPConfigClient()->SetProperty( | 441 DBusThreadManager::Get()->GetShillIPConfigClient()->SetProperty( |
443 dbus::ObjectPath(kTestIPConfigPath), | 442 dbus::ObjectPath(kTestIPConfigPath), |
444 shill::kGatewayProperty, gateway, | 443 shill::kGatewayProperty, gateway, |
445 base::Bind(&DoNothingWithCallStatus)); | 444 base::Bind(&DoNothingWithCallStatus)); |
446 base::RunLoop().RunUntilIdle(); | 445 base::RunLoop().RunUntilIdle(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 shill_property_handler_->SetProhibitedTechnologies( | 528 shill_property_handler_->SetProhibitedTechnologies( |
530 prohibited_technologies, network_handler::ErrorCallback()); | 529 prohibited_technologies, network_handler::ErrorCallback()); |
531 shill_property_handler_->SetTechnologyEnabled( | 530 shill_property_handler_->SetTechnologyEnabled( |
532 shill::kTypeEthernet, true, network_handler::ErrorCallback()); | 531 shill::kTypeEthernet, true, network_handler::ErrorCallback()); |
533 base::RunLoop().RunUntilIdle(); | 532 base::RunLoop().RunUntilIdle(); |
534 EXPECT_TRUE( | 533 EXPECT_TRUE( |
535 shill_property_handler_->IsTechnologyEnabled(shill::kTypeEthernet)); | 534 shill_property_handler_->IsTechnologyEnabled(shill::kTypeEthernet)); |
536 } | 535 } |
537 | 536 |
538 } // namespace chromeos | 537 } // namespace chromeos |
OLD | NEW |