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

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

Issue 2844363003: [CrOS Tether] Add HasConnectedToHost property for Tether networks. (Closed)
Patch Set: Rebased. 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
« no previous file with comments | « chromeos/network/onc/onc_translation_tables.cc ('k') | chromeos/network/onc/onc_validator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/onc/onc_validator.cc
diff --git a/chromeos/network/onc/onc_validator.cc b/chromeos/network/onc/onc_validator.cc
index 0968cca3795239beaa060d20a78bbd8a036a0226..cd83e3f496d6affd6af298c300b6278e100b789a 100644
--- a/chromeos/network/onc/onc_validator.cc
+++ b/chromeos/network/onc/onc_validator.cc
@@ -1008,19 +1008,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;
@@ -1034,8 +1034,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() {
« no previous file with comments | « chromeos/network/onc/onc_translation_tables.cc ('k') | chromeos/network/onc/onc_validator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698