Index: chrome/test/chromedriver/command_executor_impl.cc |
diff --git a/chrome/test/chromedriver/command_executor_impl.cc b/chrome/test/chromedriver/command_executor_impl.cc |
index 57c3a24d616230c9e86a3fb9622b30096821e244..4f5b57a8b35f4c08a8f127d1f2dbf85fad668142 100644 |
--- a/chrome/test/chromedriver/command_executor_impl.cc |
+++ b/chrome/test/chromedriver/command_executor_impl.cc |
@@ -6,14 +6,30 @@ |
#include "base/bind.h" |
#include "base/callback.h" |
+#include "base/message_loop.h" |
+#include "base/message_loop_proxy.h" |
#include "base/values.h" |
+#include "chrome/test/chromedriver/chrome_launcher_impl.h" |
#include "chrome/test/chromedriver/commands.h" |
+#include "chrome/test/chromedriver/net/url_request_context_getter.h" |
#include "chrome/test/chromedriver/session.h" |
#include "chrome/test/chromedriver/session_command.h" |
#include "chrome/test/chromedriver/session_map.h" |
#include "chrome/test/chromedriver/status.h" |
-CommandExecutorImpl::CommandExecutorImpl() { |
+CommandExecutorImpl::CommandExecutorImpl() |
+ : io_thread_("ChromeDriver IO") {} |
+ |
+CommandExecutorImpl::~CommandExecutorImpl() {} |
+ |
+void CommandExecutorImpl::Init() { |
+ base::Thread::Options options(MessageLoop::TYPE_IO, 0); |
+ CHECK(io_thread_.StartWithOptions(options)); |
+ context_getter_ = new URLRequestContextGetter( |
+ io_thread_.message_loop_proxy()); |
+ launcher_.reset(new ChromeLauncherImpl(context_getter_)); |
+ |
+ // Session commands. |
base::Callback<Status( |
const SessionCommand&, |
const base::DictionaryValue&, |
@@ -22,19 +38,19 @@ CommandExecutorImpl::CommandExecutorImpl() { |
std::string*)> execute_session_command = base::Bind( |
&ExecuteSessionCommand, |
&session_map_); |
+ command_map_.Set("get", base::Bind(execute_session_command, |
+ base::Bind(&ExecuteGet))); |
Command quit_command = base::Bind(execute_session_command, |
base::Bind(&ExecuteQuit, &session_map_)); |
command_map_.Set("quit", quit_command); |
// Non-session commands. |
command_map_.Set("newSession", |
- base::Bind(&ExecuteNewSession, &session_map_, &launcher_)); |
+ base::Bind(&ExecuteNewSession, &session_map_, launcher_.get())); |
command_map_.Set("quitAll", |
base::Bind(&ExecuteQuitAll, quit_command, &session_map_)); |
} |
-CommandExecutorImpl::~CommandExecutorImpl() {} |
- |
void CommandExecutorImpl::ExecuteCommand( |
const std::string& name, |
const base::DictionaryValue& params, |