Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Side by Side Diff: chromeos/dbus/fake_shill_manager_client.cc

Issue 539573002: Elim 'Translated' from Managed ONC dictionary (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 base::StringValue(shill::kRoamingStateHome)); 771 base::StringValue(shill::kRoamingStateHome));
772 } 772 }
773 773
774 // VPN 774 // VPN
775 state = GetInitialStateForType(shill::kTypeVPN, &enabled); 775 state = GetInitialStateForType(shill::kTypeVPN, &enabled);
776 if (state != kTechnologyUnavailable) { 776 if (state != kTechnologyUnavailable) {
777 // Set the "Provider" dictionary properties. Note: when setting these in 777 // Set the "Provider" dictionary properties. Note: when setting these in
778 // Shill, "Provider.Type", etc keys are used, but when reading the values 778 // Shill, "Provider.Type", etc keys are used, but when reading the values
779 // "Provider" . "Type", etc keys are used. Here we are setting the values 779 // "Provider" . "Type", etc keys are used. Here we are setting the values
780 // that will be read (by the UI, tests, etc). 780 // that will be read (by the UI, tests, etc).
781 base::DictionaryValue provider_properties; 781 base::DictionaryValue provider_properties_openvpn;
782 provider_properties.SetString(shill::kTypeProperty, 782 provider_properties_openvpn.SetString(shill::kTypeProperty,
783 shill::kProviderOpenVpn); 783 shill::kProviderOpenVpn);
784 provider_properties.SetString(shill::kHostProperty, "vpn_host"); 784 provider_properties_openvpn.SetString(shill::kHostProperty, "vpn_host");
785 785
786 services->AddService("/service/vpn1", 786 services->AddService("/service/vpn1",
787 "vpn1_guid", 787 "vpn1_guid",
788 "vpn1" /* name */, 788 "vpn1" /* name */,
789 shill::kTypeVPN, 789 shill::kTypeVPN,
790 state, 790 state,
791 add_to_visible); 791 add_to_visible);
792 services->SetServiceProperty( 792 services->SetServiceProperty(
793 "/service/vpn1", shill::kProviderProperty, provider_properties); 793 "/service/vpn1", shill::kProviderProperty, provider_properties_openvpn);
794 profiles->AddService(shared_profile, "/service/vpn1"); 794 profiles->AddService(shared_profile, "/service/vpn1");
795 795
796 base::DictionaryValue provider_properties_l2tp;
797 provider_properties_l2tp.SetString(shill::kTypeProperty,
798 shill::kProviderL2tpIpsec);
799 provider_properties_l2tp.SetString(shill::kHostProperty, "vpn_host2");
800
796 services->AddService("/service/vpn2", 801 services->AddService("/service/vpn2",
797 "vpn2_guid", 802 "vpn2_guid",
798 "vpn2" /* name */, 803 "vpn2" /* name */,
799 shill::kTypeVPN, 804 shill::kTypeVPN,
800 shill::kStateIdle, 805 shill::kStateIdle,
801 add_to_visible); 806 add_to_visible);
802 services->SetServiceProperty( 807 services->SetServiceProperty(
803 "/service/vpn2", shill::kProviderProperty, provider_properties); 808 "/service/vpn2", shill::kProviderProperty, provider_properties_l2tp);
804 } 809 }
805 810
806 // Additional device states 811 // Additional device states
807 for (DevicePropertyMap::iterator iter1 = shill_device_property_map_.begin(); 812 for (DevicePropertyMap::iterator iter1 = shill_device_property_map_.begin();
808 iter1 != shill_device_property_map_.end(); ++iter1) { 813 iter1 != shill_device_property_map_.end(); ++iter1) {
809 std::string device_type = iter1->first; 814 std::string device_type = iter1->first;
810 std::string device_path = devices->GetDevicePathForType(device_type); 815 std::string device_path = devices->GetDevicePathForType(device_type);
811 for (ShillPropertyMap::iterator iter2 = iter1->second.begin(); 816 for (ShillPropertyMap::iterator iter2 = iter1->second.begin();
812 iter2 != iter1->second.end(); ++iter2) { 817 iter2 != iter1->second.end(); ++iter2) {
813 devices->SetDeviceProperty(device_path, iter2->first, *(iter2->second)); 818 devices->SetDeviceProperty(device_path, iter2->first, *(iter2->second));
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 *enabled = true; 1089 *enabled = true;
1085 if ((state == shill::kStatePortal && type != shill::kTypeWifi) || 1090 if ((state == shill::kStatePortal && type != shill::kTypeWifi) ||
1086 (state == kNetworkActivated && type != shill::kTypeCellular)) { 1091 (state == kNetworkActivated && type != shill::kTypeCellular)) {
1087 LOG(WARNING) << "Invalid state: " << state << " for " << type; 1092 LOG(WARNING) << "Invalid state: " << state << " for " << type;
1088 return shill::kStateIdle; 1093 return shill::kStateIdle;
1089 } 1094 }
1090 return state; 1095 return state;
1091 } 1096 }
1092 1097
1093 } // namespace chromeos 1098 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698