| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 Session(); | 58 Session(); |
| 59 // Removes this |Session| from the |SessionManager|. | 59 // Removes this |Session| from the |SessionManager|. |
| 60 ~Session(); | 60 ~Session(); |
| 61 | 61 |
| 62 // Starts the session thread and a new browser, using the exe found at | 62 // Starts the session thread and a new browser, using the exe found at |
| 63 // |browser_exe| and duplicating the provided |user_data_dir|. | 63 // |browser_exe| and duplicating the provided |user_data_dir|. |
| 64 // If |browser_exe| is empty, it will search in all the default locations. | 64 // If |browser_exe| is empty, it will search in all the default locations. |
| 65 // It |user_data_dir| is empty, it will use a temporary dir. | 65 // It |user_data_dir| is empty, it will use a temporary dir. |
| 66 // Returns true on success. On failure, the session will delete | 66 // Returns true on success. On failure, the session will delete |
| 67 // itself and return an error code. | 67 // itself and return an error code. |
| 68 Error* Init(const FilePath& browser_exe, | 68 Error* Init(const Automation::InitOptions& options); |
| 69 const FilePath& user_data_dir, | |
| 70 const CommandLine& options); | |
| 71 | 69 |
| 72 // Terminates this session and deletes itself. | 70 // Terminates this session and deletes itself. |
| 73 void Terminate(); | 71 void Terminate(); |
| 74 | 72 |
| 75 // Executes the given |script| in the context of the given frame. | 73 // Executes the given |script| in the context of the given frame. |
| 76 // The |script| should be in the form of a function body | 74 // The |script| should be in the form of a function body |
| 77 // (e.g. "return arguments[0]"), where |args| is the list of arguments to | 75 // (e.g. "return arguments[0]"), where |args| is the list of arguments to |
| 78 // pass to the function. The caller is responsible for the script result | 76 // pass to the function. The caller is responsible for the script result |
| 79 // |value|, which is set only if there is no error. | 77 // |value|, which is set only if there is no error. |
| 80 Error* ExecuteScript(const FrameId& frame_id, | 78 Error* ExecuteScript(const FrameId& frame_id, |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 void set_use_native_events(bool use_native_events); | 288 void set_use_native_events(bool use_native_events); |
| 291 bool use_native_events() const; | 289 bool use_native_events() const; |
| 292 | 290 |
| 293 const gfx::Point& get_mouse_position() const; | 291 const gfx::Point& get_mouse_position() const; |
| 294 | 292 |
| 295 private: | 293 private: |
| 296 void RunSessionTask(Task* task); | 294 void RunSessionTask(Task* task); |
| 297 void RunSessionTaskOnSessionThread( | 295 void RunSessionTaskOnSessionThread( |
| 298 Task* task, | 296 Task* task, |
| 299 base::WaitableEvent* done_event); | 297 base::WaitableEvent* done_event); |
| 300 void InitOnSessionThread(const FilePath& browser_exe, | 298 void InitOnSessionThread(const Automation::InitOptions& options, |
| 301 const FilePath& user_data_dir, | |
| 302 const CommandLine& options, | |
| 303 Error** error); | 299 Error** error); |
| 304 void TerminateOnSessionThread(); | 300 void TerminateOnSessionThread(); |
| 305 | 301 |
| 306 // Executes the given |script| in the context of the given frame. | 302 // Executes the given |script| in the context of the given frame. |
| 307 // Waits for script to finish and parses the response. | 303 // Waits for script to finish and parses the response. |
| 308 // The caller is responsible for the script result |value|. | 304 // The caller is responsible for the script result |value|. |
| 309 Error* ExecuteScriptAndParseResponse(const FrameId& frame_id, | 305 Error* ExecuteScriptAndParseResponse(const FrameId& frame_id, |
| 310 const std::string& script, | 306 const std::string& script, |
| 311 base::Value** value); | 307 base::Value** value); |
| 312 | 308 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 bool has_alert_prompt_text_; | 367 bool has_alert_prompt_text_; |
| 372 | 368 |
| 373 DISALLOW_COPY_AND_ASSIGN(Session); | 369 DISALLOW_COPY_AND_ASSIGN(Session); |
| 374 }; | 370 }; |
| 375 | 371 |
| 376 } // namespace webdriver | 372 } // namespace webdriver |
| 377 | 373 |
| 378 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Session); | 374 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Session); |
| 379 | 375 |
| 380 #endif // CHROME_TEST_WEBDRIVER_SESSION_H_ | 376 #endif // CHROME_TEST_WEBDRIVER_SESSION_H_ |
| OLD | NEW |