Commit b14c0fa0 authored by Jon Mann's avatar Jon Mann Committed by Commit Bot

Fix format of enums in WifiConfigurationSpecificsData.

Adds an UNSPECIFIED entry to the 0 index for all enums
within the WifiConfigurationSpecificsData proto.

Bug: 966270
Change-Id: I7a6c97bb75463fd4a9346581b5a831003ceda687
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1642137
Commit-Queue: Jon Mann <jonmann@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#666146}
parent f2403bc0
...@@ -539,8 +539,10 @@ const char* ProtoEnumToString( ...@@ -539,8 +539,10 @@ const char* ProtoEnumToString(
const char* ProtoEnumToString( const char* ProtoEnumToString(
sync_pb::WifiConfigurationSpecificsData::SecurityType security_type) { sync_pb::WifiConfigurationSpecificsData::SecurityType security_type) {
ASSERT_ENUM_BOUNDS(sync_pb::WifiConfigurationSpecificsData, SecurityType, ASSERT_ENUM_BOUNDS(sync_pb::WifiConfigurationSpecificsData, SecurityType,
SECURITY_TYPE_NONE, SECURITY_TYPE_PSK); SECURITY_TYPE_UNSPECIFIED, SECURITY_TYPE_PSK);
switch (security_type) { switch (security_type) {
ENUM_CASE(sync_pb::WifiConfigurationSpecificsData,
SECURITY_TYPE_UNSPECIFIED);
ENUM_CASE(sync_pb::WifiConfigurationSpecificsData, SECURITY_TYPE_NONE); ENUM_CASE(sync_pb::WifiConfigurationSpecificsData, SECURITY_TYPE_NONE);
ENUM_CASE(sync_pb::WifiConfigurationSpecificsData, SECURITY_TYPE_WEP); ENUM_CASE(sync_pb::WifiConfigurationSpecificsData, SECURITY_TYPE_WEP);
ENUM_CASE(sync_pb::WifiConfigurationSpecificsData, SECURITY_TYPE_PSK); ENUM_CASE(sync_pb::WifiConfigurationSpecificsData, SECURITY_TYPE_PSK);
...@@ -552,10 +554,12 @@ const char* ProtoEnumToString( ...@@ -552,10 +554,12 @@ const char* ProtoEnumToString(
const char* ProtoEnumToString( const char* ProtoEnumToString(
sync_pb::WifiConfigurationSpecificsData::AutomaticallyConnectOption sync_pb::WifiConfigurationSpecificsData::AutomaticallyConnectOption
automatically_connect_option) { automatically_connect_option) {
ASSERT_ENUM_BOUNDS(sync_pb::WifiConfigurationSpecificsData, ASSERT_ENUM_BOUNDS(
AutomaticallyConnectOption, AUTOMATICALLY_CONNECT_DISABLED, sync_pb::WifiConfigurationSpecificsData, AutomaticallyConnectOption,
AUTOMATICALLY_CONNECT_ENABLED); AUTOMATICALLY_CONNECT_UNSPECIFIED, AUTOMATICALLY_CONNECT_ENABLED);
switch (automatically_connect_option) { switch (automatically_connect_option) {
ENUM_CASE(sync_pb::WifiConfigurationSpecificsData,
AUTOMATICALLY_CONNECT_UNSPECIFIED);
ENUM_CASE(sync_pb::WifiConfigurationSpecificsData, ENUM_CASE(sync_pb::WifiConfigurationSpecificsData,
AUTOMATICALLY_CONNECT_DISABLED); AUTOMATICALLY_CONNECT_DISABLED);
ENUM_CASE(sync_pb::WifiConfigurationSpecificsData, ENUM_CASE(sync_pb::WifiConfigurationSpecificsData,
...@@ -569,8 +573,10 @@ const char* ProtoEnumToString( ...@@ -569,8 +573,10 @@ const char* ProtoEnumToString(
sync_pb::WifiConfigurationSpecificsData::IsPreferredOption sync_pb::WifiConfigurationSpecificsData::IsPreferredOption
is_preferred_option) { is_preferred_option) {
ASSERT_ENUM_BOUNDS(sync_pb::WifiConfigurationSpecificsData, IsPreferredOption, ASSERT_ENUM_BOUNDS(sync_pb::WifiConfigurationSpecificsData, IsPreferredOption,
IS_PREFERRED_DISABLED, IS_PREFERRED_ENABLED); IS_PREFERRED_UNSPECIFIED, IS_PREFERRED_ENABLED);
switch (is_preferred_option) { switch (is_preferred_option) {
ENUM_CASE(sync_pb::WifiConfigurationSpecificsData,
IS_PREFERRED_UNSPECIFIED);
ENUM_CASE(sync_pb::WifiConfigurationSpecificsData, IS_PREFERRED_DISABLED); ENUM_CASE(sync_pb::WifiConfigurationSpecificsData, IS_PREFERRED_DISABLED);
ENUM_CASE(sync_pb::WifiConfigurationSpecificsData, IS_PREFERRED_ENABLED); ENUM_CASE(sync_pb::WifiConfigurationSpecificsData, IS_PREFERRED_ENABLED);
} }
...@@ -578,13 +584,30 @@ const char* ProtoEnumToString( ...@@ -578,13 +584,30 @@ const char* ProtoEnumToString(
return ""; return "";
} }
const char* ProtoEnumToString(
sync_pb::WifiConfigurationSpecificsData::MeteredOption metered_option) {
ASSERT_ENUM_BOUNDS(sync_pb::WifiConfigurationSpecificsData, MeteredOption,
METERED_OPTION_UNSPECIFIED, METERED_OPTION_AUTO);
switch (metered_option) {
ENUM_CASE(sync_pb::WifiConfigurationSpecificsData,
METERED_OPTION_UNSPECIFIED);
ENUM_CASE(sync_pb::WifiConfigurationSpecificsData, METERED_OPTION_NO);
ENUM_CASE(sync_pb::WifiConfigurationSpecificsData, METERED_OPTION_YES);
ENUM_CASE(sync_pb::WifiConfigurationSpecificsData, METERED_OPTION_AUTO);
}
NOTREACHED();
return "";
}
const char* ProtoEnumToString( const char* ProtoEnumToString(
sync_pb::WifiConfigurationSpecificsData::ProxyConfiguration::ProxyOption sync_pb::WifiConfigurationSpecificsData::ProxyConfiguration::ProxyOption
proxy_option) { proxy_option) {
ASSERT_ENUM_BOUNDS( ASSERT_ENUM_BOUNDS(
sync_pb::WifiConfigurationSpecificsData::ProxyConfiguration, ProxyOption, sync_pb::WifiConfigurationSpecificsData::ProxyConfiguration, ProxyOption,
PROXY_OPTION_DISABLED, PROXY_OPTION_MANUAL); PROXY_OPTION_UNSPECIFIED, PROXY_OPTION_MANUAL);
switch (proxy_option) { switch (proxy_option) {
ENUM_CASE(sync_pb::WifiConfigurationSpecificsData::ProxyConfiguration,
PROXY_OPTION_UNSPECIFIED);
ENUM_CASE(sync_pb::WifiConfigurationSpecificsData::ProxyConfiguration, ENUM_CASE(sync_pb::WifiConfigurationSpecificsData::ProxyConfiguration,
PROXY_OPTION_DISABLED); PROXY_OPTION_DISABLED);
ENUM_CASE(sync_pb::WifiConfigurationSpecificsData::ProxyConfiguration, ENUM_CASE(sync_pb::WifiConfigurationSpecificsData::ProxyConfiguration,
......
...@@ -42,6 +42,38 @@ TEST_F(ProtoEnumConversionsTest, GetPageTransitionQualifierString) { ...@@ -42,6 +42,38 @@ TEST_F(ProtoEnumConversionsTest, GetPageTransitionQualifierString) {
sync_pb::SyncEnums::PageTransitionRedirectType_MAX); sync_pb::SyncEnums::PageTransitionRedirectType_MAX);
} }
TEST_F(ProtoEnumConversionsTest, GetWifiConfigurationSecurityTypeString) {
TestEnumStringFunction(
sync_pb::WifiConfigurationSpecificsData::SecurityType_MIN,
sync_pb::WifiConfigurationSpecificsData::SecurityType_MAX);
}
TEST_F(ProtoEnumConversionsTest,
GetWifiConfigurationAutomaticallyConnectOptionString) {
TestEnumStringFunction(
sync_pb::WifiConfigurationSpecificsData::AutomaticallyConnectOption_MIN,
sync_pb::WifiConfigurationSpecificsData::AutomaticallyConnectOption_MAX);
}
TEST_F(ProtoEnumConversionsTest, GetWifiConfigurationIsPreferredOptionString) {
TestEnumStringFunction(
sync_pb::WifiConfigurationSpecificsData::IsPreferredOption_MIN,
sync_pb::WifiConfigurationSpecificsData::IsPreferredOption_MAX);
}
TEST_F(ProtoEnumConversionsTest, GetWifiConfigurationMeteredOptionString) {
TestEnumStringFunction(
sync_pb::WifiConfigurationSpecificsData::MeteredOption_MIN,
sync_pb::WifiConfigurationSpecificsData::MeteredOption_MAX);
}
TEST_F(ProtoEnumConversionsTest, GetWifiConfigurationProxyOptionString) {
TestEnumStringFunction(sync_pb::WifiConfigurationSpecificsData::
ProxyConfiguration::ProxyOption_MIN,
sync_pb::WifiConfigurationSpecificsData::
ProxyConfiguration::ProxyOption_MAX);
}
TEST_F(ProtoEnumConversionsTest, GetWifiCredentialSecurityClassString) { TEST_F(ProtoEnumConversionsTest, GetWifiCredentialSecurityClassString) {
TestEnumStringFunction(sync_pb::WifiCredentialSpecifics::SecurityClass_MIN, TestEnumStringFunction(sync_pb::WifiCredentialSpecifics::SecurityClass_MIN,
sync_pb::WifiCredentialSpecifics::SecurityClass_MAX); sync_pb::WifiCredentialSpecifics::SecurityClass_MAX);
......
...@@ -19,38 +19,43 @@ message WifiConfigurationSpecificsData { ...@@ -19,38 +19,43 @@ message WifiConfigurationSpecificsData {
// May contain NUL, not necessarily UTF-8 encoded. // May contain NUL, not necessarily UTF-8 encoded.
optional bytes ssid = 1; optional bytes ssid = 1;
enum SecurityType { enum SecurityType {
SECURITY_TYPE_NONE = 0; SECURITY_TYPE_UNSPECIFIED = 0;
SECURITY_TYPE_WEP = 1; SECURITY_TYPE_NONE = 1;
SECURITY_TYPE_PSK = 2; // WPA-PSK or RSN-PSK SECURITY_TYPE_WEP = 2;
SECURITY_TYPE_PSK = 3; // WPA-PSK or RSN-PSK
} }
optional SecurityType security_type = 2; optional SecurityType security_type = 2;
// The passphrase can be ASCII, UTF-8, or a string of hex digits. // The passphrase can be ASCII, UTF-8, or a string of hex digits.
optional bytes passphrase = 3; optional bytes passphrase = 3;
enum AutomaticallyConnectOption { enum AutomaticallyConnectOption {
AUTOMATICALLY_CONNECT_DISABLED = 0; AUTOMATICALLY_CONNECT_UNSPECIFIED = 0;
AUTOMATICALLY_CONNECT_ENABLED = 1; AUTOMATICALLY_CONNECT_DISABLED = 1;
AUTOMATICALLY_CONNECT_ENABLED = 2;
} }
optional AutomaticallyConnectOption automatically_connect = 4; optional AutomaticallyConnectOption automatically_connect = 4;
enum IsPreferredOption { enum IsPreferredOption {
IS_PREFERRED_DISABLED = 0; IS_PREFERRED_UNSPECIFIED = 0;
IS_PREFERRED_ENABLED = 1; IS_PREFERRED_DISABLED = 1;
IS_PREFERRED_ENABLED = 2;
} }
optional IsPreferredOption is_preferred = 5; optional IsPreferredOption is_preferred = 5;
enum MeteredOption { enum MeteredOption {
METERED_OPTION_NO = 0; METERED_OPTION_UNSPECIFIED = 0;
METERED_OPTION_YES = 1; METERED_OPTION_NO = 1;
METERED_OPTION_YES = 2;
// Allows the device to use heuristics to determine if network is metered. // Allows the device to use heuristics to determine if network is metered.
METERED_OPTION_AUTO = 2; METERED_OPTION_AUTO = 3;
} }
optional MeteredOption metered = 6; optional MeteredOption metered = 6;
message ProxyConfiguration { message ProxyConfiguration {
enum ProxyOption { enum ProxyOption {
PROXY_OPTION_DISABLED = 0; PROXY_OPTION_UNSPECIFIED = 0;
PROXY_OPTION_DISABLED = 1;
// Use a Proxy Auto-config(PAC) Url, set in proxy_url // Use a Proxy Auto-config(PAC) Url, set in proxy_url
PROXY_OPTION_AUTOMATIC = 1; PROXY_OPTION_AUTOMATIC = 2;
// Uses Web Proxy Auto-Discovery Protocol (WPAD) to discover the proxy // Uses Web Proxy Auto-Discovery Protocol (WPAD) to discover the proxy
// settings using DHCP/DNS. // settings using DHCP/DNS.
PROXY_OPTION_AUTODISCOVERY = 2; PROXY_OPTION_AUTODISCOVERY = 3;
// User sets proxy_url, proxy_port, and whitelisted_domains manually. // User sets proxy_url, proxy_port, and whitelisted_domains manually.
PROXY_OPTION_MANUAL = 4; PROXY_OPTION_MANUAL = 4;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment