OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/dbus/fake_shill_manager_client.h" | 5 #include "chromeos/dbus/fake_shill_manager_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 ipconfig_v6_dictionary.SetStringWithoutPathExpansion( | 606 ipconfig_v6_dictionary.SetStringWithoutPathExpansion( |
607 shill::kMethodProperty, shill::kTypeIPv6); | 607 shill::kMethodProperty, shill::kTypeIPv6); |
608 ip_configs->AddIPConfig("ipconfig_v6_path", ipconfig_v6_dictionary); | 608 ip_configs->AddIPConfig("ipconfig_v6_path", ipconfig_v6_dictionary); |
609 | 609 |
610 // Ethernet | 610 // Ethernet |
611 state = GetInitialStateForType(shill::kTypeEthernet, &enabled); | 611 state = GetInitialStateForType(shill::kTypeEthernet, &enabled); |
612 if (state == shill::kStateOnline) { | 612 if (state == shill::kStateOnline) { |
613 AddTechnology(shill::kTypeEthernet, enabled); | 613 AddTechnology(shill::kTypeEthernet, enabled); |
614 devices->AddDevice( | 614 devices->AddDevice( |
615 "/device/eth1", shill::kTypeEthernet, "stub_eth_device1"); | 615 "/device/eth1", shill::kTypeEthernet, "stub_eth_device1"); |
| 616 devices->SetDeviceProperty("/device/eth1", |
| 617 shill::kAddressProperty, |
| 618 base::StringValue("0123456789ab")); |
616 base::ListValue eth_ip_configs; | 619 base::ListValue eth_ip_configs; |
617 eth_ip_configs.AppendString("ipconfig_v4_path"); | 620 eth_ip_configs.AppendString("ipconfig_v4_path"); |
618 eth_ip_configs.AppendString("ipconfig_v6_path"); | 621 eth_ip_configs.AppendString("ipconfig_v6_path"); |
619 devices->SetDeviceProperty("/device/eth1", | 622 devices->SetDeviceProperty("/device/eth1", |
620 shill::kIPConfigsProperty, | 623 shill::kIPConfigsProperty, |
621 eth_ip_configs); | 624 eth_ip_configs); |
622 services->AddService("eth1", "eth1", | 625 services->AddService("eth1", "eth1", |
623 shill::kTypeEthernet, | 626 shill::kTypeEthernet, |
624 state, | 627 state, |
625 add_to_visible, add_to_watchlist); | 628 add_to_visible, add_to_watchlist); |
626 profiles->AddService(shared_profile, "eth1"); | 629 profiles->AddService(shared_profile, "eth1"); |
627 } | 630 } |
628 | 631 |
629 // Wifi | 632 // Wifi |
630 state = GetInitialStateForType(shill::kTypeWifi, &enabled); | 633 state = GetInitialStateForType(shill::kTypeWifi, &enabled); |
631 if (state != kTechnologyUnavailable) { | 634 if (state != kTechnologyUnavailable) { |
632 bool portaled = false; | 635 bool portaled = false; |
633 if (state == shill::kStatePortal) { | 636 if (state == shill::kStatePortal) { |
634 portaled = true; | 637 portaled = true; |
635 state = shill::kStateIdle; | 638 state = shill::kStateIdle; |
636 } | 639 } |
637 AddTechnology(shill::kTypeWifi, enabled); | 640 AddTechnology(shill::kTypeWifi, enabled); |
638 devices->AddDevice("/device/wifi1", shill::kTypeWifi, "stub_wifi_device1"); | 641 devices->AddDevice("/device/wifi1", shill::kTypeWifi, "stub_wifi_device1"); |
| 642 devices->SetDeviceProperty("/device/wifi1", |
| 643 shill::kAddressProperty, |
| 644 base::StringValue("23456789abc")); |
639 base::ListValue wifi_ip_configs; | 645 base::ListValue wifi_ip_configs; |
640 wifi_ip_configs.AppendString("ipconfig_v4_path"); | 646 wifi_ip_configs.AppendString("ipconfig_v4_path"); |
641 wifi_ip_configs.AppendString("ipconfig_v6_path"); | 647 wifi_ip_configs.AppendString("ipconfig_v6_path"); |
642 devices->SetDeviceProperty("/device/wifi1", | 648 devices->SetDeviceProperty("/device/wifi1", |
643 shill::kIPConfigsProperty, | 649 shill::kIPConfigsProperty, |
644 wifi_ip_configs); | 650 wifi_ip_configs); |
645 | 651 |
646 services->AddService("wifi1", | 652 services->AddService("wifi1", |
647 "wifi1", | 653 "wifi1", |
648 shill::kTypeWifi, | 654 shill::kTypeWifi, |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 *enabled = true; | 1053 *enabled = true; |
1048 if ((state == shill::kStatePortal && type != shill::kTypeWifi) || | 1054 if ((state == shill::kStatePortal && type != shill::kTypeWifi) || |
1049 (state == kNetworkActivated && type != shill::kTypeCellular)) { | 1055 (state == kNetworkActivated && type != shill::kTypeCellular)) { |
1050 LOG(WARNING) << "Invalid state: " << state << " for " << type; | 1056 LOG(WARNING) << "Invalid state: " << state << " for " << type; |
1051 return shill::kStateIdle; | 1057 return shill::kStateIdle; |
1052 } | 1058 } |
1053 return state; | 1059 return state; |
1054 } | 1060 } |
1055 | 1061 |
1056 } // namespace chromeos | 1062 } // namespace chromeos |
OLD | NEW |