diff options
author | pneubeck <pneubeck@chromium.org> | 2014-09-18 08:31:40 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-18 15:31:53 +0000 |
commit | a901ffa9729db84945b44831ce2aacf48dea5bec (patch) | |
tree | c2f772baa27315aec34883a1ee80e4ba5cc260de | |
parent | ffe70eca0f81753c11052b9229128f72d49c45ea (diff) | |
download | chromium_src-a901ffa9729db84945b44831ce2aacf48dea5bec.zip chromium_src-a901ffa9729db84945b44831ce2aacf48dea5bec.tar.gz chromium_src-a901ffa9729db84945b44831ce2aacf48dea5bec.tar.bz2 |
Add Wimax to ONC.
This adds the object "WiMAX" to ONC, which contains the basic properties
AutoConnect (read/write)
EAP (write-only)
SignalStrength (read-only).
Also all general network properties like Name or ConnectionState are supported.
BUG=414417
Review URL: https://codereview.chromium.org/578823003
Cr-Commit-Position: refs/heads/master@{#295467}
-rw-r--r-- | chrome/browser/extensions/api/networking_private/networking_private_apitest.cc | 15 | ||||
-rw-r--r-- | chrome/test/data/extensions/api_test/networking/test.js | 12 | ||||
-rw-r--r-- | chromeos/network/network_state.cc | 7 | ||||
-rw-r--r-- | chromeos/network/onc/onc_signature.cc | 18 | ||||
-rw-r--r-- | chromeos/network/onc/onc_signature.h | 2 | ||||
-rw-r--r-- | chromeos/network/onc/onc_translation_tables.cc | 7 | ||||
-rw-r--r-- | chromeos/network/onc/onc_translator_shill_to_onc.cc | 5 | ||||
-rw-r--r-- | chromeos/network/onc/onc_translator_unittest.cc | 8 | ||||
-rw-r--r-- | chromeos/test/data/network/shill_wimax.json | 9 | ||||
-rw-r--r-- | chromeos/test/data/network/shill_wimax_with_state.json | 14 | ||||
-rw-r--r-- | chromeos/test/data/network/translation_of_shill_wimax_with_state.onc | 12 | ||||
-rw-r--r-- | chromeos/test/data/network/wimax.onc | 16 | ||||
-rw-r--r-- | components/onc/onc_constants.cc | 10 | ||||
-rw-r--r-- | components/onc/onc_constants.h | 8 |
14 files changed, 130 insertions, 13 deletions
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc b/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc index 196d7f6..20bf3a4 100644 --- a/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc +++ b/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc @@ -268,6 +268,9 @@ class ExtensionNetworkingPrivateApiTest // Sends a notification about the added profile. profile_test->AddProfile(kUser1ProfilePath, userhash_); + // Enable technologies. + manager_test_->AddTechnology("wimax", true); + // Add IPConfigs base::DictionaryValue ipconfig; ipconfig.SetStringWithoutPathExpansion(shill::kAddressProperty, "0.0.0.0"); @@ -335,6 +338,18 @@ class ExtensionNetworkingPrivateApiTest shill::kConnectableProperty, base::FundamentalValue(true)); + AddService("stub_wimax", "wimax", shill::kTypeWimax, shill::kStateOnline); + service_test_->SetServiceProperty("stub_wimax", + shill::kSignalStrengthProperty, + base::FundamentalValue(40)); + service_test_->SetServiceProperty("stub_wimax", + shill::kProfileProperty, + base::StringValue(kUser1ProfilePath)); + service_test_->SetServiceProperty("stub_wimax", + shill::kConnectableProperty, + base::FundamentalValue(true)); + profile_test->AddService(kUser1ProfilePath, "stub_wimax"); + base::ListValue frequencies2; frequencies2.AppendInteger(2400); frequencies2.AppendInteger(5000); diff --git a/chrome/test/data/extensions/api_test/networking/test.js b/chrome/test/data/extensions/api_test/networking/test.js index 72a5b17..2f0a653 100644 --- a/chrome/test/data/extensions/api_test/networking/test.js +++ b/chrome/test/data/extensions/api_test/networking/test.js @@ -204,6 +204,16 @@ var availableTests = [ } }, { + "Connectable": true, + "ConnectionState": "Connected", + "GUID": "stub_wimax_guid", + "Name": "wimax", + "Type": "WiMAX", + "WiMAX": { + "SignalStrength": 40 + } + }, + { "ConnectionState": "Connected", "GUID": "stub_vpn1_guid", "Name": "vpn1", @@ -255,6 +265,7 @@ var availableTests = [ // Connected or Connecting networks should be listed first, sorted by type. var expected = ["stub_ethernet_guid", "stub_wifi1_guid", + "stub_wimax_guid", "stub_vpn1_guid", "stub_wifi2_guid"]; var done = chrome.test.callbackAdded(); @@ -425,6 +436,7 @@ var availableTests = [ // networks should be listed first, sorted by type. var expected = ["stub_ethernet_guid", "stub_wifi2_guid", + "stub_wimax_guid", "stub_vpn1_guid", "stub_wifi1_guid"]; var done = chrome.test.callbackAdded(); diff --git a/chromeos/network/network_state.cc b/chromeos/network/network_state.cc index c47068b..915a688 100644 --- a/chromeos/network/network_state.cc +++ b/chromeos/network/network_state.cc @@ -163,9 +163,10 @@ bool NetworkState::InitialPropertiesReceived( has_ca_cert_nss_ = IsCaCertNssSet(properties); changed |= had_ca_cert_nss != has_ca_cert_nss_; - // By convention, all visible WiFi networks have a SignalStrength > 0. - if (visible() && type() == shill::kTypeWifi) { - if (signal_strength_ <= 0) + // By convention, all visible WiFi and WiMAX networks have a + // SignalStrength > 0. + if ((type() == shill::kTypeWifi || type() == shill::kTypeWimax) && + visible() && signal_strength_ <= 0) { signal_strength_ = 1; } diff --git a/chromeos/network/onc/onc_signature.cc b/chromeos/network/onc/onc_signature.cc index 160481f..805a2f7 100644 --- a/chromeos/network/onc/onc_signature.cc +++ b/chromeos/network/onc/onc_signature.cc @@ -216,6 +216,16 @@ const OncFieldSignature wifi_with_state_fields[] = { { ::onc::wifi::kSignalStrength, &kIntegerSignature}, {NULL}}; +const OncFieldSignature wimax_fields[] = { + { ::onc::kRecommended, &kRecommendedSignature}, + { ::onc::wimax::kAutoConnect, &kBoolSignature}, + { ::onc::wimax::kEAP, &kEAPSignature}, + {NULL}}; + +const OncFieldSignature wimax_with_state_fields[] = { + { ::onc::wimax::kSignalStrength, &kIntegerSignature}, + {NULL}}; + const OncFieldSignature cellular_provider_fields[] = { { ::onc::cellular_provider::kCode, &kStringSignature}, { ::onc::cellular_provider::kCountry, &kStringSignature}, @@ -305,6 +315,7 @@ const OncFieldSignature network_configuration_fields[] = { { ::onc::network_config::kType, &kStringSignature}, { ::onc::network_config::kVPN, &kVPNSignature}, { ::onc::network_config::kWiFi, &kWiFiSignature}, + { ::onc::network_config::kWimax, &kWiMAXSignature}, {NULL}}; const OncFieldSignature network_with_state_fields[] = { @@ -318,6 +329,7 @@ const OncFieldSignature network_with_state_fields[] = { { ::onc::network_config::kSavedIPConfig, &kSavedIPConfigSignature}, { ::onc::network_config::kSource, &kStringSignature}, { ::onc::network_config::kWiFi, &kWiFiWithStateSignature}, + { ::onc::network_config::kWimax, &kWiMAXWithStateSignature}, {NULL}}; const OncFieldSignature global_network_configuration_fields[] = { @@ -406,6 +418,9 @@ const OncValueSignature kProxySettingsSignature = { const OncValueSignature kWiFiSignature = { base::Value::TYPE_DICTIONARY, wifi_fields, NULL }; +const OncValueSignature kWiMAXSignature = { + base::Value::TYPE_DICTIONARY, wimax_fields, NULL +}; const OncValueSignature kCertificateSignature = { base::Value::TYPE_DICTIONARY, certificate_fields, NULL }; @@ -433,6 +448,9 @@ const OncValueSignature kNetworkWithStateSignature = { const OncValueSignature kWiFiWithStateSignature = { base::Value::TYPE_DICTIONARY, wifi_with_state_fields, NULL, &kWiFiSignature }; +const OncValueSignature kWiMAXWithStateSignature = { + base::Value::TYPE_DICTIONARY, wimax_with_state_fields, NULL, &kWiMAXSignature +}; const OncValueSignature kCellularSignature = { base::Value::TYPE_DICTIONARY, cellular_fields, NULL }; diff --git a/chromeos/network/onc/onc_signature.h b/chromeos/network/onc/onc_signature.h index 6885190..acb8406 100644 --- a/chromeos/network/onc/onc_signature.h +++ b/chromeos/network/onc/onc_signature.h @@ -53,6 +53,7 @@ CHROMEOS_EXPORT extern const OncValueSignature kProxyLocationSignature; CHROMEOS_EXPORT extern const OncValueSignature kProxyManualSignature; CHROMEOS_EXPORT extern const OncValueSignature kProxySettingsSignature; CHROMEOS_EXPORT extern const OncValueSignature kWiFiSignature; +CHROMEOS_EXPORT extern const OncValueSignature kWiMAXSignature; CHROMEOS_EXPORT extern const OncValueSignature kCertificateSignature; CHROMEOS_EXPORT extern const OncValueSignature kNetworkConfigurationSignature; CHROMEOS_EXPORT extern const OncValueSignature @@ -65,6 +66,7 @@ CHROMEOS_EXPORT extern const OncValueSignature kToplevelConfigurationSignature; // Derived "ONC with State" signatures. CHROMEOS_EXPORT extern const OncValueSignature kNetworkWithStateSignature; CHROMEOS_EXPORT extern const OncValueSignature kWiFiWithStateSignature; +CHROMEOS_EXPORT extern const OncValueSignature kWiMAXWithStateSignature; CHROMEOS_EXPORT extern const OncValueSignature kCellularSignature; CHROMEOS_EXPORT extern const OncValueSignature kCellularWithStateSignature; CHROMEOS_EXPORT extern const OncValueSignature kCellularProviderSignature; diff --git a/chromeos/network/onc/onc_translation_tables.cc b/chromeos/network/onc/onc_translation_tables.cc index 82df4d8..2f8fa9c 100644 --- a/chromeos/network/onc/onc_translation_tables.cc +++ b/chromeos/network/onc/onc_translation_tables.cc @@ -119,6 +119,11 @@ const FieldTranslationEntry wifi_fields[] = { { ::onc::wifi::kSignalStrength, shill::kSignalStrengthProperty}, {NULL}}; +const FieldTranslationEntry wimax_fields[] = { + { ::onc::wimax::kAutoConnect, shill::kAutoConnectProperty}, + { ::onc::wimax::kSignalStrength, shill::kSignalStrengthProperty}, + {NULL}}; + const FieldTranslationEntry cellular_apn_fields[] = { { ::onc::cellular_apn::kAccessPointName, shill::kApnProperty}, { ::onc::cellular_apn::kName, shill::kApnNameProperty}, @@ -226,6 +231,8 @@ const OncValueTranslationEntry onc_value_translation_table[] = { { &kVPNSignature, vpn_fields }, { &kWiFiSignature, wifi_fields }, { &kWiFiWithStateSignature, wifi_fields }, + { &kWiMAXSignature, wimax_fields }, + { &kWiMAXWithStateSignature, wimax_fields }, { &kCellularApnSignature, cellular_apn_fields }, { &kCellularFoundNetworkSignature, cellular_found_network_fields }, { &kCellularProviderSignature, cellular_provider_fields }, diff --git a/chromeos/network/onc/onc_translator_shill_to_onc.cc b/chromeos/network/onc/onc_translator_shill_to_onc.cc index 1474d04..d7bc265 100644 --- a/chromeos/network/onc/onc_translator_shill_to_onc.cc +++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc @@ -393,10 +393,7 @@ void ShillToONCTranslator::TranslateNetworkWithState() { if (!onc_network_type.empty()) { onc_object_->SetStringWithoutPathExpansion(::onc::network_config::kType, onc_network_type); - // Wimax is not supported by ONC, yet. - // TOOD(pneubeck): Wimax support is required, see https://crbug.com/414417 . - if (onc_network_type != ::onc::network_type::kWimax) - TranslateAndAddNestedObject(onc_network_type); + TranslateAndAddNestedObject(onc_network_type); } // Since Name is a read only field in Shill unless it's a VPN, it is copied diff --git a/chromeos/network/onc/onc_translator_unittest.cc b/chromeos/network/onc/onc_translator_unittest.cc index aa287eb..c3e6fb2 100644 --- a/chromeos/network/onc/onc_translator_unittest.cc +++ b/chromeos/network/onc/onc_translator_unittest.cc @@ -56,8 +56,8 @@ INSTANTIATE_TEST_CASE_P( "shill_openvpn.json"), std::make_pair("openvpn_clientcert_with_cert_pems.onc", "shill_openvpn_clientcert.json"), - std::make_pair("cellular.onc", - "shill_cellular.json"))); + std::make_pair("cellular.onc", "shill_cellular.json"), + std::make_pair("wimax.onc", "shill_wimax.json"))); // First parameter: Filename of source Shill json. // Second parameter: Filename of expected translated ONC network part. @@ -107,7 +107,9 @@ INSTANTIATE_TEST_CASE_P( std::make_pair("shill_wifi_with_state.json", "translation_of_shill_wifi_with_state.onc"), std::make_pair("shill_cellular_with_state.json", - "translation_of_shill_cellular_with_state.onc"))); + "translation_of_shill_cellular_with_state.onc"), + std::make_pair("shill_wimax_with_state.json", + "translation_of_shill_wimax_with_state.onc"))); } // namespace onc } // namespace chromeos diff --git a/chromeos/test/data/network/shill_wimax.json b/chromeos/test/data/network/shill_wimax.json new file mode 100644 index 0000000..b4c950fb --- /dev/null +++ b/chromeos/test/data/network/shill_wimax.json @@ -0,0 +1,9 @@ +{ + "AutoConnect": true, + "EAP.EAP": "TLS", + "EAP.Identity": "${LOGIN_ID}@my.domain.com", + "EAP.UseSystemCAs": true, + "GUID": "{77db0089-0bc8-4358-929c-123xcv}", + "SaveCredentials": true, + "Type": "wimax" +} diff --git a/chromeos/test/data/network/shill_wimax_with_state.json b/chromeos/test/data/network/shill_wimax_with_state.json new file mode 100644 index 0000000..ed12a13 --- /dev/null +++ b/chromeos/test/data/network/shill_wimax_with_state.json @@ -0,0 +1,14 @@ +{ + "AutoConnect": true, + "Connectable": true, + "Name": "SomeWiMAX", + "EAP.EAP": "TLS", + "EAP.Identity": "${LOGIN_ID}@my.domain.com", + "EAP.UseSystemCAs": true, + "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_wimax_with_state.onc b/chromeos/test/data/network/translation_of_shill_wimax_with_state.onc new file mode 100644 index 0000000..c8a83f6 --- /dev/null +++ b/chromeos/test/data/network/translation_of_shill_wimax_with_state.onc @@ -0,0 +1,12 @@ +{ + "Connectable": true, + "ConnectionState": "NotConnected", + "GUID": "{77db0089-0bc8-4358-929c-123xcv}", + "Type": "WiMAX", + "Name": "SomeWiMAX", + "WiMAX": { + "AutoConnect": true, + "SignalStrength": 10 + }, + "Source":"User" +} diff --git a/chromeos/test/data/network/wimax.onc b/chromeos/test/data/network/wimax.onc new file mode 100644 index 0000000..c8c8632 --- /dev/null +++ b/chromeos/test/data/network/wimax.onc @@ -0,0 +1,16 @@ +{ + "GUID": "{77db0089-0bc8-4358-929c-123xcv}", + "Type": "WiMAX", + "Name": "SomeWiMAX", + "WiMAX": { + "AutoConnect": true, + "EAP": { + "Outer": "EAP-TLS", + "Identity": "${LOGIN_ID}@my.domain.com", + "UseSystemCAs": true, + "Recommended": [ "Identity" ], + "SaveCredentials": true + }, + "Recommended": [ "AutoConnect" ] + } +} diff --git a/components/onc/onc_constants.cc b/components/onc/onc_constants.cc index 1570681..c4ea339 100644 --- a/components/onc/onc_constants.cc +++ b/components/onc/onc_constants.cc @@ -58,6 +58,7 @@ const char kStaticIPConfig[] = "StaticIPConfig"; const char kType[] = "Type"; const char kVPN[] = "VPN"; const char kWiFi[] = "WiFi"; +const char kWimax[] = "WiMAX"; std::string CellularProperty(const std::string& property) { return std::string(kCellular) + "." + property; @@ -79,7 +80,7 @@ const char kCellular[] = "Cellular"; const char kEthernet[] = "Ethernet"; const char kVPN[] = "VPN"; const char kWiFi[] = "WiFi"; -const char kWimax[] = "Wimax"; +const char kWimax[] = "WiMAX"; const char kWireless[] = "Wireless"; } // namespace network_type @@ -183,7 +184,6 @@ const char kFrequency[] = "Frequency"; const char kFrequencyList[] = "FrequencyList"; const char kHiddenSSID[] = "HiddenSSID"; const char kPassphrase[] = "Passphrase"; -const char kProxyURL[] = "ProxyURL"; const char kSSID[] = "SSID"; const char kSecurity[] = "Security"; const char kSecurityNone[] = "None"; @@ -195,6 +195,12 @@ const char kWPA_PSK[] = "WPA-PSK"; const char kWPA2_PSK[] = "WPA2-PSK"; } // namespace wifi +namespace wimax { +const char kAutoConnect[] = "AutoConnect"; +const char kEAP[] = "EAP"; +const char kSignalStrength[] = "SignalStrength"; +} // namespace wimax + namespace client_cert { const char kClientCertPattern[] = "ClientCertPattern"; const char kClientCertRef[] = "ClientCertRef"; diff --git a/components/onc/onc_constants.h b/components/onc/onc_constants.h index ce0bc8f..976946b 100644 --- a/components/onc/onc_constants.h +++ b/components/onc/onc_constants.h @@ -83,6 +83,7 @@ ONC_EXPORT extern const char kErrorState[]; ONC_EXPORT extern const char kType[]; ONC_EXPORT extern const char kVPN[]; ONC_EXPORT extern const char kWiFi[]; +ONC_EXPORT extern const char kWimax[]; ONC_EXPORT extern std::string CellularProperty(const std::string& property); ONC_EXPORT extern std::string VpnProperty(const std::string& property); @@ -201,7 +202,6 @@ ONC_EXPORT extern const char kFrequency[]; ONC_EXPORT extern const char kFrequencyList[]; ONC_EXPORT extern const char kHiddenSSID[]; ONC_EXPORT extern const char kPassphrase[]; -ONC_EXPORT extern const char kProxyURL[]; ONC_EXPORT extern const char kSSID[]; ONC_EXPORT extern const char kSecurity[]; ONC_EXPORT extern const char kSecurityNone[]; @@ -213,6 +213,12 @@ ONC_EXPORT extern const char kWPA2_PSK[]; ONC_EXPORT extern const char kWPA_EAP[]; } // namespace wifi +namespace wimax { +ONC_EXPORT extern const char kAutoConnect[]; +ONC_EXPORT extern const char kEAP[]; +ONC_EXPORT extern const char kSignalStrength[]; +} // namespace wimax + namespace client_cert { ONC_EXPORT extern const char kClientCertPattern[]; ONC_EXPORT extern const char kClientCertRef[]; |