Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / test / chromedriver / commands.h
bloba2e9eb3b6f7de76cea6273ce88396e73e723153b
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.
5 #ifndef CHROME_TEST_CHROMEDRIVER_COMMANDS_H_
6 #define CHROME_TEST_CHROMEDRIVER_COMMANDS_H_
8 #include <string>
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"
16 namespace base {
17 class DictionaryValue;
18 class Value;
21 struct Session;
22 class Status;
24 // Gets status/info about ChromeDriver.
25 void ExecuteGetStatus(
26 const base::DictionaryValue& params,
27 const std::string& session_id,
28 const CommandCallback& callback);
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);
38 // Gets all sessions
39 void ExecuteGetSessions(
40 const Command& session_capabilities_command,
41 SessionThreadMap* session_thread_map,
42 const base::DictionaryValue& params,
43 const std::string& session_id,
44 const CommandCallback& callback);
46 // Quits all sessions.
47 void ExecuteQuitAll(
48 const Command& quit_command,
49 SessionThreadMap* session_thread_map,
50 const base::DictionaryValue& params,
51 const std::string& session_id,
52 const CommandCallback& callback);
54 typedef base::Callback<Status(
55 Session* session,
56 const base::DictionaryValue&,
57 scoped_ptr<base::Value>*)> SessionCommand;
59 // Executes a given session command, after acquiring access to the appropriate
60 // session.
61 void ExecuteSessionCommand(
62 SessionThreadMap* session_thread_map,
63 const char* command_name,
64 const SessionCommand& command,
65 bool return_ok_without_session,
66 const base::DictionaryValue& params,
67 const std::string& session_id,
68 const CommandCallback& callback);
70 namespace internal {
71 void CreateSessionOnSessionThreadForTesting(const std::string& id);
72 } // namespace internal
74 #endif // CHROME_TEST_CHROMEDRIVER_COMMANDS_H_