| Index: components/wifi/wifi_test.cc
|
| diff --git a/components/wifi/wifi_test.cc b/components/wifi/wifi_test.cc
|
| index 8fd0aaf9deaee427573166f251d95e046770b9f7..4191dc76e13c103ec6207bb390ff4f571fc90ea3 100644
|
| --- a/components/wifi/wifi_test.cc
|
| +++ b/components/wifi/wifi_test.cc
|
| @@ -72,6 +72,7 @@ WiFiTest::Result WiFiTest::Main(int argc, const char* argv[]) {
|
| " [--disconnect]"
|
| " [--network_guid=<network_guid>]"
|
| " [--frequency=0|2400|5000]"
|
| + " [--password=<password>]"
|
| " [<network_guid>]\n",
|
| argv[0]);
|
| return RESULT_WRONG_USAGE;
|
| @@ -88,6 +89,8 @@ bool WiFiTest::ParseCommandLine(int argc, const char* argv[]) {
|
| const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
|
| std::string network_guid =
|
| parsed_command_line.GetSwitchValueASCII("network_guid");
|
| + std::string password =
|
| + parsed_command_line.GetSwitchValueASCII("password");
|
|
|
| if (parsed_command_line.GetArgs().size() == 1) {
|
| #if defined(OS_WIN)
|
| @@ -102,7 +105,7 @@ bool WiFiTest::ParseCommandLine(int argc, const char* argv[]) {
|
| MessageBoxA(NULL, __FUNCTION__, "Debug Me!", MB_OK);
|
| #endif
|
|
|
| -#if defined(OS_WIN)
|
| +#if defined(OS_WIN) || defined(OS_MACOSX)
|
| scoped_ptr<WiFiService> wifi_service(WiFiService::Create());
|
| #else
|
| scoped_ptr<WiFiService> wifi_service(WiFiService::CreateForTest());
|
| @@ -127,6 +130,16 @@ bool WiFiTest::ParseCommandLine(int argc, const char* argv[]) {
|
| }
|
| }
|
|
|
| + if (parsed_command_line.HasSwitch("password")) {
|
| + if (network_guid.length() > 0) {
|
| + std::string error;
|
| + scoped_ptr<DictionaryValue> properties(new DictionaryValue());
|
| + properties->SetString("WiFi.Passphrase", password);
|
| + wifi_service->SetProperties(network_guid, properties.Pass(), &error);
|
| + // fall through to connect.
|
| + }
|
| + }
|
| +
|
| if (parsed_command_line.HasSwitch("connect")) {
|
| if (network_guid.length() > 0) {
|
| std::string error;
|
|
|