Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Unified Diff: components/wifi/wifi_test.cc

Issue 86123003: Use WiFi.Frequency property to set desired band for networkingPrivateApi.StartConnect() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use VLOG instead of cout. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« components/wifi/wifi_service_win.cc ('K') | « components/wifi/wifi_service_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/wifi/wifi_test.cc
diff --git a/components/wifi/wifi_test.cc b/components/wifi/wifi_test.cc
index 8fd0aaf9deaee427573166f251d95e046770b9f7..5d675a4f352cf97e79203720b993032d968a7518 100644
--- a/components/wifi/wifi_test.cc
+++ b/components/wifi/wifi_test.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include <stdio.h>
-#include <iostream>
#include <string>
#include "base/at_exit.h"
@@ -65,15 +64,14 @@ class WiFiTest {
WiFiTest::Result WiFiTest::Main(int argc, const char* argv[]) {
if (!ParseCommandLine(argc, argv)) {
- fprintf(stderr,
- "usage: %s [--list]"
- " [--get_properties]"
- " [--connect]"
- " [--disconnect]"
- " [--network_guid=<network_guid>]"
- " [--frequency=0|2400|5000]"
- " [<network_guid>]\n",
- argv[0]);
+ VLOG(0) << "Usage: " << argv[0] <<
+ " [--list]"
+ " [--get_properties]"
+ " [--connect]"
+ " [--disconnect]"
+ " [--network_guid=<network_guid>]"
+ " [--frequency=0|2400|5000]"
+ " [<network_guid>]\n";
return RESULT_WRONG_USAGE;
}
@@ -88,6 +86,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 frequency =
+ parsed_command_line.GetSwitchValueASCII("frequency");
if (parsed_command_line.GetArgs().size() == 1) {
#if defined(OS_WIN)
@@ -113,7 +113,7 @@ bool WiFiTest::ParseCommandLine(int argc, const char* argv[]) {
if (parsed_command_line.HasSwitch("list")) {
ListValue network_list;
wifi_service->GetVisibleNetworks(&network_list);
- std::cout << network_list;
+ VLOG(0) << network_list;
return true;
}
@@ -122,16 +122,35 @@ bool WiFiTest::ParseCommandLine(int argc, const char* argv[]) {
DictionaryValue properties;
std::string error;
wifi_service->GetProperties(network_guid, &properties, &error);
- std::cout << error << ":\n" << properties;
+ VLOG(0) << error << ":\n" << properties;
return true;
}
}
+ // Optional properties (frequency, password) to use for connect.
+ scoped_ptr<DictionaryValue> connect_properties(new DictionaryValue());
+
+ if (parsed_command_line.HasSwitch("frequency")) {
+ int value = 0;
+ if (!network_guid.empty() &&
+ !frequency.empty() &&
+ base::StringToInt(frequency, &value)) {
+ connect_properties->SetInteger("WiFi.Frequency", value);
+ // fall through to connect.
+ }
+ }
+
if (parsed_command_line.HasSwitch("connect")) {
if (network_guid.length() > 0) {
std::string error;
+ if (!connect_properties->empty()) {
+ VLOG(0) << "Using connect properties: " << *connect_properties;
+ wifi_service->SetProperties(network_guid,
+ connect_properties.Pass(),
+ &error);
+ }
wifi_service->StartConnect(network_guid, &error);
- std::cout << error;
+ VLOG(0) << error;
return true;
}
}
@@ -140,7 +159,7 @@ bool WiFiTest::ParseCommandLine(int argc, const char* argv[]) {
if (network_guid.length() > 0) {
std::string error;
wifi_service->StartDisconnect(network_guid, &error);
- std::cout << error;
+ VLOG(0) << error;
return true;
}
}
@@ -151,6 +170,13 @@ bool WiFiTest::ParseCommandLine(int argc, const char* argv[]) {
} // namespace wifi
int main(int argc, const char* argv[]) {
+ base::AtExitManager at_exit_manager;
+ CommandLine::Init(argc, argv);
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ logging::LoggingSettings settings;
+ settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
+ logging::InitLogging(settings);
+
wifi::WiFiTest wifi_test;
return wifi_test.Main(argc, argv);
}
« components/wifi/wifi_service_win.cc ('K') | « components/wifi/wifi_service_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698