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 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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", |
661 "wifi1" /* name */, | 661 "wifi1" /* name */, |
662 shill::kTypeWifi, | 662 shill::kTypeWifi, |
663 state, | 663 state, |
664 add_to_visible); | 664 add_to_visible); |
665 services->SetServiceProperty(kWifi1Path, | 665 services->SetServiceProperty(kWifi1Path, |
666 shill::kSecurityProperty, | 666 shill::kSecurityClassProperty, |
667 base::StringValue(shill::kSecurityWep)); | 667 base::StringValue(shill::kSecurityWep)); |
668 services->SetServiceProperty(kWifi1Path, | 668 services->SetServiceProperty(kWifi1Path, |
669 shill::kConnectableProperty, | 669 shill::kConnectableProperty, |
670 base::FundamentalValue(true)); | 670 base::FundamentalValue(true)); |
671 profiles->AddService(shared_profile, kWifi1Path); | 671 profiles->AddService(shared_profile, kWifi1Path); |
672 | 672 |
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::kSecurityProperty, | 681 shill::kSecurityClassProperty, |
682 base::StringValue(shill::kSecurityPsk)); | 682 base::StringValue(shill::kSecurityPsk)); |
683 | 683 |
684 base::FundamentalValue strength_value(80); | 684 base::FundamentalValue strength_value(80); |
685 services->SetServiceProperty( | 685 services->SetServiceProperty( |
686 kWifi2Path, shill::kSignalStrengthProperty, strength_value); | 686 kWifi2Path, shill::kSignalStrengthProperty, strength_value); |
687 profiles->AddService(shared_profile, kWifi2Path); | 687 profiles->AddService(shared_profile, kWifi2Path); |
688 | 688 |
689 if (portaled) { | 689 if (portaled) { |
690 const std::string kPortaledWifiPath = "/service/portaled_wifi"; | 690 const std::string kPortaledWifiPath = "/service/portaled_wifi"; |
691 services->AddService(kPortaledWifiPath, | 691 services->AddService(kPortaledWifiPath, |
692 "portaled_wifi_guid", | 692 "portaled_wifi_guid", |
693 "Portaled Wifi" /* name */, | 693 "Portaled Wifi" /* name */, |
694 shill::kTypeWifi, | 694 shill::kTypeWifi, |
695 shill::kStatePortal, | 695 shill::kStatePortal, |
696 add_to_visible); | 696 add_to_visible); |
697 services->SetServiceProperty(kPortaledWifiPath, | 697 services->SetServiceProperty(kPortaledWifiPath, |
698 shill::kSecurityProperty, | 698 shill::kSecurityClassProperty, |
699 base::StringValue(shill::kSecurityNone)); | 699 base::StringValue(shill::kSecurityNone)); |
700 services->SetConnectBehavior(kPortaledWifiPath, | 700 services->SetConnectBehavior(kPortaledWifiPath, |
701 base::Bind(&UpdatePortaledWifiState, | 701 base::Bind(&UpdatePortaledWifiState, |
702 "portaled_wifi")); | 702 "portaled_wifi")); |
703 services->SetServiceProperty(kPortaledWifiPath, | 703 services->SetServiceProperty(kPortaledWifiPath, |
704 shill::kConnectableProperty, | 704 shill::kConnectableProperty, |
705 base::FundamentalValue(true)); | 705 base::FundamentalValue(true)); |
706 profiles->AddService(shared_profile, kPortaledWifiPath); | 706 profiles->AddService(shared_profile, kPortaledWifiPath); |
707 } | 707 } |
708 } | 708 } |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 *enabled = true; | 1101 *enabled = true; |
1102 if ((state == shill::kStatePortal && type != shill::kTypeWifi) || | 1102 if ((state == shill::kStatePortal && type != shill::kTypeWifi) || |
1103 (state == kNetworkActivated && type != shill::kTypeCellular)) { | 1103 (state == kNetworkActivated && type != shill::kTypeCellular)) { |
1104 LOG(WARNING) << "Invalid state: " << state << " for " << type; | 1104 LOG(WARNING) << "Invalid state: " << state << " for " << type; |
1105 return shill::kStateIdle; | 1105 return shill::kStateIdle; |
1106 } | 1106 } |
1107 return state; | 1107 return state; |
1108 } | 1108 } |
1109 | 1109 |
1110 } // namespace chromeos | 1110 } // namespace chromeos |
OLD | NEW |