OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_TEST_WEBDRIVER_SESSION_H_ | 5 #ifndef CHROME_TEST_WEBDRIVER_SESSION_H_ |
6 #define CHROME_TEST_WEBDRIVER_SESSION_H_ | 6 #define CHROME_TEST_WEBDRIVER_SESSION_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
| 12 #include "base/file_path.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/string16.h" | 14 #include "base/string16.h" |
14 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
15 #include "chrome/common/automation_constants.h" | 16 #include "chrome/common/automation_constants.h" |
16 #include "chrome/test/webdriver/automation.h" | 17 #include "chrome/test/webdriver/automation.h" |
17 #include "chrome/test/webdriver/frame_path.h" | 18 #include "chrome/test/webdriver/frame_path.h" |
18 #include "chrome/test/webdriver/web_element_id.h" | 19 #include "chrome/test/webdriver/web_element_id.h" |
19 #include "ui/gfx/point.h" | 20 #include "ui/gfx/point.h" |
20 | 21 |
21 class CommandLine; | 22 class CommandLine; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // |value|, which is set only if there is no error. | 92 // |value|, which is set only if there is no error. |
92 Error* ExecuteAsyncScript(const FrameId& frame_id, | 93 Error* ExecuteAsyncScript(const FrameId& frame_id, |
93 const std::string& script, | 94 const std::string& script, |
94 const ListValue* const args, | 95 const ListValue* const args, |
95 Value** value); | 96 Value** value); |
96 | 97 |
97 // Send the given keys to the given element dictionary. This function takes | 98 // Send the given keys to the given element dictionary. This function takes |
98 // ownership of |element|. | 99 // ownership of |element|. |
99 Error* SendKeys(const WebElementId& element, const string16& keys); | 100 Error* SendKeys(const WebElementId& element, const string16& keys); |
100 | 101 |
| 102 // Sets the file paths to the file upload control under the given location. |
| 103 Error* DragAndDropFilePaths(const gfx::Point& location, |
| 104 const std::vector<FilePath::StringType>& paths); |
| 105 |
101 // Clicks the mouse at the given location using the given button. | 106 // Clicks the mouse at the given location using the given button. |
102 Error* MouseMoveAndClick(const gfx::Point& location, | 107 Error* MouseMoveAndClick(const gfx::Point& location, |
103 automation::MouseButton button); | 108 automation::MouseButton button); |
104 Error* MouseMove(const gfx::Point& location); | 109 Error* MouseMove(const gfx::Point& location); |
105 Error* MouseDrag(const gfx::Point& start, const gfx::Point& end); | 110 Error* MouseDrag(const gfx::Point& start, const gfx::Point& end); |
106 Error* MouseClick(automation::MouseButton button); | 111 Error* MouseClick(automation::MouseButton button); |
107 Error* MouseButtonDown(); | 112 Error* MouseButtonDown(); |
108 Error* MouseButtonUp(); | 113 Error* MouseButtonUp(); |
109 Error* MouseDoubleClick(); | 114 Error* MouseDoubleClick(); |
110 | 115 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 bool* is_visible); | 234 bool* is_visible); |
230 | 235 |
231 // Gets whether the element is currently enabled. | 236 // Gets whether the element is currently enabled. |
232 Error* IsElementEnabled(const FrameId& frame_id, | 237 Error* IsElementEnabled(const FrameId& frame_id, |
233 const WebElementId& element, | 238 const WebElementId& element, |
234 bool* is_enabled); | 239 bool* is_enabled); |
235 | 240 |
236 // Waits for all tabs to stop loading. Returns true on success. | 241 // Waits for all tabs to stop loading. Returns true on success. |
237 Error* WaitForAllTabsToStopLoading(); | 242 Error* WaitForAllTabsToStopLoading(); |
238 | 243 |
| 244 // Gets the attribute of the given element. If there are no errors, the |
| 245 // function sets |value| and the caller takes ownership. |
| 246 Error* GetAttribute(const WebElementId& element, const std::string& key, |
| 247 Value** value); |
| 248 |
| 249 // Gets a clickable location of the given element. It will be the center |
| 250 // location of the element. |
| 251 Error* GetClickableLocation(const WebElementId& element, |
| 252 gfx::Point* location); |
| 253 |
239 const std::string& id() const; | 254 const std::string& id() const; |
240 | 255 |
241 const FrameId& current_target() const; | 256 const FrameId& current_target() const; |
242 | 257 |
243 void set_async_script_timeout(int timeout_ms); | 258 void set_async_script_timeout(int timeout_ms); |
244 int async_script_timeout() const; | 259 int async_script_timeout() const; |
245 | 260 |
246 void set_implicit_wait(int timeout_ms); | 261 void set_implicit_wait(int timeout_ms); |
247 int implicit_wait() const; | 262 int implicit_wait() const; |
248 | 263 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 bool has_alert_prompt_text_; | 339 bool has_alert_prompt_text_; |
325 | 340 |
326 DISALLOW_COPY_AND_ASSIGN(Session); | 341 DISALLOW_COPY_AND_ASSIGN(Session); |
327 }; | 342 }; |
328 | 343 |
329 } // namespace webdriver | 344 } // namespace webdriver |
330 | 345 |
331 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Session); | 346 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Session); |
332 | 347 |
333 #endif // CHROME_TEST_WEBDRIVER_SESSION_H_ | 348 #endif // CHROME_TEST_WEBDRIVER_SESSION_H_ |
OLD | NEW |