| 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_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/file_path.h" | 13 #include "base/file_path.h" |
| 13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/string16.h" | 15 #include "base/string16.h" |
| 15 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
| 16 #include "chrome/common/automation_constants.h" | 17 #include "chrome/common/automation_constants.h" |
| 17 #include "chrome/test/webdriver/frame_path.h" | 18 #include "chrome/test/webdriver/frame_path.h" |
| 18 #include "chrome/test/webdriver/webdriver_automation.h" | 19 #include "chrome/test/webdriver/webdriver_automation.h" |
| 19 #include "chrome/test/webdriver/webdriver_basic_types.h" | 20 #include "chrome/test/webdriver/webdriver_basic_types.h" |
| 20 #include "chrome/test/webdriver/webdriver_element_id.h" | 21 #include "chrome/test/webdriver/webdriver_element_id.h" |
| 21 | 22 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 301 |
| 301 // Gets the attribute of the given element. If there are no errors, the | 302 // Gets the attribute of the given element. If there are no errors, the |
| 302 // function sets |value| and the caller takes ownership. | 303 // function sets |value| and the caller takes ownership. |
| 303 Error* GetAttribute(const ElementId& element, const std::string& key, | 304 Error* GetAttribute(const ElementId& element, const std::string& key, |
| 304 base::Value** value); | 305 base::Value** value); |
| 305 | 306 |
| 306 // Waits for all tabs to stop loading. Returns true on success. | 307 // Waits for all tabs to stop loading. Returns true on success. |
| 307 Error* WaitForAllTabsToStopLoading(); | 308 Error* WaitForAllTabsToStopLoading(); |
| 308 | 309 |
| 309 // Install packed extension at |path|. | 310 // Install packed extension at |path|. |
| 310 Error* InstallExtension(const FilePath& path); | 311 Error* InstallExtensionDeprecated(const FilePath& path); |
| 312 |
| 313 // Get installed extensions IDs. |
| 314 Error* GetInstalledExtensions(std::vector<std::string>* extension_ids); |
| 315 |
| 316 // Install extension at |path|. |
| 317 Error* InstallExtension(const FilePath& path, std::string* extension_id); |
| 311 | 318 |
| 312 const std::string& id() const; | 319 const std::string& id() const; |
| 313 | 320 |
| 314 const FrameId& current_target() const; | 321 const FrameId& current_target() const; |
| 315 | 322 |
| 316 void set_async_script_timeout(int timeout_ms); | 323 void set_async_script_timeout(int timeout_ms); |
| 317 int async_script_timeout() const; | 324 int async_script_timeout() const; |
| 318 | 325 |
| 319 void set_implicit_wait(int timeout_ms); | 326 void set_implicit_wait(int timeout_ms); |
| 320 int implicit_wait() const; | 327 int implicit_wait() const; |
| 321 | 328 |
| 322 const Point& get_mouse_position() const; | 329 const Point& get_mouse_position() const; |
| 323 | 330 |
| 324 const Options& options() const; | 331 const Options& options() const; |
| 325 | 332 |
| 326 // Gets the browser connection state. | 333 // Gets the browser connection state. |
| 327 Error* GetBrowserConnectionState(bool* online); | 334 Error* GetBrowserConnectionState(bool* online); |
| 328 | 335 |
| 329 // Gets the status of the application cache. | 336 // Gets the status of the application cache. |
| 330 Error* GetAppCacheStatus(int* status); | 337 Error* GetAppCacheStatus(int* status); |
| 331 | 338 |
| 332 private: | 339 private: |
| 333 void RunSessionTask(Task* task); | 340 void RunSessionTask(Task* task); |
| 334 void RunSessionTaskOnSessionThread( | 341 void RunSessionTaskOnSessionThread( |
| 335 Task* task, | 342 Task* task, |
| 336 base::WaitableEvent* done_event); | 343 base::WaitableEvent* done_event); |
| 344 void RunSessionTask(const base::Closure& task); |
| 345 void RunClosureOnSessionThread( |
| 346 const base::Closure& task, |
| 347 base::WaitableEvent* done_event); |
| 337 void InitOnSessionThread(const Automation::BrowserOptions& options, | 348 void InitOnSessionThread(const Automation::BrowserOptions& options, |
| 338 Error** error); | 349 Error** error); |
| 339 void TerminateOnSessionThread(); | 350 void TerminateOnSessionThread(); |
| 340 | 351 |
| 341 // Executes the given |script| in the context of the given frame. | 352 // Executes the given |script| in the context of the given frame. |
| 342 // Waits for script to finish and parses the response. | 353 // Waits for script to finish and parses the response. |
| 343 // The caller is responsible for the script result |value|. | 354 // The caller is responsible for the script result |value|. |
| 344 Error* ExecuteScriptAndParseValue(const FrameId& frame_id, | 355 Error* ExecuteScriptAndParseValue(const FrameId& frame_id, |
| 345 const std::string& script, | 356 const std::string& script, |
| 346 base::Value** value); | 357 base::Value** value); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 Options options_; | 416 Options options_; |
| 406 | 417 |
| 407 DISALLOW_COPY_AND_ASSIGN(Session); | 418 DISALLOW_COPY_AND_ASSIGN(Session); |
| 408 }; | 419 }; |
| 409 | 420 |
| 410 } // namespace webdriver | 421 } // namespace webdriver |
| 411 | 422 |
| 412 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Session); | 423 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Session); |
| 413 | 424 |
| 414 #endif // CHROME_TEST_WEBDRIVER_WEBDRIVER_SESSION_H_ | 425 #endif // CHROME_TEST_WEBDRIVER_WEBDRIVER_SESSION_H_ |
| OLD | NEW |