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