| 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_AUTOMATION_H_ | 5 #ifndef CHROME_TEST_WEBDRIVER_AUTOMATION_H_ |
| 6 #define CHROME_TEST_WEBDRIVER_AUTOMATION_H_ | 6 #define CHROME_TEST_WEBDRIVER_AUTOMATION_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/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/task.h" | 16 #include "base/task.h" |
| 17 #include "chrome/common/automation_constants.h" | 17 #include "chrome/common/automation_constants.h" |
| 18 #include "ui/base/keycodes/keyboard_codes.h" | 18 #include "ui/base/keycodes/keyboard_codes.h" |
| 19 | 19 |
| 20 class AutomationProxy; | 20 class AutomationProxy; |
| 21 class ProxyLauncher; | 21 class ProxyLauncher; |
| 22 struct WebKeyEvent; | 22 struct WebKeyEvent; |
| 23 | 23 |
| 24 namespace base { | 24 namespace base { |
| 25 class DictionaryValue; | 25 class DictionaryValue; |
| 26 class ListValue; | 26 class ListValue; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace gfx { | |
| 30 class Point; | |
| 31 } | |
| 32 | |
| 33 namespace webdriver { | 29 namespace webdriver { |
| 34 | 30 |
| 35 class Error; | 31 class Error; |
| 36 class FramePath; | 32 class FramePath; |
| 33 class Point; |
| 37 | 34 |
| 38 // Creates and controls the Chrome instance. | 35 // Creates and controls the Chrome instance. |
| 39 // This class should be created and accessed on a single thread. | 36 // This class should be created and accessed on a single thread. |
| 40 // Note: All member functions are void because they are invoked | 37 // Note: All member functions are void because they are invoked |
| 41 // by posting a task from NewRunnableMethod. | 38 // by posting a task from NewRunnableMethod. |
| 42 class Automation { | 39 class Automation { |
| 43 public: | 40 public: |
| 44 struct BrowserOptions { | 41 struct BrowserOptions { |
| 45 BrowserOptions(); | 42 BrowserOptions(); |
| 46 ~BrowserOptions(); | 43 ~BrowserOptions(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 76 | 73 |
| 77 // Sends an OS level key event to the current browser. Waits until the key | 74 // Sends an OS level key event to the current browser. Waits until the key |
| 78 // has been processed by the browser. | 75 // has been processed by the browser. |
| 79 void SendNativeKeyEvent(int tab_id, | 76 void SendNativeKeyEvent(int tab_id, |
| 80 ui::KeyboardCode key_code, | 77 ui::KeyboardCode key_code, |
| 81 int modifiers, | 78 int modifiers, |
| 82 Error** error); | 79 Error** error); |
| 83 | 80 |
| 84 // Drag and drop the file paths to the given location. | 81 // Drag and drop the file paths to the given location. |
| 85 void DragAndDropFilePaths(int tab_id, | 82 void DragAndDropFilePaths(int tab_id, |
| 86 const gfx::Point& location, | 83 const Point& location, |
| 87 const std::vector<FilePath::StringType>& paths, | 84 const std::vector<FilePath::StringType>& paths, |
| 88 Error** error); | 85 Error** error); |
| 89 | 86 |
| 90 // Captures a snapshot of the tab to the specified path. The PNG will | 87 // Captures a snapshot of the tab to the specified path. The PNG will |
| 91 // contain the entire page, including what is not in the current view | 88 // contain the entire page, including what is not in the current view |
| 92 // on the screen. | 89 // on the screen. |
| 93 void CaptureEntirePageAsPNG(int tab_id, const FilePath& path, Error** error); | 90 void CaptureEntirePageAsPNG(int tab_id, const FilePath& path, Error** error); |
| 94 | 91 |
| 95 void NavigateToURL(int tab_id, const std::string& url, Error** error); | 92 void NavigateToURL(int tab_id, const std::string& url, Error** error); |
| 96 void NavigateToURLAsync(int tab_id, const std::string& url, Error** error); | 93 void NavigateToURLAsync(int tab_id, const std::string& url, Error** error); |
| 97 void GoForward(int tab_id, Error** error); | 94 void GoForward(int tab_id, Error** error); |
| 98 void GoBack(int tab_id, Error** error); | 95 void GoBack(int tab_id, Error** error); |
| 99 void Reload(int tab_id, Error** error); | 96 void Reload(int tab_id, Error** error); |
| 100 | 97 |
| 101 void GetCookies(const std::string& url, | 98 void GetCookies(const std::string& url, |
| 102 base::ListValue** cookies, | 99 base::ListValue** cookies, |
| 103 Error** error); | 100 Error** error); |
| 104 void DeleteCookie(const std::string& url, | 101 void DeleteCookie(const std::string& url, |
| 105 const std::string& cookie_name, | 102 const std::string& cookie_name, |
| 106 Error** error); | 103 Error** error); |
| 107 void SetCookie(const std::string& url, | 104 void SetCookie(const std::string& url, |
| 108 base::DictionaryValue* cookie_dict, | 105 base::DictionaryValue* cookie_dict, |
| 109 Error** error); | 106 Error** error); |
| 110 | 107 |
| 111 void MouseMove(int tab_id, const gfx::Point& p, Error** error); | 108 void MouseMove(int tab_id, const Point& p, Error** error); |
| 112 void MouseClick(int tab_id, | 109 void MouseClick(int tab_id, |
| 113 const gfx::Point& p, | 110 const Point& p, |
| 114 automation::MouseButton button, | 111 automation::MouseButton button, |
| 115 Error** error); | 112 Error** error); |
| 116 void MouseDrag(int tab_id, | 113 void MouseDrag(int tab_id, |
| 117 const gfx::Point& start, | 114 const Point& start, |
| 118 const gfx::Point& end, | 115 const Point& end, |
| 119 Error** error); | 116 Error** error); |
| 120 void MouseButtonDown(int tab_id, const gfx::Point& p, Error** error); | 117 void MouseButtonDown(int tab_id, const Point& p, Error** error); |
| 121 void MouseButtonUp(int tab_id, const gfx::Point& p, Error** error); | 118 void MouseButtonUp(int tab_id, const Point& p, Error** error); |
| 122 void MouseDoubleClick(int tab_id, const gfx::Point& p, Error** error); | 119 void MouseDoubleClick(int tab_id, const Point& p, Error** error); |
| 123 | 120 |
| 124 // Get persistent IDs for all the tabs currently open. These IDs can be used | 121 // Get persistent IDs for all the tabs currently open. These IDs can be used |
| 125 // to identify the tab as long as the tab exists. | 122 // to identify the tab as long as the tab exists. |
| 126 void GetTabIds(std::vector<int>* tab_ids, Error** error); | 123 void GetTabIds(std::vector<int>* tab_ids, Error** error); |
| 127 | 124 |
| 128 // Check if the given tab exists currently. | 125 // Check if the given tab exists currently. |
| 129 void DoesTabExist(int tab_id, bool* does_exist, Error** error); | 126 void DoesTabExist(int tab_id, bool* does_exist, Error** error); |
| 130 | 127 |
| 131 void CloseTab(int tab_id, Error** error); | 128 void CloseTab(int tab_id, Error** error); |
| 132 | 129 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 scoped_ptr<ProxyLauncher> launcher_; | 166 scoped_ptr<ProxyLauncher> launcher_; |
| 170 | 167 |
| 171 DISALLOW_COPY_AND_ASSIGN(Automation); | 168 DISALLOW_COPY_AND_ASSIGN(Automation); |
| 172 }; | 169 }; |
| 173 | 170 |
| 174 } // namespace webdriver | 171 } // namespace webdriver |
| 175 | 172 |
| 176 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Automation); | 173 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Automation); |
| 177 | 174 |
| 178 #endif // CHROME_TEST_WEBDRIVER_AUTOMATION_H_ | 175 #endif // CHROME_TEST_WEBDRIVER_AUTOMATION_H_ |
| OLD | NEW |