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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 void set_use_native_events(bool use_native_events); | 285 void set_use_native_events(bool use_native_events); |
288 bool use_native_events() const; | 286 bool use_native_events() const; |
289 | 287 |
290 const gfx::Point& get_mouse_position() const; | 288 const gfx::Point& get_mouse_position() const; |
291 | 289 |
292 private: | 290 private: |
293 void RunSessionTask(Task* task); | 291 void RunSessionTask(Task* task); |
294 void RunSessionTaskOnSessionThread( | 292 void RunSessionTaskOnSessionThread( |
295 Task* task, | 293 Task* task, |
296 base::WaitableEvent* done_event); | 294 base::WaitableEvent* done_event); |
297 void InitOnSessionThread(const FilePath& browser_exe, | 295 void InitOnSessionThread(const Automation::InitOptions& options, |
298 const FilePath& user_data_dir, | |
299 const CommandLine& options, | |
300 Error** error); | 296 Error** error); |
301 void TerminateOnSessionThread(); | 297 void TerminateOnSessionThread(); |
302 | 298 |
303 // Executes the given |script| in the context of the given frame. | 299 // Executes the given |script| in the context of the given frame. |
304 // Waits for script to finish and parses the response. | 300 // Waits for script to finish and parses the response. |
305 // The caller is responsible for the script result |value|. | 301 // The caller is responsible for the script result |value|. |
306 Error* ExecuteScriptAndParseResponse(const FrameId& frame_id, | 302 Error* ExecuteScriptAndParseResponse(const FrameId& frame_id, |
307 const std::string& script, | 303 const std::string& script, |
308 base::Value** value); | 304 base::Value** value); |
309 | 305 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 bool has_alert_prompt_text_; | 364 bool has_alert_prompt_text_; |
369 | 365 |
370 DISALLOW_COPY_AND_ASSIGN(Session); | 366 DISALLOW_COPY_AND_ASSIGN(Session); |
371 }; | 367 }; |
372 | 368 |
373 } // namespace webdriver | 369 } // namespace webdriver |
374 | 370 |
375 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Session); | 371 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Session); |
376 | 372 |
377 #endif // CHROME_TEST_WEBDRIVER_SESSION_H_ | 373 #endif // CHROME_TEST_WEBDRIVER_SESSION_H_ |
OLD | NEW |