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

Unified Diff: chromeos/network/onc/onc_validator.cc

Issue 2844363003: [CrOS Tether] Add HasConnectedToHost property for Tether networks. (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chromeos/network/onc/onc_validator.cc
diff --git a/chromeos/network/onc/onc_validator.cc b/chromeos/network/onc/onc_validator.cc
index 41c61e6029b5b0a19f1987f5bc9b94474795584b..13b30f861a2c863b662795e69ab02e1a42828347 100644
--- a/chromeos/network/onc/onc_validator.cc
+++ b/chromeos/network/onc/onc_validator.cc
@@ -1022,19 +1022,19 @@ bool Validator::ValidateCertificate(base::DictionaryValue* result) {
bool Validator::ValidateTether(base::DictionaryValue* result) {
using namespace ::onc::tether;
- int batteryPercentage;
+ int battery_percentage;
if (!result->GetIntegerWithoutPathExpansion(kBatteryPercentage,
- &batteryPercentage) ||
- batteryPercentage < 0 || batteryPercentage > 100) {
+ &battery_percentage) ||
+ battery_percentage < 0 || battery_percentage > 100) {
// Battery percentage must be present and within [0, 100].
error_or_warning_found_ = true;
return false;
}
- int signalStrength;
+ int signal_strength;
if (!result->GetIntegerWithoutPathExpansion(kSignalStrength,
- &signalStrength) ||
- signalStrength < 0 || signalStrength > 100) {
+ &signal_strength) ||
+ signal_strength < 0 || signal_strength > 100) {
// Signal strength must be present and within [0, 100].
error_or_warning_found_ = true;
return false;
@@ -1048,8 +1048,12 @@ bool Validator::ValidateTether(base::DictionaryValue* result) {
return false;
}
- // No required fields.
- return true;
+ bool all_required_exist = RequireField(*result, kHasConnectedToHost);
+ if (!all_required_exist) {
+ error_or_warning_found_ = true;
+ }
+
+ return !error_on_missing_field_ || all_required_exist;
}
std::string Validator::MessageHeader() {

Powered by Google App Engine
This is Rietveld 408576698