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

Unified Diff: chrome/test/webdriver/commands/create_session.cc

Issue 7523060: Let pyauto create an attached webdriver instance to manipulate web pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move bools into struct Created 9 years, 5 months 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
Index: chrome/test/webdriver/commands/create_session.cc
diff --git a/chrome/test/webdriver/commands/create_session.cc b/chrome/test/webdriver/commands/create_session.cc
index efb8ff968d469f0d48e9de99c89ac0d6f49e5029..525bfec56a75d856f19992ca8674abf557f18532 100644
--- a/chrome/test/webdriver/commands/create_session.cc
+++ b/chrome/test/webdriver/commands/create_session.cc
@@ -42,7 +42,11 @@ void CreateSession::ExecutePost(Response* const response) {
return;
}
- CommandLine command_line_options(CommandLine::NO_PROGRAM);
+ Automation::InitOptions options;
+ FilePath::StringType path;
+ if (capabilities->GetStringWithoutPathExpansion("chrome.binary", &path))
+ options.cmdline = CommandLine(FilePath(path));
+
ListValue* switches = NULL;
const char* kCustomSwitchesKey = "chrome.switches";
if (capabilities->GetListWithoutPathExpansion(kCustomSwitchesKey,
@@ -62,11 +66,11 @@ void CreateSession::ExecutePost(Response* const response) {
kBadRequest, "Custom switch is not a string"));
return;
}
- command_line_options.AppendSwitchNative(
+ options.cmdline.AppendSwitchNative(
switch_string.substr(0, separator_index),
switch_string_native.substr(separator_index + 1));
} else {
- command_line_options.AppendSwitch(switch_string);
+ options.cmdline.AppendSwitch(switch_string);
}
}
} else if (capabilities->HasKey(kCustomSwitchesKey)) {
@@ -74,14 +78,16 @@ void CreateSession::ExecutePost(Response* const response) {
kBadRequest, "Custom switches must be a list"));
return;
}
+
Value* verbose_value;
if (capabilities->GetWithoutPathExpansion("chrome.verbose", &verbose_value)) {
- bool verbose;
- if (verbose_value->GetAsBoolean(&verbose) && verbose) {
+ bool verbose = false;
+ if (verbose_value->GetAsBoolean(&verbose)) {
// Since logging is shared among sessions, if any session requests verbose
// logging, verbose logging will be enabled for all sessions. It is not
// possible to turn it off.
- logging::SetMinLogLevel(logging::LOG_INFO);
+ if (verbose)
+ logging::SetMinLogLevel(logging::LOG_INFO);
} else {
response->SetError(new Error(
kBadRequest, "verbose must be a boolean true or false"));
@@ -89,10 +95,8 @@ void CreateSession::ExecutePost(Response* const response) {
}
}
- FilePath browser_exe;
- FilePath::StringType path;
- if (capabilities->GetStringWithoutPathExpansion("chrome.binary", &path))
- browser_exe = FilePath(path);
+ capabilities->GetStringWithoutPathExpansion(
+ "chrome.channel", &options.channel_id);
ScopedTempDir temp_dir;
FilePath temp_user_data_dir;
@@ -130,9 +134,7 @@ void CreateSession::ExecutePost(Response* const response) {
// Session manages its own liftime, so do not call delete.
Session* session = new Session();
- Error* error = session->Init(browser_exe,
- temp_user_data_dir,
- command_line_options);
+ Error* error = session->Init(options);
if (error) {
response->SetError(error);
return;

Powered by Google App Engine
This is Rietveld 408576698