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 29 matching lines...) Expand all Loading... |
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, | 48 command_map_.Set("switchToFrame", base::Bind(execute_session_command, |
49 base::Bind(&ExecuteSwitchToFrame))); | 49 base::Bind(&ExecuteSwitchToFrame))); |
| 50 command_map_.Set("getTitle", base::Bind(execute_session_command, |
| 51 base::Bind(&ExecuteGetTitle))); |
50 Command quit_command = base::Bind(execute_session_command, | 52 Command quit_command = base::Bind(execute_session_command, |
51 base::Bind(&ExecuteQuit, &session_map_)); | 53 base::Bind(&ExecuteQuit, &session_map_)); |
52 command_map_.Set("quit", quit_command); | 54 command_map_.Set("quit", quit_command); |
53 | 55 |
54 // Non-session commands. | 56 // Non-session commands. |
55 command_map_.Set("newSession", | 57 command_map_.Set("newSession", |
56 base::Bind(&ExecuteNewSession, &session_map_, launcher_.get())); | 58 base::Bind(&ExecuteNewSession, &session_map_, launcher_.get())); |
57 command_map_.Set("quitAll", | 59 command_map_.Set("quitAll", |
58 base::Bind(&ExecuteQuitAll, quit_command, &session_map_)); | 60 base::Bind(&ExecuteQuitAll, quit_command, &session_map_)); |
59 } | 61 } |
(...skipping 15 matching lines...) Expand all Loading... |
75 } | 77 } |
76 *status_code = status.code(); | 78 *status_code = status.code(); |
77 if (status.IsError()) { | 79 if (status.IsError()) { |
78 scoped_ptr<base::DictionaryValue> error(new base::DictionaryValue()); | 80 scoped_ptr<base::DictionaryValue> error(new base::DictionaryValue()); |
79 error->SetString("message", status.message()); | 81 error->SetString("message", status.message()); |
80 value->reset(error.release()); | 82 value->reset(error.release()); |
81 } | 83 } |
82 if (!*value) | 84 if (!*value) |
83 value->reset(base::Value::CreateNullValue()); | 85 value->reset(base::Value::CreateNullValue()); |
84 } | 86 } |
OLD | NEW |