| 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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 DCHECK(ip_configs); | 585 DCHECK(ip_configs); |
| 586 | 586 |
| 587 const std::string shared_profile = ShillProfileClient::GetSharedProfilePath(); | 587 const std::string shared_profile = ShillProfileClient::GetSharedProfilePath(); |
| 588 profiles->AddProfile(shared_profile, std::string()); | 588 profiles->AddProfile(shared_profile, std::string()); |
| 589 | 589 |
| 590 const bool add_to_visible = true; | 590 const bool add_to_visible = true; |
| 591 | 591 |
| 592 // IPConfigs | 592 // IPConfigs |
| 593 base::DictionaryValue ipconfig_v4_dictionary; | 593 base::DictionaryValue ipconfig_v4_dictionary; |
| 594 ipconfig_v4_dictionary.SetStringWithoutPathExpansion( | 594 ipconfig_v4_dictionary.SetStringWithoutPathExpansion( |
| 595 shill::kAddressProperty, "0.0.0.0"); | 595 shill::kAddressProperty, "100.0.0.1"); |
| 596 ipconfig_v4_dictionary.SetStringWithoutPathExpansion( | 596 ipconfig_v4_dictionary.SetStringWithoutPathExpansion( |
| 597 shill::kGatewayProperty, "0.0.0.1"); | 597 shill::kGatewayProperty, "100.0.0.2"); |
| 598 ipconfig_v4_dictionary.SetIntegerWithoutPathExpansion( | 598 ipconfig_v4_dictionary.SetIntegerWithoutPathExpansion( |
| 599 shill::kPrefixlenProperty, 1); | 599 shill::kPrefixlenProperty, 1); |
| 600 ipconfig_v4_dictionary.SetStringWithoutPathExpansion( | 600 ipconfig_v4_dictionary.SetStringWithoutPathExpansion( |
| 601 shill::kMethodProperty, shill::kTypeIPv4); | 601 shill::kMethodProperty, shill::kTypeIPv4); |
| 602 ip_configs->AddIPConfig("ipconfig_v4_path", ipconfig_v4_dictionary); | 602 ip_configs->AddIPConfig("ipconfig_v4_path", ipconfig_v4_dictionary); |
| 603 base::DictionaryValue ipconfig_v6_dictionary; | 603 base::DictionaryValue ipconfig_v6_dictionary; |
| 604 ipconfig_v6_dictionary.SetStringWithoutPathExpansion( | 604 ipconfig_v6_dictionary.SetStringWithoutPathExpansion( |
| 605 shill::kAddressProperty, "0:0:0:0:0:0:0:0"); | 605 shill::kAddressProperty, "0:0:0:0:100:0:0:1"); |
| 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 bool enabled; | 610 bool enabled; |
| 611 std::string state; | 611 std::string state; |
| 612 | 612 |
| 613 // Ethernet | 613 // Ethernet |
| 614 state = GetInitialStateForType(shill::kTypeEthernet, &enabled); | 614 state = GetInitialStateForType(shill::kTypeEthernet, &enabled); |
| 615 if (state == shill::kStateOnline) { | 615 if (state == shill::kStateOnline) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 640 if (state != kTechnologyUnavailable) { | 640 if (state != kTechnologyUnavailable) { |
| 641 bool portaled = false; | 641 bool portaled = false; |
| 642 if (state == shill::kStatePortal) { | 642 if (state == shill::kStatePortal) { |
| 643 portaled = true; | 643 portaled = true; |
| 644 state = shill::kStateIdle; | 644 state = shill::kStateIdle; |
| 645 } | 645 } |
| 646 AddTechnology(shill::kTypeWifi, enabled); | 646 AddTechnology(shill::kTypeWifi, enabled); |
| 647 devices->AddDevice("/device/wifi1", shill::kTypeWifi, "stub_wifi_device1"); | 647 devices->AddDevice("/device/wifi1", shill::kTypeWifi, "stub_wifi_device1"); |
| 648 devices->SetDeviceProperty("/device/wifi1", | 648 devices->SetDeviceProperty("/device/wifi1", |
| 649 shill::kAddressProperty, | 649 shill::kAddressProperty, |
| 650 base::StringValue("23456789abc")); | 650 base::StringValue("23456789abcd")); |
| 651 base::ListValue wifi_ip_configs; | 651 base::ListValue wifi_ip_configs; |
| 652 wifi_ip_configs.AppendString("ipconfig_v4_path"); | 652 wifi_ip_configs.AppendString("ipconfig_v4_path"); |
| 653 wifi_ip_configs.AppendString("ipconfig_v6_path"); | 653 wifi_ip_configs.AppendString("ipconfig_v6_path"); |
| 654 devices->SetDeviceProperty("/device/wifi1", | 654 devices->SetDeviceProperty("/device/wifi1", |
| 655 shill::kIPConfigsProperty, | 655 shill::kIPConfigsProperty, |
| 656 wifi_ip_configs); | 656 wifi_ip_configs); |
| 657 | 657 |
| 658 const std::string kWifi1Path = "/service/wifi1"; | 658 const std::string kWifi1Path = "/service/wifi1"; |
| 659 services->AddService(kWifi1Path, | 659 services->AddService(kWifi1Path, |
| 660 "wifi1_guid", | 660 "wifi1_guid", |
| (...skipping 12 matching lines...) Expand all Loading... |
| 673 const std::string kWifi2Path = "/service/wifi2"; | 673 const std::string kWifi2Path = "/service/wifi2"; |
| 674 services->AddService(kWifi2Path, | 674 services->AddService(kWifi2Path, |
| 675 "wifi2_PSK_guid", | 675 "wifi2_PSK_guid", |
| 676 "wifi2_PSK" /* name */, | 676 "wifi2_PSK" /* name */, |
| 677 shill::kTypeWifi, | 677 shill::kTypeWifi, |
| 678 shill::kStateIdle, | 678 shill::kStateIdle, |
| 679 add_to_visible); | 679 add_to_visible); |
| 680 services->SetServiceProperty(kWifi2Path, | 680 services->SetServiceProperty(kWifi2Path, |
| 681 shill::kSecurityClassProperty, | 681 shill::kSecurityClassProperty, |
| 682 base::StringValue(shill::kSecurityPsk)); | 682 base::StringValue(shill::kSecurityPsk)); |
| 683 services->SetServiceProperty( |
| 684 kWifi2Path, shill::kSignalStrengthProperty, base::FundamentalValue(80)); |
| 685 profiles->AddService(shared_profile, kWifi2Path); |
| 683 | 686 |
| 684 base::FundamentalValue strength_value(80); | 687 const std::string kWifi3Path = "/service/wifi3"; |
| 688 services->AddService(kWifi3Path, |
| 689 "", /* empty GUID */ |
| 690 "wifi3" /* name */, |
| 691 shill::kTypeWifi, |
| 692 shill::kStateIdle, |
| 693 add_to_visible); |
| 685 services->SetServiceProperty( | 694 services->SetServiceProperty( |
| 686 kWifi2Path, shill::kSignalStrengthProperty, strength_value); | 695 kWifi3Path, shill::kSignalStrengthProperty, base::FundamentalValue(40)); |
| 687 profiles->AddService(shared_profile, kWifi2Path); | |
| 688 | 696 |
| 689 if (portaled) { | 697 if (portaled) { |
| 690 const std::string kPortaledWifiPath = "/service/portaled_wifi"; | 698 const std::string kPortaledWifiPath = "/service/portaled_wifi"; |
| 691 services->AddService(kPortaledWifiPath, | 699 services->AddService(kPortaledWifiPath, |
| 692 "portaled_wifi_guid", | 700 "portaled_wifi_guid", |
| 693 "Portaled Wifi" /* name */, | 701 "Portaled Wifi" /* name */, |
| 694 shill::kTypeWifi, | 702 shill::kTypeWifi, |
| 695 shill::kStatePortal, | 703 shill::kStatePortal, |
| 696 add_to_visible); | 704 add_to_visible); |
| 697 services->SetServiceProperty(kPortaledWifiPath, | 705 services->SetServiceProperty(kPortaledWifiPath, |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 *enabled = true; | 1109 *enabled = true; |
| 1102 if ((state == shill::kStatePortal && type != shill::kTypeWifi) || | 1110 if ((state == shill::kStatePortal && type != shill::kTypeWifi) || |
| 1103 (state == kNetworkActivated && type != shill::kTypeCellular)) { | 1111 (state == kNetworkActivated && type != shill::kTypeCellular)) { |
| 1104 LOG(WARNING) << "Invalid state: " << state << " for " << type; | 1112 LOG(WARNING) << "Invalid state: " << state << " for " << type; |
| 1105 return shill::kStateIdle; | 1113 return shill::kStateIdle; |
| 1106 } | 1114 } |
| 1107 return state; | 1115 return state; |
| 1108 } | 1116 } |
| 1109 | 1117 |
| 1110 } // namespace chromeos | 1118 } // namespace chromeos |
| OLD | NEW |