diff options
author | stanleyw@chromium.org <stanleyw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-15 03:57:54 +0000 |
---|---|---|
committer | stanleyw@chromium.org <stanleyw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-15 03:57:54 +0000 |
commit | d3c0564c490d7392835a0c6a4fd8e4872e1ab53e (patch) | |
tree | e7ca56810bbfbd7ab025c5a04709f59c623c7766 /chrome/browser/automation | |
parent | e447130c0168acc61c88a2f2dd05d78bf929e2d1 (diff) | |
download | chromium_src-d3c0564c490d7392835a0c6a4fd8e4872e1ab53e.zip chromium_src-d3c0564c490d7392835a0c6a4fd8e4872e1ab53e.tar.gz chromium_src-d3c0564c490d7392835a0c6a4fd8e4872e1ab53e.tar.bz2 |
Initial inclusion of ForgetWifiNetworks
When a user successfully connects to a network, that network is added to a remembered_wifi_networks list which holds a wifi object that allows users to autoconnect to the network in the future.
ForgetWifiNetwork serves the functionality of "Forget Network" button that appears for each network in the remembered networks page.
* Adding support for Forgetting Wifi Networks.
* Added remembered_networks to the GetNetworkInfo dictionary
* Fixed a bug with the service order comparison. Should have used intersection and not union.
BUG=None
TEST=Run chromeos_wifi_compliance.py and chromeos_wifi.py
Review URL: http://codereview.chromium.org/7046104
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89129 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation')
3 files changed, 38 insertions, 16 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 06e3ab0..8ccd0d9 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -2155,6 +2155,8 @@ void TestingAutomationProvider::SendJSONRequest(int handle, &TestingAutomationProvider::ConnectToHiddenWifiNetwork; handler_map["DisconnectFromWifiNetwork"] = &TestingAutomationProvider::DisconnectFromWifiNetwork; + handler_map["ForgetWifiNetwork"] = + &TestingAutomationProvider::ForgetWifiNetwork; handler_map["GetUpdateInfo"] = &TestingAutomationProvider::GetUpdateInfo; handler_map["UpdateCheck"] = &TestingAutomationProvider::UpdateCheck; diff --git a/chrome/browser/automation/testing_automation_provider.h b/chrome/browser/automation/testing_automation_provider.h index 60eb1f5..834f066 100644 --- a/chrome/browser/automation/testing_automation_provider.h +++ b/chrome/browser/automation/testing_automation_provider.h @@ -1154,6 +1154,8 @@ class TestingAutomationProvider : public AutomationProvider, void DisconnectFromWifiNetwork(DictionaryValue* args, IPC::Message* reply_message); + void ForgetWifiNetwork(DictionaryValue* args, IPC::Message* reply_message); + void GetUpdateInfo(DictionaryValue* args, IPC::Message* reply_message); void UpdateCheck(DictionaryValue* args, IPC::Message* reply_message); diff --git a/chrome/browser/automation/testing_automation_provider_chromeos.cc b/chrome/browser/automation/testing_automation_provider_chromeos.cc index a303612..1cc920d 100644 --- a/chrome/browser/automation/testing_automation_provider_chromeos.cc +++ b/chrome/browser/automation/testing_automation_provider_chromeos.cc @@ -358,6 +358,18 @@ void TestingAutomationProvider::GetNetworkInfo(DictionaryValue* args, return_value->Set("cellular_networks", items); } + // Remembered Wifi Networks. + const chromeos::WifiNetworkVector& remembered_wifi = + network_library->remembered_wifi_networks(); + ListValue* items = new ListValue; + for (chromeos::WifiNetworkVector::const_iterator iter = + remembered_wifi.begin(); iter != remembered_wifi.end(); + ++iter) { + const chromeos::WifiNetwork* wifi = *iter; + items->Append(Value::CreateStringValue(wifi->service_path())); + } + return_value->Set("remembered_wifi", items); + AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); } @@ -416,11 +428,9 @@ void TestingAutomationProvider::ConnectToWifiNetwork( return; AutomationJSONReply reply(this, reply_message); - std::string service_path, password, identity, certpath; + std::string service_path, password; if (!args->GetString("service_path", &service_path) || - !args->GetString("password", &password) || - !args->GetString("identity", &identity) || - !args->GetString("certpath", &certpath)) { + !args->GetString("password", &password)) { reply.SendError("Invalid or missing args."); return; } @@ -434,10 +444,6 @@ void TestingAutomationProvider::ConnectToWifiNetwork( } if (!password.empty()) wifi->SetPassphrase(password); - if (!identity.empty()) - wifi->SetIdentity(identity); - if (!certpath.empty()) - wifi->SetCertPath(certpath); // Set up an observer (it will delete itself). new ServicePathConnectObserver(this, reply_message, service_path); @@ -446,20 +452,32 @@ void TestingAutomationProvider::ConnectToWifiNetwork( network_library->RequestNetworkScan(); } -void TestingAutomationProvider::ConnectToHiddenWifiNetwork( +void TestingAutomationProvider::ForgetWifiNetwork( DictionaryValue* args, IPC::Message* reply_message) { - if (!CrosLibrary::Get()->EnsureLoaded()) { - AutomationJSONReply(this, reply_message) - .SendError("Could not load cros library."); + if (!EnsureCrosLibraryLoaded(this, reply_message)) + return; + std::string service_path; + if (!args->GetString("service_path", &service_path)) { + AutomationJSONReply(this, reply_message).SendError( + "Invalid or missing args."); return; } + CrosLibrary::Get()->GetNetworkLibrary()->ForgetWifiNetwork(service_path); + AutomationJSONReply(this, reply_message).SendSuccess(NULL); +} + +void TestingAutomationProvider::ConnectToHiddenWifiNetwork( + DictionaryValue* args, IPC::Message* reply_message) { + if (!EnsureCrosLibraryLoaded(this, reply_message)) + return; + std::string ssid, security, password; if (!args->GetString("ssid", &ssid) || !args->GetString("security", &security) || !args->GetString("password", &password)) { - AutomationJSONReply(this, reply_message) - .SendError("Invalid or missing args."); + AutomationJSONReply(this, reply_message).SendError( + "Invalid or missing args."); return; } @@ -471,8 +489,8 @@ void TestingAutomationProvider::ConnectToHiddenWifiNetwork( connection_security_map["SECURITY_8021X"] = chromeos::SECURITY_8021X; if (connection_security_map.find(security) == connection_security_map.end()) { - AutomationJSONReply(this, reply_message) - .SendError("Unknown security type."); + AutomationJSONReply(this, reply_message).SendError( + "Unknown security type."); return; } chromeos::ConnectionSecurity connection_security = |