| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdio.h> | 5 #include <stdio.h> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // Need AtExitManager to support AsWeakPtr (in NetLog). | 59 // Need AtExitManager to support AsWeakPtr (in NetLog). |
| 60 base::AtExitManager exit_manager_; | 60 base::AtExitManager exit_manager_; |
| 61 | 61 |
| 62 Result result_; | 62 Result result_; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 WiFiTest::Result WiFiTest::Main(int argc, const char* argv[]) { | 65 WiFiTest::Result WiFiTest::Main(int argc, const char* argv[]) { |
| 66 if (!ParseCommandLine(argc, argv)) { | 66 if (!ParseCommandLine(argc, argv)) { |
| 67 VLOG(0) << "Usage: " << argv[0] << | 67 VLOG(0) << "Usage: " << argv[0] << |
| 68 " [--list]" | 68 " [--list]" |
| 69 " [--get_key]" |
| 69 " [--get_properties]" | 70 " [--get_properties]" |
| 70 " [--create]" | 71 " [--create]" |
| 71 " [--connect]" | 72 " [--connect]" |
| 72 " [--disconnect]" | 73 " [--disconnect]" |
| 73 " [--network_guid=<network_guid>]" | 74 " [--network_guid=<network_guid>]" |
| 74 " [--frequency=0|2400|5000]" | 75 " [--frequency=0|2400|5000]" |
| 75 " [--security=none|WEP-PSK|WPA-PSK|WPA2-PSK]" | 76 " [--security=none|WEP-PSK|WPA-PSK|WPA2-PSK]" |
| 76 " [--password=<wifi_password>]" | 77 " [--password=<wifi_password>]" |
| 77 " [<network_guid>]\n"; | 78 " [<network_guid>]\n"; |
| 78 return RESULT_WRONG_USAGE; | 79 return RESULT_WRONG_USAGE; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 184 |
| 184 if (parsed_command_line.HasSwitch("disconnect")) { | 185 if (parsed_command_line.HasSwitch("disconnect")) { |
| 185 if (network_guid.length() > 0) { | 186 if (network_guid.length() > 0) { |
| 186 std::string error; | 187 std::string error; |
| 187 wifi_service->StartDisconnect(network_guid, &error); | 188 wifi_service->StartDisconnect(network_guid, &error); |
| 188 VLOG(0) << error; | 189 VLOG(0) << error; |
| 189 return true; | 190 return true; |
| 190 } | 191 } |
| 191 } | 192 } |
| 192 | 193 |
| 194 if (parsed_command_line.HasSwitch("get_key")) { |
| 195 if (network_guid.length() > 0) { |
| 196 std::string error; |
| 197 std::string key_data; |
| 198 wifi_service->GetKeyFromSystem(network_guid, |
| 199 true, |
| 200 &key_data, |
| 201 &error); |
| 202 VLOG(0) << key_data << error; |
| 203 return true; |
| 204 } |
| 205 } |
| 206 |
| 193 return false; | 207 return false; |
| 194 } | 208 } |
| 195 | 209 |
| 196 } // namespace wifi | 210 } // namespace wifi |
| 197 | 211 |
| 198 int main(int argc, const char* argv[]) { | 212 int main(int argc, const char* argv[]) { |
| 199 CommandLine::Init(argc, argv); | 213 CommandLine::Init(argc, argv); |
| 200 logging::LoggingSettings settings; | 214 logging::LoggingSettings settings; |
| 201 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 215 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 202 logging::InitLogging(settings); | 216 logging::InitLogging(settings); |
| 203 | 217 |
| 204 wifi::WiFiTest wifi_test; | 218 wifi::WiFiTest wifi_test; |
| 205 return wifi_test.Main(argc, argv); | 219 return wifi_test.Main(argc, argv); |
| 206 } | 220 } |
| OLD | NEW |