summaryrefslogtreecommitdiffstats
path: root/components/wifi/fake_wifi_service.cc
diff options
context:
space:
mode:
authorstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-09 16:45:46 +0000
committerstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-09 16:45:46 +0000
commit0e7085a9497b7b4954885e81cf4a4319213dea84 (patch)
treedd082d0f9d50b781f9f1d61cb88199ee64fe28e4 /components/wifi/fake_wifi_service.cc
parent03283943a1a609eb88bbd0c346a764ae0af46e29 (diff)
downloadchromium_src-0e7085a9497b7b4954885e81cf4a4319213dea84.zip
chromium_src-0e7085a9497b7b4954885e81cf4a4319213dea84.tar.gz
chromium_src-0e7085a9497b7b4954885e81cf4a4319213dea84.tar.bz2
Provide IPConfigs in networkingPrivate.GetProperties
BUG=365848 For components/wifi fixes for tests: R=pneubeck@chromium.org TBR=mef@chromium.org Review URL: https://codereview.chromium.org/267433005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269334 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/wifi/fake_wifi_service.cc')
-rw-r--r--components/wifi/fake_wifi_service.cc125
1 files changed, 18 insertions, 107 deletions
diff --git a/components/wifi/fake_wifi_service.cc b/components/wifi/fake_wifi_service.cc
index 5582f01..86b6358 100644
--- a/components/wifi/fake_wifi_service.cc
+++ b/components/wifi/fake_wifi_service.cc
@@ -16,33 +16,26 @@ FakeWiFiService::FakeWiFiService() {
{
WiFiService::NetworkProperties network_properties;
network_properties.connection_state = onc::connection_state::kConnected;
- network_properties.guid = "stub_ethernet";
- network_properties.name = "eth0";
- network_properties.type = onc::network_type::kEthernet;
- network_properties.json_extra =
- " {"
- " \"Authentication\": \"None\""
- " }";
- networks_.push_back(network_properties);
- }
- {
- WiFiService::NetworkProperties network_properties;
- network_properties.connection_state = onc::connection_state::kConnected;
network_properties.guid = "stub_wifi1";
network_properties.name = "wifi1";
network_properties.type = onc::network_type::kWiFi;
network_properties.frequency = 0;
- network_properties.ssid = "stub_wifi1";
+ network_properties.ssid = "wifi1";
network_properties.security = onc::wifi::kWEP_PSK;
- network_properties.signal_strength = 0;
- networks_.push_back(network_properties);
- }
- {
- WiFiService::NetworkProperties network_properties;
- network_properties.connection_state = onc::connection_state::kConnected;
- network_properties.guid = "stub_vpn1";
- network_properties.name = "vpn1";
- network_properties.type = onc::network_type::kVPN;
+ network_properties.signal_strength = 40;
+ network_properties.json_extra =
+ "{"
+ " \"IPConfigs\": [{"
+ " \"Gateway\": \"0.0.0.1\","
+ " \"IPAddress\": \"0.0.0.0\","
+ " \"RoutingPrefix\": 0,"
+ " \"Type\": \"IPv4\""
+ " }],"
+ " \"WiFi\": {"
+ " \"Frequency\": 2400,"
+ " \"FrequencyList\": [2400]"
+ " }"
+ "}";
networks_.push_back(network_properties);
}
{
@@ -59,20 +52,6 @@ FakeWiFiService::FakeWiFiService() {
network_properties.signal_strength = 80;
networks_.push_back(network_properties);
}
- {
- WiFiService::NetworkProperties network_properties;
- network_properties.connection_state = onc::connection_state::kNotConnected;
- network_properties.guid = "stub_cellular1";
- network_properties.name = "cellular1";
- network_properties.type = onc::network_type::kCellular;
- network_properties.json_extra =
- " {"
- " \"ActivationState\": \"not-activated\","
- " \"NetworkTechnology\": \"GSM\","
- " \"RoamingState\": \"home\""
- " }";
- networks_.push_back(network_properties);
- }
}
FakeWiFiService::~FakeWiFiService() {
@@ -101,61 +80,8 @@ void FakeWiFiService::GetManagedProperties(
const std::string& network_guid,
base::DictionaryValue* managed_properties,
std::string* error) {
- const std::string network_properties =
- "{"
- " \"ConnectionState\": {"
- " \"Active\": \"NotConnected\","
- " \"Effective\": \"Unmanaged\""
- " },"
- " \"GUID\": \"stub_wifi2\","
- " \"Name\": {"
- " \"Active\": \"wifi2_PSK\","
- " \"Effective\": \"UserPolicy\","
- " \"UserPolicy\": \"My WiFi Network\""
- " },"
- " \"Type\": {"
- " \"Active\": \"WiFi\","
- " \"Effective\": \"UserPolicy\","
- " \"UserPolicy\": \"WiFi\""
- " },"
- " \"WiFi\": {"
- " \"AutoConnect\": {"
- " \"Active\": false,"
- " \"UserEditable\": true"
- " },"
- " \"Frequency\" : {"
- " \"Active\": 5000,"
- " \"Effective\": \"Unmanaged\""
- " },"
- " \"FrequencyList\" : {"
- " \"Active\": [2400, 5000],"
- " \"Effective\": \"Unmanaged\""
- " },"
- " \"Passphrase\": {"
- " \"Effective\": \"UserSetting\","
- " \"UserEditable\": true,"
- " \"UserSetting\": \"FAKE_CREDENTIAL_VPaJDV9x\""
- " },"
- " \"SSID\": {"
- " \"Active\": \"wifi2_PSK\","
- " \"Effective\": \"UserPolicy\","
- " \"UserPolicy\": \"wifi2_PSK\""
- " },"
- " \"Security\": {"
- " \"Active\": \"WPA-PSK\","
- " \"Effective\": \"UserPolicy\","
- " \"UserPolicy\": \"WPA-PSK\""
- " },"
- " \"SignalStrength\": {"
- " \"Active\": 80,"
- " \"Effective\": \"Unmanaged\""
- " }"
- " }"
- "}";
- scoped_ptr<base::DictionaryValue> properties_value(
- reinterpret_cast<base::DictionaryValue*>(
- base::JSONReader::Read(network_properties)));
- managed_properties->MergeDictionary(properties_value.get());
+ // Not implemented
+ *error = kErrorWiFiService;
}
void FakeWiFiService::GetState(const std::string& network_guid,
@@ -167,22 +93,7 @@ void FakeWiFiService::GetState(const std::string& network_guid,
*error = "Error.InvalidParameter";
return;
}
-
- const std::string network_state =
- "{"
- " \"ConnectionState\": \"NotConnected\","
- " \"GUID\": \"stub_wifi2\","
- " \"Name\": \"wifi2_PSK\","
- " \"Type\": \"WiFi\","
- " \"WiFi\": {"
- " \"Security\": \"WPA-PSK\","
- " \"SignalStrength\": 80"
- " }"
- "}";
- scoped_ptr<base::DictionaryValue> properties_value(
- reinterpret_cast<base::DictionaryValue*>(
- base::JSONReader::Read(network_state)));
- properties->MergeDictionary(properties_value.get());
+ properties->Swap(network_properties->ToValue(true).get());
}
void FakeWiFiService::SetProperties(