| 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/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/task.h" | 15 #include "base/task.h" |
| 16 #include "chrome/common/automation_constants.h" | 16 #include "chrome/common/automation_constants.h" |
| 17 #include "ui/base/keycodes/keyboard_codes.h" | 17 #include "ui/base/keycodes/keyboard_codes.h" |
| 18 | 18 |
| 19 class AutomationProxy; | 19 class AutomationProxy; |
| 20 class CommandLine; | 20 class CommandLine; |
| 21 class FilePath; | 21 class FilePath; |
| 22 class ProxyLauncher; | 22 class ProxyLauncher; |
| 23 struct WebKeyEvent; | 23 struct WebKeyEvent; |
| 24 | 24 |
| 25 namespace base { | 25 namespace base { |
| 26 class DictionaryValue; | 26 class DictionaryValue; |
| 27 class ListValue; | 27 class ListValue; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace gfx { | |
| 31 class Point; | |
| 32 } | |
| 33 | |
| 34 namespace webdriver { | 30 namespace webdriver { |
| 35 | 31 |
| 36 class Error; | 32 class Error; |
| 37 class FramePath; | 33 class FramePath; |
| 34 class Point; |
| 38 | 35 |
| 39 // Creates and controls the Chrome instance. | 36 // Creates and controls the Chrome instance. |
| 40 // This class should be created and accessed on a single thread. | 37 // This class should be created and accessed on a single thread. |
| 41 // Note: All member functions are void because they are invoked | 38 // Note: All member functions are void because they are invoked |
| 42 // by posting a task from NewRunnableMethod. | 39 // by posting a task from NewRunnableMethod. |
| 43 class Automation { | 40 class Automation { |
| 44 public: | 41 public: |
| 45 Automation(); | 42 Automation(); |
| 46 virtual ~Automation(); | 43 virtual ~Automation(); |
| 47 | 44 |
| (...skipping 28 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 GoForward(int tab_id, Error** error); | 93 void GoForward(int tab_id, Error** error); |
| 97 void GoBack(int tab_id, Error** error); | 94 void GoBack(int tab_id, Error** error); |
| 98 void Reload(int tab_id, Error** error); | 95 void Reload(int tab_id, Error** error); |
| 99 | 96 |
| 100 void GetCookies(const std::string& url, | 97 void GetCookies(const std::string& url, |
| 101 base::ListValue** cookies, | 98 base::ListValue** cookies, |
| 102 Error** error); | 99 Error** error); |
| 103 void DeleteCookie(const std::string& url, | 100 void DeleteCookie(const std::string& url, |
| 104 const std::string& cookie_name, | 101 const std::string& cookie_name, |
| 105 Error** error); | 102 Error** error); |
| 106 void SetCookie(const std::string& url, | 103 void SetCookie(const std::string& url, |
| 107 base::DictionaryValue* cookie_dict, | 104 base::DictionaryValue* cookie_dict, |
| 108 Error** error); | 105 Error** error); |
| 109 | 106 |
| 110 void MouseMove(int tab_id, const gfx::Point& p, Error** error); | 107 void MouseMove(int tab_id, const Point& p, Error** error); |
| 111 void MouseClick(int tab_id, | 108 void MouseClick(int tab_id, |
| 112 const gfx::Point& p, | 109 const Point& p, |
| 113 automation::MouseButton button, | 110 automation::MouseButton button, |
| 114 Error** error); | 111 Error** error); |
| 115 void MouseDrag(int tab_id, | 112 void MouseDrag(int tab_id, |
| 116 const gfx::Point& start, | 113 const Point& start, |
| 117 const gfx::Point& end, | 114 const Point& end, |
| 118 Error** error); | 115 Error** error); |
| 119 void MouseButtonDown(int tab_id, const gfx::Point& p, Error** error); | 116 void MouseButtonDown(int tab_id, const Point& p, Error** error); |
| 120 void MouseButtonUp(int tab_id, const gfx::Point& p, Error** error); | 117 void MouseButtonUp(int tab_id, const Point& p, Error** error); |
| 121 void MouseDoubleClick(int tab_id, const gfx::Point& p, Error** error); | 118 void MouseDoubleClick(int tab_id, const Point& p, Error** error); |
| 122 | 119 |
| 123 // Get persistent IDs for all the tabs currently open. These IDs can be used | 120 // Get persistent IDs for all the tabs currently open. These IDs can be used |
| 124 // to identify the tab as long as the tab exists. | 121 // to identify the tab as long as the tab exists. |
| 125 void GetTabIds(std::vector<int>* tab_ids, Error** error); | 122 void GetTabIds(std::vector<int>* tab_ids, Error** error); |
| 126 | 123 |
| 127 // Check if the given tab exists currently. | 124 // Check if the given tab exists currently. |
| 128 void DoesTabExist(int tab_id, bool* does_exist, Error** error); | 125 void DoesTabExist(int tab_id, bool* does_exist, Error** error); |
| 129 | 126 |
| 130 void CloseTab(int tab_id, Error** error); | 127 void CloseTab(int tab_id, Error** error); |
| 131 | 128 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 scoped_ptr<ProxyLauncher> launcher_; | 162 scoped_ptr<ProxyLauncher> launcher_; |
| 166 | 163 |
| 167 DISALLOW_COPY_AND_ASSIGN(Automation); | 164 DISALLOW_COPY_AND_ASSIGN(Automation); |
| 168 }; | 165 }; |
| 169 | 166 |
| 170 } // namespace webdriver | 167 } // namespace webdriver |
| 171 | 168 |
| 172 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Automation); | 169 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Automation); |
| 173 | 170 |
| 174 #endif // CHROME_TEST_WEBDRIVER_AUTOMATION_H_ | 171 #endif // CHROME_TEST_WEBDRIVER_AUTOMATION_H_ |
| OLD | NEW |