Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / test / chromedriver / session_commands.cc
index 864ffd7..8f519c9 100644 (file)
@@ -28,6 +28,7 @@
 #include "chrome/test/chromedriver/chrome/version.h"
 #include "chrome/test/chromedriver/chrome/web_view.h"
 #include "chrome/test/chromedriver/chrome_launcher.h"
+#include "chrome/test/chromedriver/command_listener.h"
 #include "chrome/test/chromedriver/logging.h"
 #include "chrome/test/chromedriver/net/url_request_context_getter.h"
 #include "chrome/test/chromedriver/session.h"
@@ -124,13 +125,19 @@ Status InitSessionHelper(
 
   // Create Log's and DevToolsEventListener's for ones that are DevTools-based.
   // Session will own the Log's, Chrome will own the listeners.
+  // Also create |CommandListener|s for the appropriate logs.
   ScopedVector<DevToolsEventListener> devtools_event_listeners;
+  ScopedVector<CommandListener> command_listeners;
   status = CreateLogs(capabilities,
                       &session->devtools_logs,
-                      &devtools_event_listeners);
+                      &devtools_event_listeners,
+                      &command_listeners);
   if (status.IsError())
     return status;
 
+  // |session| will own the |CommandListener|s.
+  session->command_listeners.swap(command_listeners);
+
   status = LaunchChrome(bound_params.context_getter.get(),
                         bound_params.socket_factory,
                         bound_params.device_manager,
@@ -477,7 +484,8 @@ Status ExecuteSetWindowPosition(
     Session* session,
     const base::DictionaryValue& params,
     scoped_ptr<base::Value>* value) {
-  double x, y;
+  double x = 0;
+  double y = 0;
   if (!params.GetDouble("x", &x) || !params.GetDouble("y", &y))
     return Status(kUnknownError, "missing or invalid 'x' or 'y'");
 
@@ -528,7 +536,8 @@ Status ExecuteSetWindowSize(
     Session* session,
     const base::DictionaryValue& params,
     scoped_ptr<base::Value>* value) {
-  double width, height;
+  double width = 0;
+  double height = 0;
   if (!params.GetDouble("width", &width) ||
       !params.GetDouble("height", &height))
     return Status(kUnknownError, "missing or invalid 'width' or 'height'");