summaryrefslogtreecommitdiffstats
path: root/chromeos/network/onc
diff options
context:
space:
mode:
authorstevenjb <stevenjb@chromium.org>2015-02-25 13:05:53 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-25 21:06:34 +0000
commit00f2e618c1f54ba2403aec209ef3a5431e71bc7b (patch)
tree15453afae15be29dee2f1fc5d762071f74c70423 /chromeos/network/onc
parent1692043f72ebf8834acb8d115ba5d727610420e3 (diff)
downloadchromium_src-00f2e618c1f54ba2403aec209ef3a5431e71bc7b.zip
chromium_src-00f2e618c1f54ba2403aec209ef3a5431e71bc7b.tar.gz
chromium_src-00f2e618c1f54ba2403aec209ef3a5431e71bc7b.tar.bz2
Better support for Cellular roaming state in ONC
This CL does the following: * Eliminates "ProviderRequiresRoaming" from ONC * Adds a "required" state to "RoamingState" in ONC when ProviderRequiresRoaming is true * Adds "ONC State" to chrome://network for testing networkingPrivate.getState() * Adds support for shill_stub=roaming=[home|roaming|required] to facilitate testing on Linux BUG=461163 Review URL: https://codereview.chromium.org/948943003 Cr-Commit-Position: refs/heads/master@{#318113}
Diffstat (limited to 'chromeos/network/onc')
-rw-r--r--chromeos/network/onc/onc_signature.cc1
-rw-r--r--chromeos/network/onc/onc_translation_tables.cc6
-rw-r--r--chromeos/network/onc/onc_translator_shill_to_onc.cc38
3 files changed, 25 insertions, 20 deletions
diff --git a/chromeos/network/onc/onc_signature.cc b/chromeos/network/onc/onc_signature.cc
index dddf945..a421909 100644
--- a/chromeos/network/onc/onc_signature.cc
+++ b/chromeos/network/onc/onc_signature.cc
@@ -288,7 +288,6 @@ const OncFieldSignature cellular_with_state_fields[] = {
{ ::onc::cellular::kModelID, &kStringSignature},
{ ::onc::cellular::kNetworkTechnology, &kStringSignature},
{ ::onc::cellular::kPRLVersion, &kIntegerSignature},
- { ::onc::cellular::kProviderRequiresRoaming, &kBoolSignature},
{ ::onc::cellular::kRoamingState, &kStringSignature},
{ ::onc::cellular::kServingOperator, &kCellularProviderSignature},
{ ::onc::cellular::kSignalStrength, &kIntegerSignature},
diff --git a/chromeos/network/onc/onc_translation_tables.cc b/chromeos/network/onc/onc_translation_tables.cc
index fb16217..d81f507 100644
--- a/chromeos/network/onc/onc_translation_tables.cc
+++ b/chromeos/network/onc/onc_translation_tables.cc
@@ -320,8 +320,8 @@ const StringTranslationEntry kActivationStateTable[] = {
{NULL}};
const StringTranslationEntry kRoamingStateTable[] = {
- { ::onc::cellular::kHome, shill::kRoamingStateHome},
- { ::onc::cellular::kRoaming, shill::kRoamingStateRoaming},
+ { ::onc::cellular::kRoamingHome, shill::kRoamingStateHome},
+ { ::onc::cellular::kRoamingRoaming, shill::kRoamingStateRoaming},
{NULL}};
// This must contain only Shill Device properties and no Service properties.
@@ -347,8 +347,6 @@ const FieldTranslationEntry kCellularDeviceTable[] = {
{ ::onc::cellular::kMIN, shill::kMinProperty},
{ ::onc::cellular::kModelID, shill::kModelIDProperty},
{ ::onc::cellular::kPRLVersion, shill::kPRLVersionProperty},
- { ::onc::cellular::kProviderRequiresRoaming,
- shill::kProviderRequiresRoamingProperty},
// This field is converted during translation, see onc_translator_*.
// { ::onc::cellular::kSIMLockStatus, shill::kSIMLockStatusProperty},
{ ::onc::cellular::kSIMPresent, shill::kSIMPresentProperty},
diff --git a/chromeos/network/onc/onc_translator_shill_to_onc.cc b/chromeos/network/onc/onc_translator_shill_to_onc.cc
index 3de5f77..ac06b4e 100644
--- a/chromeos/network/onc/onc_translator_shill_to_onc.cc
+++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc
@@ -343,9 +343,6 @@ void ShillToONCTranslator::TranslateCellularWithState() {
TranslateWithTableAndSet(shill::kActivationStateProperty,
kActivationStateTable,
::onc::cellular::kActivationState);
- TranslateWithTableAndSet(shill::kRoamingStateProperty,
- kRoamingStateTable,
- ::onc::cellular::kRoamingState);
const base::DictionaryValue* dictionary = NULL;
if (shill_dictionary_->GetDictionaryWithoutPathExpansion(
shill::kServingOperatorProperty, &dictionary)) {
@@ -359,20 +356,31 @@ void ShillToONCTranslator::TranslateCellularWithState() {
shill::kCellularLastGoodApnProperty, &dictionary)) {
TranslateAndAddNestedObject(::onc::cellular::kLastGoodAPN, *dictionary);
}
- // Merge the Device dictionary with this one (Cellular) using the
- // CellularDevice signature.
const base::DictionaryValue* device_dictionary = NULL;
- if (!shill_dictionary_->GetDictionaryWithoutPathExpansion(
- shill::kDeviceProperty, &device_dictionary)) {
- return;
+ bool requires_roaming = false;
+ shill_dictionary_->GetDictionaryWithoutPathExpansion(shill::kDeviceProperty,
+ &device_dictionary);
+ if (device_dictionary) {
+ // Merge the Device dictionary with this one (Cellular) using the
+ // CellularDevice signature.
+ ShillToONCTranslator nested_translator(*device_dictionary, onc_source_,
+ kCellularWithStateSignature,
+ kCellularDeviceTable);
+ scoped_ptr<base::DictionaryValue> nested_object =
+ nested_translator.CreateTranslatedONCObject();
+ onc_object_->MergeDictionary(nested_object.get());
+
+ /// Get the requires_roaming from the Device dictionary.
+ device_dictionary->GetBooleanWithoutPathExpansion(
+ shill::kProviderRequiresRoamingProperty, &requires_roaming);
+ }
+ if (requires_roaming) {
+ onc_object_->SetStringWithoutPathExpansion(
+ ::onc::cellular::kRoamingState, ::onc::cellular::kRoamingRequired);
+ } else {
+ TranslateWithTableAndSet(shill::kRoamingStateProperty, kRoamingStateTable,
+ ::onc::cellular::kRoamingState);
}
- ShillToONCTranslator nested_translator(*device_dictionary,
- onc_source_,
- kCellularWithStateSignature,
- kCellularDeviceTable);
- scoped_ptr<base::DictionaryValue> nested_object =
- nested_translator.CreateTranslatedONCObject();
- onc_object_->MergeDictionary(nested_object.get());
}
void ShillToONCTranslator::TranslateCellularDevice() {