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 3 // found in the LICENSE file. 4 5 #ifndef CHROME_TEST_CHROMEDRIVER_COMMANDS_H_ 6 #define CHROME_TEST_CHROMEDRIVER_COMMANDS_H_ 7 8 #include <string> 9 10 #include "base/callback_forward.h" 11 #include "base/memory/ref_counted.h" 12 #include "base/memory/scoped_ptr.h" 13 #include "chrome/test/chromedriver/command.h" 14 #include "chrome/test/chromedriver/session_thread_map.h" 15 16 namespace base { 17 class DictionaryValue; 18 class Value; 19 } 20 21 struct Session; 22 class Status; 23 24 // Gets status/info about ChromeDriver. 25 void ExecuteGetStatus( 26 const base::DictionaryValue& params, 27 const std::string& session_id, 28 const CommandCallback& callback); 29 30 // Creates a new session. 31 void ExecuteCreateSession( 32 SessionThreadMap* session_thread_map, 33 const Command& init_session_cmd, 34 const base::DictionaryValue& params, 35 const std::string& session_id, 36 const CommandCallback& callback); 37 38 // Quits all sessions. 39 void ExecuteQuitAll( 40 const Command& quit_command, 41 SessionThreadMap* session_thread_map, 42 const base::DictionaryValue& params, 43 const std::string& session_id, 44 const CommandCallback& callback); 45 46 typedef base::Callback<Status( 47 Session* session, 48 const base::DictionaryValue&, 49 scoped_ptr<base::Value>*)> SessionCommand; 50 51 // Executes a given session command, after acquiring access to the appropriate 52 // session. 53 void ExecuteSessionCommand( 54 SessionThreadMap* session_thread_map, 55 const char* command_name, 56 const SessionCommand& command, 57 bool return_ok_without_session, 58 const base::DictionaryValue& params, 59 const std::string& session_id, 60 const CommandCallback& callback); 61 62 namespace internal { 63 void CreateSessionOnSessionThreadForTesting(const std::string& id); 64 } // namespace internal 65 66 #endif // CHROME_TEST_CHROMEDRIVER_COMMANDS_H_ 67