summaryrefslogtreecommitdiffstats
path: root/chromeos
diff options
context:
space:
mode:
authorstevenjb <stevenjb@chromium.org>2014-09-04 19:54:14 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-05 02:57:15 +0000
commit53077e70bdcc0b651c297eb4d176edf6a86480a3 (patch)
tree9323cd9b0722bc226e3e50de7d396e243c1f09ba /chromeos
parent065e76059569294cf7813215d633090f0c1ea914 (diff)
downloadchromium_src-53077e70bdcc0b651c297eb4d176edf6a86480a3.zip
chromium_src-53077e70bdcc0b651c297eb4d176edf6a86480a3.tar.gz
chromium_src-53077e70bdcc0b651c297eb4d176edf6a86480a3.tar.bz2
Elim 'Translated' from Managed ONC dictionary
Instead of providing a 'Translated' value in managed ONC dictionaries, use a well understood naming convention. This also moves the onc helper methods to their own JS module. BUG=279351 For proxy_settings.html: TBR=xiyuan@chromium.org Review URL: https://codereview.chromium.org/539573002 Cr-Commit-Position: refs/heads/master@{#293412}
Diffstat (limited to 'chromeos')
-rw-r--r--chromeos/dbus/fake_shill_manager_client.cc17
-rw-r--r--chromeos/network/onc/onc_translation_tables.cc2
-rw-r--r--chromeos/network/onc/onc_translator_shill_to_onc.cc7
-rw-r--r--chromeos/test/data/network/translation_of_shill_l2tpipsec.onc10
4 files changed, 24 insertions, 12 deletions
diff --git a/chromeos/dbus/fake_shill_manager_client.cc b/chromeos/dbus/fake_shill_manager_client.cc
index 7b4eb61..d57917f 100644
--- a/chromeos/dbus/fake_shill_manager_client.cc
+++ b/chromeos/dbus/fake_shill_manager_client.cc
@@ -778,10 +778,10 @@ void FakeShillManagerClient::SetupDefaultEnvironment() {
// Shill, "Provider.Type", etc keys are used, but when reading the values
// "Provider" . "Type", etc keys are used. Here we are setting the values
// that will be read (by the UI, tests, etc).
- base::DictionaryValue provider_properties;
- provider_properties.SetString(shill::kTypeProperty,
- shill::kProviderOpenVpn);
- provider_properties.SetString(shill::kHostProperty, "vpn_host");
+ base::DictionaryValue provider_properties_openvpn;
+ provider_properties_openvpn.SetString(shill::kTypeProperty,
+ shill::kProviderOpenVpn);
+ provider_properties_openvpn.SetString(shill::kHostProperty, "vpn_host");
services->AddService("/service/vpn1",
"vpn1_guid",
@@ -790,9 +790,14 @@ void FakeShillManagerClient::SetupDefaultEnvironment() {
state,
add_to_visible);
services->SetServiceProperty(
- "/service/vpn1", shill::kProviderProperty, provider_properties);
+ "/service/vpn1", shill::kProviderProperty, provider_properties_openvpn);
profiles->AddService(shared_profile, "/service/vpn1");
+ base::DictionaryValue provider_properties_l2tp;
+ provider_properties_l2tp.SetString(shill::kTypeProperty,
+ shill::kProviderL2tpIpsec);
+ provider_properties_l2tp.SetString(shill::kHostProperty, "vpn_host2");
+
services->AddService("/service/vpn2",
"vpn2_guid",
"vpn2" /* name */,
@@ -800,7 +805,7 @@ void FakeShillManagerClient::SetupDefaultEnvironment() {
shill::kStateIdle,
add_to_visible);
services->SetServiceProperty(
- "/service/vpn2", shill::kProviderProperty, provider_properties);
+ "/service/vpn2", shill::kProviderProperty, provider_properties_l2tp);
}
// Additional device states
diff --git a/chromeos/network/onc/onc_translation_tables.cc b/chromeos/network/onc/onc_translation_tables.cc
index 9a538cd..f8dee0e 100644
--- a/chromeos/network/onc/onc_translation_tables.cc
+++ b/chromeos/network/onc/onc_translation_tables.cc
@@ -36,7 +36,7 @@ const FieldTranslationEntry eap_fields[] = {
{NULL}};
const FieldTranslationEntry ipsec_fields[] = {
- // Ignored by Shill, not necessary to synchronize.
+ // This field is converted during translation, see onc_translator_*.
// { ::onc::ipsec::kAuthenticationType, shill::kL2tpIpsecAuthenticationType
// },
{ ::onc::ipsec::kGroup, shill::kL2tpIpsecTunnelGroupProperty},
diff --git a/chromeos/network/onc/onc_translator_shill_to_onc.cc b/chromeos/network/onc/onc_translator_shill_to_onc.cc
index abe8468..3abb443 100644
--- a/chromeos/network/onc/onc_translator_shill_to_onc.cc
+++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc
@@ -248,6 +248,13 @@ void ShillToONCTranslator::TranslateIPsec() {
CopyPropertiesAccordingToSignature();
if (shill_dictionary_->HasKey(shill::kL2tpIpsecXauthUserProperty))
TranslateAndAddNestedObject(::onc::ipsec::kXAUTH);
+ std::string client_cert_id;
+ shill_dictionary_->GetStringWithoutPathExpansion(
+ shill::kL2tpIpsecClientCertIdProperty, &client_cert_id);
+ std::string authentication_type =
+ client_cert_id.empty() ? ::onc::ipsec::kPSK : ::onc::ipsec::kCert;
+ onc_object_->SetStringWithoutPathExpansion(::onc::ipsec::kAuthenticationType,
+ authentication_type);
}
void ShillToONCTranslator::TranslateVPN() {
diff --git a/chromeos/test/data/network/translation_of_shill_l2tpipsec.onc b/chromeos/test/data/network/translation_of_shill_l2tpipsec.onc
index 271a7182..c12a769 100644
--- a/chromeos/test/data/network/translation_of_shill_l2tpipsec.onc
+++ b/chromeos/test/data/network/translation_of_shill_l2tpipsec.onc
@@ -5,11 +5,11 @@
"Type": "L2TP-IPsec",
"Host": "some.host.org",
"IPsec": {
- // These two fields are part of the ONC (and are required). However, they
- // don't exist explicitly in the Shill dictionary. As there is no use-case
- // yet, that requires to reconstruct these fields from a Shill dictionary,
- // we don't require their translation.
- // "AuthenticationType": "PSK",
+ "AuthenticationType": "PSK",
+ // This field is part of ONC (and is required). However, it does not
+ // exist explicitly in the Shill dictionary. As there is no use-case yet
+ // that requires reconstructing this field from a Shill dictionary, we
+ // don't translate it.
// "IKEVersion": 1,
"PSK": "some_preshared_key",
"SaveCredentials": true,