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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 // Removes this |Session| from the |SessionManager|. | 73 // Removes this |Session| from the |SessionManager|. |
74 ~Session(); | 74 ~Session(); |
75 | 75 |
76 // Starts the session thread and a new browser, using the exe found at | 76 // Starts the session thread and a new browser, using the exe found at |
77 // |browser_exe| and duplicating the provided |user_data_dir|. | 77 // |browser_exe| and duplicating the provided |user_data_dir|. |
78 // If |browser_exe| is empty, it will search in all the default locations. | 78 // If |browser_exe| is empty, it will search in all the default locations. |
79 // It |user_data_dir| is empty, it will use a temporary dir. | 79 // It |user_data_dir| is empty, it will use a temporary dir. |
80 // Returns true on success. On failure, the session will delete | 80 // Returns true on success. On failure, the session will delete |
81 // itself and return an error code. | 81 // itself and return an error code. |
82 Error* Init(const FilePath& browser_exe, | 82 Error* Init(const Automation::BrowserOptions& options); |
83 const FilePath& user_data_dir, | |
84 const CommandLine& options); | |
85 | 83 |
86 // Should be called before executing a command. Performs necessary waits | 84 // Should be called before executing a command. Performs necessary waits |
87 // and frame switching. | 85 // and frame switching. |
88 Error* BeforeExecuteCommand(); | 86 Error* BeforeExecuteCommand(); |
89 | 87 |
90 // Terminates this session and deletes itself. | 88 // Terminates this session and deletes itself. |
91 void Terminate(); | 89 void Terminate(); |
92 | 90 |
93 // Executes the given |script| in the context of the given frame. | 91 // Executes the given |script| in the context of the given frame. |
94 // The |script| should be in the form of a function body | 92 // The |script| should be in the form of a function body |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 | 314 |
317 const gfx::Point& get_mouse_position() const; | 315 const gfx::Point& get_mouse_position() const; |
318 | 316 |
319 const Options& options() const; | 317 const Options& options() const; |
320 | 318 |
321 private: | 319 private: |
322 void RunSessionTask(Task* task); | 320 void RunSessionTask(Task* task); |
323 void RunSessionTaskOnSessionThread( | 321 void RunSessionTaskOnSessionThread( |
324 Task* task, | 322 Task* task, |
325 base::WaitableEvent* done_event); | 323 base::WaitableEvent* done_event); |
326 void InitOnSessionThread(const FilePath& browser_exe, | 324 void InitOnSessionThread(const Automation::BrowserOptions& options, |
327 const FilePath& user_data_dir, | |
328 const CommandLine& options, | |
329 Error** error); | 325 Error** error); |
330 void TerminateOnSessionThread(); | 326 void TerminateOnSessionThread(); |
331 | 327 |
332 // Executes the given |script| in the context of the given frame. | 328 // Executes the given |script| in the context of the given frame. |
333 // Waits for script to finish and parses the response. | 329 // Waits for script to finish and parses the response. |
334 // The caller is responsible for the script result |value|. | 330 // The caller is responsible for the script result |value|. |
335 Error* ExecuteScriptAndParseResponse(const FrameId& frame_id, | 331 Error* ExecuteScriptAndParseResponse(const FrameId& frame_id, |
336 const std::string& script, | 332 const std::string& script, |
337 base::Value** value); | 333 base::Value** value); |
338 | 334 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 Options options_; | 386 Options options_; |
391 | 387 |
392 DISALLOW_COPY_AND_ASSIGN(Session); | 388 DISALLOW_COPY_AND_ASSIGN(Session); |
393 }; | 389 }; |
394 | 390 |
395 } // namespace webdriver | 391 } // namespace webdriver |
396 | 392 |
397 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Session); | 393 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Session); |
398 | 394 |
399 #endif // CHROME_TEST_WEBDRIVER_SESSION_H_ | 395 #endif // CHROME_TEST_WEBDRIVER_SESSION_H_ |
OLD | NEW |