| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/test/chromedriver/command_executor_impl.h" | 5 #include "chrome/test/chromedriver/command_executor_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 const base::DictionaryValue&, | 38 const base::DictionaryValue&, |
| 39 const std::string&, | 39 const std::string&, |
| 40 scoped_ptr<base::Value>*, | 40 scoped_ptr<base::Value>*, |
| 41 std::string*)> execute_session_command = base::Bind( | 41 std::string*)> execute_session_command = base::Bind( |
| 42 &ExecuteSessionCommand, | 42 &ExecuteSessionCommand, |
| 43 &session_map_); | 43 &session_map_); |
| 44 command_map_.Set("get", base::Bind(execute_session_command, | 44 command_map_.Set("get", base::Bind(execute_session_command, |
| 45 base::Bind(&ExecuteGet))); | 45 base::Bind(&ExecuteGet))); |
| 46 command_map_.Set("executeScript", base::Bind(execute_session_command, | 46 command_map_.Set("executeScript", base::Bind(execute_session_command, |
| 47 base::Bind(&ExecuteExecuteScript))); | 47 base::Bind(&ExecuteExecuteScript))); |
| 48 command_map_.Set("switchToFrame", base::Bind(execute_session_command, |
| 49 base::Bind(&ExecuteSwitchToFrame))); |
| 48 Command quit_command = base::Bind(execute_session_command, | 50 Command quit_command = base::Bind(execute_session_command, |
| 49 base::Bind(&ExecuteQuit, &session_map_)); | 51 base::Bind(&ExecuteQuit, &session_map_)); |
| 50 command_map_.Set("quit", quit_command); | 52 command_map_.Set("quit", quit_command); |
| 51 | 53 |
| 52 // Non-session commands. | 54 // Non-session commands. |
| 53 command_map_.Set("newSession", | 55 command_map_.Set("newSession", |
| 54 base::Bind(&ExecuteNewSession, &session_map_, launcher_.get())); | 56 base::Bind(&ExecuteNewSession, &session_map_, launcher_.get())); |
| 55 command_map_.Set("quitAll", | 57 command_map_.Set("quitAll", |
| 56 base::Bind(&ExecuteQuitAll, quit_command, &session_map_)); | 58 base::Bind(&ExecuteQuitAll, quit_command, &session_map_)); |
| 57 } | 59 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 73 } | 75 } |
| 74 *status_code = status.code(); | 76 *status_code = status.code(); |
| 75 if (status.IsError()) { | 77 if (status.IsError()) { |
| 76 scoped_ptr<base::DictionaryValue> error(new base::DictionaryValue()); | 78 scoped_ptr<base::DictionaryValue> error(new base::DictionaryValue()); |
| 77 error->SetString("message", status.message()); | 79 error->SetString("message", status.message()); |
| 78 value->reset(error.release()); | 80 value->reset(error.release()); |
| 79 } | 81 } |
| 80 if (!*value) | 82 if (!*value) |
| 81 value->reset(base::Value::CreateNullValue()); | 83 value->reset(base::Value::CreateNullValue()); |
| 82 } | 84 } |
| OLD | NEW |