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 #ifndef CHROME_TEST_WEBDRIVER_WEBDRIVER_SESSION_H_ | 5 #ifndef CHROME_TEST_WEBDRIVER_WEBDRIVER_SESSION_H_ |
6 #define CHROME_TEST_WEBDRIVER_WEBDRIVER_SESSION_H_ | 6 #define CHROME_TEST_WEBDRIVER_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/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/files/scoped_temp_dir.h" | 14 #include "base/files/scoped_temp_dir.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/string16.h" | 16 #include "base/string16.h" |
17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
18 #include "chrome/common/automation_constants.h" | 18 #include "chrome/common/automation_constants.h" |
19 #include "chrome/test/automation/automation_json_requests.h" | 19 #include "chrome/test/automation/automation_json_requests.h" |
20 #include "chrome/test/webdriver/frame_path.h" | 20 #include "chrome/test/webdriver/frame_path.h" |
21 #include "chrome/test/webdriver/webdriver_automation.h" | 21 #include "chrome/test/webdriver/webdriver_automation.h" |
22 #include "chrome/test/webdriver/webdriver_basic_types.h" | 22 #include "chrome/test/webdriver/webdriver_basic_types.h" |
23 #include "chrome/test/webdriver/webdriver_capabilities_parser.h" | 23 #include "chrome/test/webdriver/webdriver_capabilities_parser.h" |
24 #include "chrome/test/webdriver/webdriver_element_id.h" | 24 #include "chrome/test/webdriver/webdriver_element_id.h" |
25 #include "chrome/test/webdriver/webdriver_logging.h" | 25 #include "chrome/test/webdriver/webdriver_logging.h" |
26 | 26 |
27 class FilePath; | |
28 | |
29 namespace base { | 27 namespace base { |
30 class DictionaryValue; | 28 class DictionaryValue; |
| 29 class FilePath; |
31 class ListValue; | 30 class ListValue; |
32 class Value; | 31 class Value; |
33 class WaitableEvent; | 32 class WaitableEvent; |
34 } | 33 } |
35 | 34 |
36 namespace webdriver { | 35 namespace webdriver { |
37 | 36 |
38 class Error; | 37 class Error; |
39 class ValueParser; | 38 class ValueParser; |
40 | 39 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 const base::ListValue* const args, | 112 const base::ListValue* const args, |
114 base::Value** value); | 113 base::Value** value); |
115 | 114 |
116 // Send the given keys to the given element dictionary. This function takes | 115 // Send the given keys to the given element dictionary. This function takes |
117 // ownership of |element|. | 116 // ownership of |element|. |
118 Error* SendKeys(const ElementId& element, const string16& keys); | 117 Error* SendKeys(const ElementId& element, const string16& keys); |
119 // Send the given keys to the active element. | 118 // Send the given keys to the active element. |
120 Error* SendKeys(const string16& keys); | 119 Error* SendKeys(const string16& keys); |
121 | 120 |
122 // Sets the file paths to the file upload control under the given location. | 121 // Sets the file paths to the file upload control under the given location. |
123 Error* DragAndDropFilePaths(const Point& location, | 122 Error* DragAndDropFilePaths( |
124 const std::vector<FilePath::StringType>& paths); | 123 const Point& location, |
| 124 const std::vector<base::FilePath::StringType>& paths); |
125 | 125 |
126 // Clicks the mouse at the given location using the given button. | 126 // Clicks the mouse at the given location using the given button. |
127 Error* MouseMoveAndClick(const Point& location, | 127 Error* MouseMoveAndClick(const Point& location, |
128 automation::MouseButton button); | 128 automation::MouseButton button); |
129 Error* MouseMove(const Point& location); | 129 Error* MouseMove(const Point& location); |
130 Error* MouseDrag(const Point& start, const Point& end); | 130 Error* MouseDrag(const Point& start, const Point& end); |
131 Error* MouseClick(automation::MouseButton button); | 131 Error* MouseClick(automation::MouseButton button); |
132 Error* MouseButtonDown(); | 132 Error* MouseButtonDown(); |
133 Error* MouseButtonUp(); | 133 Error* MouseButtonUp(); |
134 Error* MouseDoubleClick(); | 134 Error* MouseDoubleClick(); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 308 |
309 // Gets the attribute of the given element. If there are no errors, the | 309 // Gets the attribute of the given element. If there are no errors, the |
310 // function sets |value| and the caller takes ownership. | 310 // function sets |value| and the caller takes ownership. |
311 Error* GetAttribute(const ElementId& element, const std::string& key, | 311 Error* GetAttribute(const ElementId& element, const std::string& key, |
312 base::Value** value); | 312 base::Value** value); |
313 | 313 |
314 // Waits for all views to stop loading. Returns true on success. | 314 // Waits for all views to stop loading. Returns true on success. |
315 Error* WaitForAllViewsToStopLoading(); | 315 Error* WaitForAllViewsToStopLoading(); |
316 | 316 |
317 // Install extension at |path|. | 317 // Install extension at |path|. |
318 Error* InstallExtension(const FilePath& path, std::string* extension_id); | 318 Error* InstallExtension(const base::FilePath& path, std::string* extension_id)
; |
319 | 319 |
320 Error* GetExtensionsInfo(base::ListValue* extension_ids); | 320 Error* GetExtensionsInfo(base::ListValue* extension_ids); |
321 | 321 |
322 Error* IsPageActionVisible(const WebViewId& tab_id, | 322 Error* IsPageActionVisible(const WebViewId& tab_id, |
323 const std::string& extension_id, | 323 const std::string& extension_id, |
324 bool* is_visible); | 324 bool* is_visible); |
325 | 325 |
326 Error* SetExtensionState(const std::string& extension_id, | 326 Error* SetExtensionState(const std::string& extension_id, |
327 bool enable); | 327 bool enable); |
328 | 328 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 void set_async_script_timeout(int timeout_ms); | 386 void set_async_script_timeout(int timeout_ms); |
387 int async_script_timeout() const; | 387 int async_script_timeout() const; |
388 | 388 |
389 void set_implicit_wait(int timeout_ms); | 389 void set_implicit_wait(int timeout_ms); |
390 int implicit_wait() const; | 390 int implicit_wait() const; |
391 | 391 |
392 const Point& get_mouse_position() const; | 392 const Point& get_mouse_position() const; |
393 | 393 |
394 const Logger& logger() const; | 394 const Logger& logger() const; |
395 | 395 |
396 const FilePath& temp_dir() const; | 396 const base::FilePath& temp_dir() const; |
397 | 397 |
398 const Capabilities& capabilities() const; | 398 const Capabilities& capabilities() const; |
399 | 399 |
400 private: | 400 private: |
401 void RunSessionTask(const base::Closure& task); | 401 void RunSessionTask(const base::Closure& task); |
402 void RunClosureOnSessionThread( | 402 void RunClosureOnSessionThread( |
403 const base::Closure& task, | 403 const base::Closure& task, |
404 base::WaitableEvent* done_event); | 404 base::WaitableEvent* done_event); |
405 void InitOnSessionThread(const Automation::BrowserOptions& options, | 405 void InitOnSessionThread(const Automation::BrowserOptions& options, |
406 int* build_no, | 406 int* build_no, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 // (e.g., 18.0.995.0 -> 995). Only valid after Chrome has started. | 494 // (e.g., 18.0.995.0 -> 995). Only valid after Chrome has started. |
495 // See http://dev.chromium.org/releases/version-numbers. | 495 // See http://dev.chromium.org/releases/version-numbers. |
496 int build_no_; | 496 int build_no_; |
497 | 497 |
498 DISALLOW_COPY_AND_ASSIGN(Session); | 498 DISALLOW_COPY_AND_ASSIGN(Session); |
499 }; | 499 }; |
500 | 500 |
501 } // namespace webdriver | 501 } // namespace webdriver |
502 | 502 |
503 #endif // CHROME_TEST_WEBDRIVER_WEBDRIVER_SESSION_H_ | 503 #endif // CHROME_TEST_WEBDRIVER_WEBDRIVER_SESSION_H_ |
OLD | NEW |