| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 #if defined(OS_WIN) | 112 #if defined(OS_WIN) |
| 113 scoped_ptr<WiFiService> wifi_service(WiFiService::Create()); | 113 scoped_ptr<WiFiService> wifi_service(WiFiService::Create()); |
| 114 #else | 114 #else |
| 115 scoped_ptr<WiFiService> wifi_service(WiFiService::CreateForTest()); | 115 scoped_ptr<WiFiService> wifi_service(WiFiService::CreateForTest()); |
| 116 #endif | 116 #endif |
| 117 | 117 |
| 118 wifi_service->Initialize(NULL); | 118 wifi_service->Initialize(NULL); |
| 119 | 119 |
| 120 if (parsed_command_line.HasSwitch("list")) { | 120 if (parsed_command_line.HasSwitch("list")) { |
| 121 ListValue network_list; | 121 base::ListValue network_list; |
| 122 wifi_service->GetVisibleNetworks(std::string(), &network_list); | 122 wifi_service->GetVisibleNetworks(std::string(), &network_list); |
| 123 VLOG(0) << network_list; | 123 VLOG(0) << network_list; |
| 124 return true; | 124 return true; |
| 125 } | 125 } |
| 126 | 126 |
| 127 if (parsed_command_line.HasSwitch("get_properties")) { | 127 if (parsed_command_line.HasSwitch("get_properties")) { |
| 128 if (network_guid.length() > 0) { | 128 if (network_guid.length() > 0) { |
| 129 DictionaryValue properties; | 129 base::DictionaryValue properties; |
| 130 std::string error; | 130 std::string error; |
| 131 wifi_service->GetProperties(network_guid, &properties, &error); | 131 wifi_service->GetProperties(network_guid, &properties, &error); |
| 132 VLOG(0) << error << ":\n" << properties; | 132 VLOG(0) << error << ":\n" << properties; |
| 133 return true; | 133 return true; |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 // Optional properties (frequency, password) to use for connect or create. | 137 // Optional properties (frequency, password) to use for connect or create. |
| 138 scoped_ptr<DictionaryValue> properties(new DictionaryValue()); | 138 scoped_ptr<base::DictionaryValue> properties(new base::DictionaryValue()); |
| 139 | 139 |
| 140 if (!frequency.empty()) { | 140 if (!frequency.empty()) { |
| 141 int value = 0; | 141 int value = 0; |
| 142 if (base::StringToInt(frequency, &value)) { | 142 if (base::StringToInt(frequency, &value)) { |
| 143 properties->SetInteger("WiFi.Frequency", value); | 143 properties->SetInteger("WiFi.Frequency", value); |
| 144 // fall through to connect. | 144 // fall through to connect. |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 | 147 |
| 148 if (!password.empty()) | 148 if (!password.empty()) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 197 |
| 198 int main(int argc, const char* argv[]) { | 198 int main(int argc, const char* argv[]) { |
| 199 CommandLine::Init(argc, argv); | 199 CommandLine::Init(argc, argv); |
| 200 logging::LoggingSettings settings; | 200 logging::LoggingSettings settings; |
| 201 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 201 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 202 logging::InitLogging(settings); | 202 logging::InitLogging(settings); |
| 203 | 203 |
| 204 wifi::WiFiTest wifi_test; | 204 wifi::WiFiTest wifi_test; |
| 205 return wifi_test.Main(argc, argv); | 205 return wifi_test.Main(argc, argv); |
| 206 } | 206 } |
| OLD | NEW |