| 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> |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 bool MouseMove(const gfx::Point& location); | 91 bool MouseMove(const gfx::Point& location); |
| 92 bool MouseDrag(const gfx::Point& start, const gfx::Point& end); | 92 bool MouseDrag(const gfx::Point& start, const gfx::Point& end); |
| 93 | 93 |
| 94 bool NavigateToURL(const std::string& url); | 94 bool NavigateToURL(const std::string& url); |
| 95 bool GoForward(); | 95 bool GoForward(); |
| 96 bool GoBack(); | 96 bool GoBack(); |
| 97 bool Reload(); | 97 bool Reload(); |
| 98 bool GetURL(GURL* url); | 98 bool GetURL(GURL* url); |
| 99 bool GetURL(std::string* url); | 99 bool GetURL(std::string* url); |
| 100 bool GetTabTitle(std::string* tab_title); | 100 bool GetTabTitle(std::string* tab_title); |
| 101 bool GetScreenShot(std::string* png); |
| 101 | 102 |
| 102 bool GetCookies(const std::string& url, ListValue** cookies); | 103 bool GetCookies(const std::string& url, ListValue** cookies); |
| 103 bool GetCookiesDeprecated(const GURL& url, std::string* cookies); | 104 bool GetCookiesDeprecated(const GURL& url, std::string* cookies); |
| 104 bool GetCookieByNameDeprecated(const GURL& url, | 105 bool GetCookieByNameDeprecated(const GURL& url, |
| 105 const std::string& cookie_name, | 106 const std::string& cookie_name, |
| 106 std::string* cookie); | 107 std::string* cookie); |
| 107 bool DeleteCookie(const std::string& url, const std::string& cookie_name); | 108 bool DeleteCookie(const std::string& url, const std::string& cookie_name); |
| 108 bool DeleteCookieDeprecated(const GURL& url, const std::string& cookie_name); | 109 bool DeleteCookieDeprecated(const GURL& url, const std::string& cookie_name); |
| 109 bool SetCookie(const std::string& url, DictionaryValue* cookie_dict); | 110 bool SetCookie(const std::string& url, DictionaryValue* cookie_dict); |
| 110 bool SetCookieDeprecated(const GURL& url, const std::string& cookie); | 111 bool SetCookieDeprecated(const GURL& url, const std::string& cookie); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 int* border_top); | 188 int* border_top); |
| 188 | 189 |
| 189 // Gets whether the element is currently displayed. | 190 // Gets whether the element is currently displayed. |
| 190 ErrorCode IsElementDisplayed(const FrameId& frame_id, | 191 ErrorCode IsElementDisplayed(const FrameId& frame_id, |
| 191 const WebElementId& element, | 192 const WebElementId& element, |
| 192 bool* is_visible); | 193 bool* is_visible); |
| 193 | 194 |
| 194 // Waits for all tabs to stop loading. Returns true on success. | 195 // Waits for all tabs to stop loading. Returns true on success. |
| 195 bool WaitForAllTabsToStopLoading(); | 196 bool WaitForAllTabsToStopLoading(); |
| 196 | 197 |
| 197 inline const std::string& id() const { return id_; } | 198 const std::string& id() const; |
| 198 | 199 |
| 199 inline int implicit_wait() const { return implicit_wait_; } | 200 int implicit_wait() const; |
| 200 inline void set_implicit_wait(const int& timeout) { | 201 void set_implicit_wait(const int& timeout); |
| 201 implicit_wait_ = timeout > 0 ? timeout : 0; | |
| 202 } | |
| 203 | 202 |
| 204 enum Speed { kSlow, kMedium, kFast, kUnknown }; | 203 enum Speed { kSlow, kMedium, kFast, kUnknown }; |
| 205 inline Speed speed() { return speed_; } | 204 Speed speed() const; |
| 206 inline void set_speed(Speed speed) { | 205 void set_speed(Speed speed); |
| 207 speed_ = speed; | 206 |
| 208 } | 207 // Since screenshots can be very large when in base64 PNG format; the |
| 208 // client is allowed to dyamically enable/disable screenshots on error |
| 209 // during the lifetime of the session. |
| 210 bool screenshot_on_error() const; |
| 211 void set_screenshot_on_error(bool error); |
| 209 | 212 |
| 210 const FrameId& current_target() const; | 213 const FrameId& current_target() const; |
| 211 | 214 |
| 212 private: | 215 private: |
| 213 void RunSessionTask(Task* task); | 216 void RunSessionTask(Task* task); |
| 214 void RunSessionTaskOnSessionThread( | 217 void RunSessionTaskOnSessionThread( |
| 215 Task* task, | 218 Task* task, |
| 216 base::WaitableEvent* done_event); | 219 base::WaitableEvent* done_event); |
| 217 void InitOnSessionThread(const FilePath& browser_dir, bool* success); | 220 void InitOnSessionThread(const FilePath& browser_dir, bool* success); |
| 218 void TerminateOnSessionThread(); | 221 void TerminateOnSessionThread(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 230 const WebElementId& element, | 233 const WebElementId& element, |
| 231 const gfx::Rect& region, | 234 const gfx::Rect& region, |
| 232 gfx::Point* location); | 235 gfx::Point* location); |
| 233 | 236 |
| 234 const std::string id_; | 237 const std::string id_; |
| 235 | 238 |
| 236 scoped_ptr<Automation> automation_; | 239 scoped_ptr<Automation> automation_; |
| 237 base::Thread thread_; | 240 base::Thread thread_; |
| 238 | 241 |
| 239 int implicit_wait_; | 242 int implicit_wait_; |
| 243 bool screenshot_on_error_; |
| 240 Speed speed_; | 244 Speed speed_; |
| 241 | 245 |
| 242 FrameId current_target_; | 246 FrameId current_target_; |
| 243 | 247 |
| 244 DISALLOW_COPY_AND_ASSIGN(Session); | 248 DISALLOW_COPY_AND_ASSIGN(Session); |
| 245 }; | 249 }; |
| 246 | 250 |
| 247 } // namespace webdriver | 251 } // namespace webdriver |
| 248 | 252 |
| 249 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Session); | 253 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Session); |
| 250 | 254 |
| 251 #endif // CHROME_TEST_WEBDRIVER_SESSION_H_ | 255 #endif // CHROME_TEST_WEBDRIVER_SESSION_H_ |
| OLD | NEW |