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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "dbus/object_path.h" | 31 #include "dbus/object_path.h" |
32 #include "dbus/values_util.h" | 32 #include "dbus/values_util.h" |
33 #include "third_party/cros_system_api/dbus/service_constants.h" | 33 #include "third_party/cros_system_api/dbus/service_constants.h" |
34 | 34 |
35 namespace chromeos { | 35 namespace chromeos { |
36 | 36 |
37 namespace { | 37 namespace { |
38 | 38 |
39 // Allow parsed command line option 'tdls_busy' to set the fake busy count. | 39 // Allow parsed command line option 'tdls_busy' to set the fake busy count. |
40 int s_tdls_busy_count = 0; | 40 int s_tdls_busy_count = 0; |
41 int s_extra_wifi_networks = 0; | 41 int s_extra_wifi_networks = 20; |
42 | 42 |
43 // For testing dynamic WEP networks (uses wifi2). | 43 // For testing dynamic WEP networks (uses wifi2). |
44 bool s_dynamic_wep = false; | 44 bool s_dynamic_wep = false; |
45 | 45 |
46 // Used to compare values for finding entries to erase in a ListValue. | 46 // Used to compare values for finding entries to erase in a ListValue. |
47 // (ListValue only implements a const_iterator version of Find). | 47 // (ListValue only implements a const_iterator version of Find). |
48 struct ValueEquals { | 48 struct ValueEquals { |
49 explicit ValueEquals(const base::Value* first) : first_(first) {} | 49 explicit ValueEquals(const base::Value* first) : first_(first) {} |
50 bool operator()(const base::Value* second) const { | 50 bool operator()(const base::Value* second) const { |
51 return first_->Equals(second); | 51 return first_->Equals(second); |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 provider_properties_l2tp.SetString(shill::kHostProperty, "vpn_host2"); | 910 provider_properties_l2tp.SetString(shill::kHostProperty, "vpn_host2"); |
911 | 911 |
912 services->AddService("/service/vpn2", | 912 services->AddService("/service/vpn2", |
913 "vpn2_guid", | 913 "vpn2_guid", |
914 "vpn2" /* name */, | 914 "vpn2" /* name */, |
915 shill::kTypeVPN, | 915 shill::kTypeVPN, |
916 shill::kStateIdle, | 916 shill::kStateIdle, |
917 add_to_visible); | 917 add_to_visible); |
918 services->SetServiceProperty( | 918 services->SetServiceProperty( |
919 "/service/vpn2", shill::kProviderProperty, provider_properties_l2tp); | 919 "/service/vpn2", shill::kProviderProperty, provider_properties_l2tp); |
| 920 |
| 921 services->AddService("/service/vpn3", "vpn3_guid", "vpn3" /* name */, |
| 922 shill::kTypeVPN, shill::kStateIdle, add_to_visible); |
| 923 services->SetServiceProperty("/service/vpn3", shill::kProviderProperty, |
| 924 provider_properties_l2tp); |
| 925 |
| 926 services->AddService("/service/vpn4", "vpn4_guid", "vpn4" /* name */, |
| 927 shill::kTypeVPN, shill::kStateIdle, add_to_visible); |
| 928 services->SetServiceProperty("/service/vpn4", shill::kProviderProperty, |
| 929 provider_properties_l2tp); |
| 930 |
| 931 services->AddService("/service/vpn5", "vpn5_guid", "vpn5" /* name */, |
| 932 shill::kTypeVPN, shill::kStateIdle, add_to_visible); |
| 933 services->SetServiceProperty("/service/vpn5", shill::kProviderProperty, |
| 934 provider_properties_l2tp); |
| 935 |
| 936 services->AddService("/service/vpn6", "vpn6_guid", "vpn6" /* name */, |
| 937 shill::kTypeVPN, shill::kStateIdle, add_to_visible); |
| 938 services->SetServiceProperty("/service/vpn6", shill::kProviderProperty, |
| 939 provider_properties_l2tp); |
| 940 |
| 941 services->AddService("/service/vpn7", "vpn7_guid", "vpn7" /* name */, |
| 942 shill::kTypeVPN, shill::kStateIdle, add_to_visible); |
| 943 services->SetServiceProperty("/service/vpn7", shill::kProviderProperty, |
| 944 provider_properties_l2tp); |
| 945 |
| 946 services->AddService("/service/vpn8", "vpn8_guid", "vpn8" /* name */, |
| 947 shill::kTypeVPN, shill::kStateIdle, add_to_visible); |
| 948 services->SetServiceProperty("/service/vpn8", shill::kProviderProperty, |
| 949 provider_properties_l2tp); |
| 950 |
| 951 services->AddService("/service/vpn9", "vpn9_guid", "vpn9" /* name */, |
| 952 shill::kTypeVPN, shill::kStateIdle, add_to_visible); |
| 953 services->SetServiceProperty("/service/vpn9", shill::kProviderProperty, |
| 954 provider_properties_l2tp); |
920 } | 955 } |
921 | 956 |
922 // Additional device states | 957 // Additional device states |
923 for (DevicePropertyMap::iterator iter1 = shill_device_property_map_.begin(); | 958 for (DevicePropertyMap::iterator iter1 = shill_device_property_map_.begin(); |
924 iter1 != shill_device_property_map_.end(); ++iter1) { | 959 iter1 != shill_device_property_map_.end(); ++iter1) { |
925 std::string device_type = iter1->first; | 960 std::string device_type = iter1->first; |
926 std::string device_path = devices->GetDevicePathForType(device_type); | 961 std::string device_path = devices->GetDevicePathForType(device_type); |
927 for (ShillPropertyMap::iterator iter2 = iter1->second.begin(); | 962 for (ShillPropertyMap::iterator iter2 = iter1->second.begin(); |
928 iter2 != iter1->second.end(); ++iter2) { | 963 iter2 != iter1->second.end(); ++iter2) { |
929 devices->SetDeviceProperty(device_path, iter2->first, *(iter2->second)); | 964 devices->SetDeviceProperty(device_path, iter2->first, *(iter2->second)); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 LOG(WARNING) << "Invalid state: " << state << " for " << type; | 1270 LOG(WARNING) << "Invalid state: " << state << " for " << type; |
1236 result = shill::kStateIdle; | 1271 result = shill::kStateIdle; |
1237 } | 1272 } |
1238 } | 1273 } |
1239 VLOG(1) << "Initial state for: " << type << " = " << result | 1274 VLOG(1) << "Initial state for: " << type << " = " << result |
1240 << " Enabled: " << *enabled; | 1275 << " Enabled: " << *enabled; |
1241 return result; | 1276 return result; |
1242 } | 1277 } |
1243 | 1278 |
1244 } // namespace chromeos | 1279 } // namespace chromeos |
OLD | NEW |