diff options
author | stevenjb <stevenjb@chromium.org> | 2015-02-25 16:46:48 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-26 00:47:27 +0000 |
commit | b1754c5c8b5b939aac67e1e43b71a70c50e64bac (patch) | |
tree | 7b40c4d94b99941cd38ceddaa53ba5223e7dd703 /chromeos/network | |
parent | 1d7a6fe63bcf2373c1bfce4cb641bd19d413a58a (diff) | |
download | chromium_src-b1754c5c8b5b939aac67e1e43b71a70c50e64bac.zip chromium_src-b1754c5c8b5b939aac67e1e43b71a70c50e64bac.tar.gz chromium_src-b1754c5c8b5b939aac67e1e43b71a70c50e64bac.tar.bz2 |
Add WiMAX to ONC validation list
Currently type WiMAX fails ONC validation so any property
changes from Settings are ignored.
This also fixes the Cellular translation and adds both Cellular and WiMAX to the validation tests.
BUG=460829
Review URL: https://codereview.chromium.org/949783003
Cr-Commit-Position: refs/heads/master@{#318162}
Diffstat (limited to 'chromeos/network')
-rw-r--r-- | chromeos/network/onc/onc_translation_tables.cc | 3 | ||||
-rw-r--r-- | chromeos/network/onc/onc_translator_shill_to_onc.cc | 6 | ||||
-rw-r--r-- | chromeos/network/onc/onc_validator.cc | 11 | ||||
-rw-r--r-- | chromeos/network/onc/onc_validator_unittest.cc | 6 |
4 files changed, 22 insertions, 4 deletions
diff --git a/chromeos/network/onc/onc_translation_tables.cc b/chromeos/network/onc/onc_translation_tables.cc index d81f507..94af3ec 100644 --- a/chromeos/network/onc/onc_translation_tables.cc +++ b/chromeos/network/onc/onc_translation_tables.cc @@ -337,7 +337,8 @@ const FieldTranslationEntry kCellularDeviceTable[] = { // This field is converted during translation, see onc_translator_*. // { ::onc::cellular::kFoundNetworks, shill::kFoundNetworksProperty}, { ::onc::cellular::kHardwareRevision, shill::kHardwareRevisionProperty}, - { ::onc::cellular::kHomeProvider, shill::kHomeProviderProperty}, + // This field is converted during translation, see onc_translator_*. + // { ::onc::cellular::kHomeProvider, shill::kHomeProviderProperty}, { ::onc::cellular::kICCID, shill::kIccidProperty}, { ::onc::cellular::kIMEI, shill::kImeiProperty}, { ::onc::cellular::kIMSI, shill::kImsiProperty}, diff --git a/chromeos/network/onc/onc_translator_shill_to_onc.cc b/chromeos/network/onc/onc_translator_shill_to_onc.cc index ac06b4e..1ec647a 100644 --- a/chromeos/network/onc/onc_translator_shill_to_onc.cc +++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc @@ -391,6 +391,12 @@ void ShillToONCTranslator::TranslateCellularDevice() { TranslateAndAddNestedObject(::onc::cellular::kSIMLockStatus, *shill_sim_lock_status); } + const base::DictionaryValue* shill_home_provider = NULL; + if (shill_dictionary_->GetDictionaryWithoutPathExpansion( + shill::kHomeProviderProperty, &shill_home_provider)) { + TranslateAndAddNestedObject(::onc::cellular::kHomeProvider, + *shill_home_provider); + } const base::ListValue* shill_apns = NULL; if (shill_dictionary_->GetListWithoutPathExpansion( shill::kCellularApnListProperty, &shill_apns)) { diff --git a/chromeos/network/onc/onc_validator.cc b/chromeos/network/onc/onc_validator.cc index 43998a2..c3cd2bb 100644 --- a/chromeos/network/onc/onc_validator.cc +++ b/chromeos/network/onc/onc_validator.cc @@ -527,9 +527,11 @@ bool Validator::ValidateToplevelConfiguration(base::DictionaryValue* result) { bool Validator::ValidateNetworkConfiguration(base::DictionaryValue* result) { using namespace ::onc::network_config; - const char* const kValidTypes[] = { - ::onc::network_type::kEthernet, ::onc::network_type::kVPN, - ::onc::network_type::kWiFi, ::onc::network_type::kCellular}; + const char* const kValidTypes[] = {::onc::network_type::kEthernet, + ::onc::network_type::kVPN, + ::onc::network_type::kWiFi, + ::onc::network_type::kCellular, + ::onc::network_type::kWimax}; const std::vector<const char*> valid_types(toVector(kValidTypes)); const char* const kValidIPConfigTypes[] = {kIPConfigTypeDHCP, kIPConfigTypeStatic}; @@ -589,6 +591,9 @@ bool Validator::ValidateNetworkConfiguration(base::DictionaryValue* result) { } else if (type == ::onc::network_type::kCellular) { all_required_exist &= RequireField(*result, ::onc::network_config::kCellular); + } else if (type == ::onc::network_type::kWimax) { + all_required_exist &= + RequireField(*result, ::onc::network_config::kWimax); } else if (type == ::onc::network_type::kVPN) { all_required_exist &= RequireField(*result, ::onc::network_config::kVPN); } diff --git a/chromeos/network/onc/onc_validator_unittest.cc b/chromeos/network/onc/onc_validator_unittest.cc index ad15269..add3572 100644 --- a/chromeos/network/onc/onc_validator_unittest.cc +++ b/chromeos/network/onc/onc_validator_unittest.cc @@ -197,6 +197,12 @@ INSTANTIATE_TEST_CASE_P( OncParams("translation_of_shill_wifi_with_state.onc", &kNetworkWithStateSignature, false), + OncParams("translation_of_shill_cellular_with_state.onc", + &kNetworkWithStateSignature, + false), + OncParams("translation_of_shill_wimax_with_state.onc", + &kNetworkWithStateSignature, + false), OncParams("valid_openvpn_with_cert_pems.onc", &kNetworkConfigurationSignature, false), |