1 // Copyright (c) 2013 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_SESSION_COMMANDS_H_ 6 #define CHROME_TEST_CHROMEDRIVER_SESSION_COMMANDS_H_ 7 8 #include <string> 9 10 #include "base/callback_forward.h" 11 #include "base/memory/scoped_ptr.h" 12 #include "chrome/test/chromedriver/command.h" 13 #include "chrome/test/chromedriver/net/sync_websocket_factory.h" 14 15 namespace base { 16 class DictionaryValue; 17 class Value; 18 } 19 20 class DeviceManager; 21 class PortManager; 22 class PortServer; 23 struct Session; 24 class Status; 25 class URLRequestContextGetter; 26 27 struct InitSessionParams { 28 InitSessionParams(scoped_refptr<URLRequestContextGetter> context_getter, 29 const SyncWebSocketFactory& socket_factory, 30 DeviceManager* device_manager, 31 PortServer* port_server, 32 PortManager* port_manager); 33 ~InitSessionParams(); 34 35 scoped_refptr<URLRequestContextGetter> context_getter; 36 SyncWebSocketFactory socket_factory; 37 DeviceManager* device_manager; 38 PortServer* port_server; 39 PortManager* port_manager; 40 }; 41 42 // Initializes a session. 43 Status ExecuteInitSession( 44 const InitSessionParams& bound_params, 45 Session* session, 46 const base::DictionaryValue& params, 47 scoped_ptr<base::Value>* value); 48 49 // Quits a session. 50 Status ExecuteQuit( 51 bool allow_detach, 52 Session* session, 53 const base::DictionaryValue& params, 54 scoped_ptr<base::Value>* value); 55 56 // Gets the capabilities of a particular session. 57 Status ExecuteGetSessionCapabilities( 58 Session* session, 59 const base::DictionaryValue& params, 60 scoped_ptr<base::Value>* value); 61 62 // Retrieve the handle of the target window. 63 Status ExecuteGetCurrentWindowHandle( 64 Session* session, 65 const base::DictionaryValue& params, 66 scoped_ptr<base::Value>* value); 67 68 // Close the target window. 69 Status ExecuteClose( 70 Session* session, 71 const base::DictionaryValue& params, 72 scoped_ptr<base::Value>* value); 73 74 // Retrieve the list of all window handles available to the session. 75 Status ExecuteGetWindowHandles( 76 Session* session, 77 const base::DictionaryValue& params, 78 scoped_ptr<base::Value>* value); 79 80 // Change target window to another. The window to target at may be specified by 81 // its server assigned window handle, or by the value of its name attribute. 82 Status ExecuteSwitchToWindow( 83 Session* session, 84 const base::DictionaryValue& params, 85 scoped_ptr<base::Value>* value); 86 87 // Configure the amount of time that a particular type of operation can execute 88 // for before they are aborted and a timeout error is returned to the client. 89 Status ExecuteSetTimeout( 90 Session* session, 91 const base::DictionaryValue& params, 92 scoped_ptr<base::Value>* value); 93 94 // Set the timeout for asynchronous scripts. 95 Status ExecuteSetScriptTimeout( 96 Session* session, 97 const base::DictionaryValue& params, 98 scoped_ptr<base::Value>* value); 99 100 // Set the amount of time the driver should wait when searching for elements. 101 Status ExecuteImplicitlyWait( 102 Session* session, 103 const base::DictionaryValue& params, 104 scoped_ptr<base::Value>* value); 105 106 Status ExecuteIsLoading( 107 Session* session, 108 const base::DictionaryValue& params, 109 scoped_ptr<base::Value>* value); 110 111 Status ExecuteGetLocation( 112 Session* session, 113 const base::DictionaryValue& params, 114 scoped_ptr<base::Value>* value); 115 116 Status ExecuteGetWindowPosition( 117 Session* session, 118 const base::DictionaryValue& params, 119 scoped_ptr<base::Value>* value); 120 121 Status ExecuteSetWindowPosition( 122 Session* session, 123 const base::DictionaryValue& params, 124 scoped_ptr<base::Value>* value); 125 126 Status ExecuteGetWindowSize( 127 Session* session, 128 const base::DictionaryValue& params, 129 scoped_ptr<base::Value>* value); 130 131 Status ExecuteSetWindowSize( 132 Session* session, 133 const base::DictionaryValue& params, 134 scoped_ptr<base::Value>* value); 135 136 Status ExecuteMaximizeWindow( 137 Session* session, 138 const base::DictionaryValue& params, 139 scoped_ptr<base::Value>* value); 140 141 Status ExecuteGetAvailableLogTypes( 142 Session* session, 143 const base::DictionaryValue& params, 144 scoped_ptr<base::Value>* value); 145 146 Status ExecuteGetLog( 147 Session* session, 148 const base::DictionaryValue& params, 149 scoped_ptr<base::Value>* value); 150 151 Status ExecuteUploadFile( 152 Session* session, 153 const base::DictionaryValue& params, 154 scoped_ptr<base::Value>* value); 155 156 #endif // CHROME_TEST_CHROMEDRIVER_SESSION_COMMANDS_H_ 157