summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Bennetts <stevenjb@chromium.org>2015-03-03 14:01:40 -0800
committerSteven Bennetts <stevenjb@chromium.org>2015-03-03 22:03:27 +0000
commit795108f7d1b93d9ac9f6d1cdac82cef92c2b4553 (patch)
tree7669db2a198aaefa6a066f629a52326a0f0f2d9a
parent7abcdefbdef7c1e950c01666535c0951d207951d (diff)
downloadchromium_src-795108f7d1b93d9ac9f6d1cdac82cef92c2b4553.zip
chromium_src-795108f7d1b93d9ac9f6d1cdac82cef92c2b4553.tar.gz
chromium_src-795108f7d1b93d9ac9f6d1cdac82cef92c2b4553.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 TBR=pneubeck@chromium.org Review URL: https://codereview.chromium.org/949783003 Cr-Commit-Position: refs/heads/master@{#318162} (cherry picked from commit b1754c5c8b5b939aac67e1e43b71a70c50e64bac) Review URL: https://codereview.chromium.org/975103002 Cr-Commit-Position: refs/branch-heads/2311@{#112} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474}
-rw-r--r--chrome/test/data/extensions/api_test/networking_private/chromeos/test.js4
-rw-r--r--chromeos/dbus/fake_shill_manager_client.cc20
-rw-r--r--chromeos/network/onc/onc_translation_tables.cc3
-rw-r--r--chromeos/network/onc/onc_translator_shill_to_onc.cc6
-rw-r--r--chromeos/network/onc/onc_validator.cc11
-rw-r--r--chromeos/network/onc/onc_validator_unittest.cc6
-rw-r--r--chromeos/test/data/network/shill_wimax_with_state.json2
-rw-r--r--chromeos/test/data/network/translation_of_shill_cellular_with_state.onc4
-rw-r--r--chromeos/test/data/network/translation_of_shill_wimax_with_state.onc4
9 files changed, 33 insertions, 27 deletions
diff --git a/chrome/test/data/extensions/api_test/networking_private/chromeos/test.js b/chrome/test/data/extensions/api_test/networking_private/chromeos/test.js
index d810af0..64e6ead2 100644
--- a/chrome/test/data/extensions/api_test/networking_private/chromeos/test.js
+++ b/chrome/test/data/extensions/api_test/networking_private/chromeos/test.js
@@ -331,8 +331,8 @@ var availableTests = [
"AutoConnect": true,
"Carrier": "Cellular1_Carrier",
"HomeProvider": {
- "country": "us",
- "name": "Cellular1_Provider"
+ "Country": "us",
+ "Name": "Cellular1_Provider"
},
"NetworkTechnology": "GSM",
"RoamingState": "Home"
diff --git a/chromeos/dbus/fake_shill_manager_client.cc b/chromeos/dbus/fake_shill_manager_client.cc
index d0e392f..7483470 100644
--- a/chromeos/dbus/fake_shill_manager_client.cc
+++ b/chromeos/dbus/fake_shill_manager_client.cc
@@ -726,27 +726,21 @@ void FakeShillManagerClient::SetupDefaultEnvironment() {
}
// Wimax
+ const std::string kWimaxPath = "/service/wimax1";
state = GetInitialStateForType(shill::kTypeWimax, &enabled);
if (state != kTechnologyUnavailable) {
AddTechnology(shill::kTypeWimax, enabled);
devices->AddDevice(
"/device/wimax1", shill::kTypeWimax, "stub_wimax_device1");
- services->AddService("/service/wimax1",
- "wimax1_guid",
- "wimax1" /* name */,
- shill::kTypeWimax,
- state,
- add_to_visible);
- services->SetServiceProperty("/service/wimax1",
- shill::kConnectableProperty,
+ services->AddService(kWimaxPath, "wimax1_guid", "wimax1" /* name */,
+ shill::kTypeWimax, state, add_to_visible);
+ services->SetServiceProperty(kWimaxPath, shill::kConnectableProperty,
base::FundamentalValue(true));
base::FundamentalValue strength_value(80);
- services->SetServiceProperty(
- "/service/wimax1", shill::kSignalStrengthProperty, strength_value);
- base::StringValue identity_value("test.identity");
- services->SetServiceProperty(
- "/service/wimax1", shill::kEapIdentityProperty, identity_value);
+ services->SetServiceProperty(kWimaxPath, shill::kSignalStrengthProperty,
+ strength_value);
+ profiles->AddService(shared_profile, kWimaxPath);
}
// Cellular
diff --git a/chromeos/network/onc/onc_translation_tables.cc b/chromeos/network/onc/onc_translation_tables.cc
index fb16217..f33f333 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 3de5f77..7deee45 100644
--- a/chromeos/network/onc/onc_translator_shill_to_onc.cc
+++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc
@@ -383,6 +383,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 d9c6263..d87f562 100644
--- a/chromeos/network/onc/onc_validator.cc
+++ b/chromeos/network/onc/onc_validator.cc
@@ -529,9 +529,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};
@@ -591,6 +593,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),
diff --git a/chromeos/test/data/network/shill_wimax_with_state.json b/chromeos/test/data/network/shill_wimax_with_state.json
index ececaa8..475a2dc 100644
--- a/chromeos/test/data/network/shill_wimax_with_state.json
+++ b/chromeos/test/data/network/shill_wimax_with_state.json
@@ -2,10 +2,8 @@
"AutoConnect": true,
"Connectable": true,
"Name": "SomeWiMAX",
- "EAP.Identity": "${LOGIN_ID}@my.domain.com",
"GUID": "{77db0089-0bc8-4358-929c-123xcv}",
"Profile": "/profile/someuser",
- "SaveCredentials": true,
"State": "idle",
"Strength": 10,
"Type": "wimax"
diff --git a/chromeos/test/data/network/translation_of_shill_cellular_with_state.onc b/chromeos/test/data/network/translation_of_shill_cellular_with_state.onc
index c7e175f..71847b2 100644
--- a/chromeos/test/data/network/translation_of_shill_cellular_with_state.onc
+++ b/chromeos/test/data/network/translation_of_shill_cellular_with_state.onc
@@ -8,8 +8,8 @@
"AutoConnect": true,
"Carrier": "cellular_provider",
"HomeProvider": {
- "country": "us",
- "name": "cellular_provider"
+ "Country": "us",
+ "Name": "cellular_provider"
},
"RoamingState": "Home",
"ServingOperator": {
diff --git a/chromeos/test/data/network/translation_of_shill_wimax_with_state.onc b/chromeos/test/data/network/translation_of_shill_wimax_with_state.onc
index 3be399b..c8a83f6 100644
--- a/chromeos/test/data/network/translation_of_shill_wimax_with_state.onc
+++ b/chromeos/test/data/network/translation_of_shill_wimax_with_state.onc
@@ -6,10 +6,6 @@
"Name": "SomeWiMAX",
"WiMAX": {
"AutoConnect": true,
- "EAP": {
- "Identity": "${LOGIN_ID}@my.domain.com",
- "SaveCredentials": true
- },
"SignalStrength": 10
},
"Source":"User"