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 | 6 |
| 7 #include <memory> |
7 #include <string> | 8 #include <string> |
8 #include <utility> | 9 #include <utility> |
9 | 10 |
10 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
11 #include "base/bind.h" | 12 #include "base/bind.h" |
12 #include "base/cancelable_callback.h" | 13 #include "base/cancelable_callback.h" |
13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
14 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
15 #include "base/logging.h" | 16 #include "base/logging.h" |
16 #include "base/memory/scoped_ptr.h" | |
17 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
18 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/string_split.h" | 20 #include "base/strings/string_split.h" |
21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
23 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
24 #include "base/time/time.h" | 24 #include "base/time/time.h" |
25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
26 #include "components/wifi/wifi_service.h" | 26 #include "components/wifi/wifi_service.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 void OnNetworkListChanged( | 68 void OnNetworkListChanged( |
69 const WiFiService::NetworkGuidList& network_guid_list) { | 69 const WiFiService::NetworkGuidList& network_guid_list) { |
70 VLOG(0) << "Network List Changed: " << network_guid_list.size(); | 70 VLOG(0) << "Network List Changed: " << network_guid_list.size(); |
71 } | 71 } |
72 | 72 |
73 #if defined(OS_MACOSX) | 73 #if defined(OS_MACOSX) |
74 // Without this there will be a mem leak on osx. | 74 // Without this there will be a mem leak on osx. |
75 base::mac::ScopedNSAutoreleasePool scoped_pool_; | 75 base::mac::ScopedNSAutoreleasePool scoped_pool_; |
76 #endif | 76 #endif |
77 | 77 |
78 scoped_ptr<WiFiService> wifi_service_; | 78 std::unique_ptr<WiFiService> wifi_service_; |
79 | 79 |
80 // Need AtExitManager to support AsWeakPtr (in NetLog). | 80 // Need AtExitManager to support AsWeakPtr (in NetLog). |
81 base::AtExitManager exit_manager_; | 81 base::AtExitManager exit_manager_; |
82 | 82 |
83 Result result_; | 83 Result result_; |
84 }; | 84 }; |
85 | 85 |
86 WiFiTest::Result WiFiTest::Main(int argc, const char* argv[]) { | 86 WiFiTest::Result WiFiTest::Main(int argc, const char* argv[]) { |
87 if (!ParseCommandLine(argc, argv)) { | 87 if (!ParseCommandLine(argc, argv)) { |
88 VLOG(0) << "Usage: " << argv[0] | 88 VLOG(0) << "Usage: " << argv[0] |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 if (network_guid.length() > 0) { | 150 if (network_guid.length() > 0) { |
151 base::DictionaryValue properties; | 151 base::DictionaryValue properties; |
152 std::string error; | 152 std::string error; |
153 wifi_service_->GetProperties(network_guid, &properties, &error); | 153 wifi_service_->GetProperties(network_guid, &properties, &error); |
154 VLOG(0) << error << ":\n" << properties; | 154 VLOG(0) << error << ":\n" << properties; |
155 return true; | 155 return true; |
156 } | 156 } |
157 } | 157 } |
158 | 158 |
159 // Optional properties (frequency, password) to use for connect or create. | 159 // Optional properties (frequency, password) to use for connect or create. |
160 scoped_ptr<base::DictionaryValue> properties(new base::DictionaryValue()); | 160 std::unique_ptr<base::DictionaryValue> properties( |
| 161 new base::DictionaryValue()); |
161 | 162 |
162 if (!frequency.empty()) { | 163 if (!frequency.empty()) { |
163 int value = 0; | 164 int value = 0; |
164 if (base::StringToInt(frequency, &value)) { | 165 if (base::StringToInt(frequency, &value)) { |
165 properties->SetInteger("WiFi.Frequency", value); | 166 properties->SetInteger("WiFi.Frequency", value); |
166 // fall through to connect. | 167 // fall through to connect. |
167 } | 168 } |
168 } | 169 } |
169 | 170 |
170 if (!password.empty()) | 171 if (!password.empty()) |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 256 |
256 int main(int argc, const char* argv[]) { | 257 int main(int argc, const char* argv[]) { |
257 base::CommandLine::Init(argc, argv); | 258 base::CommandLine::Init(argc, argv); |
258 logging::LoggingSettings settings; | 259 logging::LoggingSettings settings; |
259 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 260 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
260 logging::InitLogging(settings); | 261 logging::InitLogging(settings); |
261 | 262 |
262 wifi::WiFiTest wifi_test; | 263 wifi::WiFiTest wifi_test; |
263 return wifi_test.Main(argc, argv); | 264 return wifi_test.Main(argc, argv); |
264 } | 265 } |
OLD | NEW |