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 Automation::BrowserOptions& options); | 82 Error* Init(const FilePath& browser_exe, |
| 83 const FilePath& user_data_dir, |
| 84 const CommandLine& options); |
83 | 85 |
84 // Should be called before executing a command. Performs necessary waits | 86 // Should be called before executing a command. Performs necessary waits |
85 // and frame switching. | 87 // and frame switching. |
86 Error* BeforeExecuteCommand(); | 88 Error* BeforeExecuteCommand(); |
87 | 89 |
88 // Terminates this session and deletes itself. | 90 // Terminates this session and deletes itself. |
89 void Terminate(); | 91 void Terminate(); |
90 | 92 |
91 // Executes the given |script| in the context of the given frame. | 93 // Executes the given |script| in the context of the given frame. |
92 // The |script| should be in the form of a function body | 94 // The |script| should be in the form of a function body |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 Error* GetBrowserConnectionState(bool* online); | 322 Error* GetBrowserConnectionState(bool* online); |
321 | 323 |
322 // Gets the status of the application cache. | 324 // Gets the status of the application cache. |
323 Error* GetAppCacheStatus(int* status); | 325 Error* GetAppCacheStatus(int* status); |
324 | 326 |
325 private: | 327 private: |
326 void RunSessionTask(Task* task); | 328 void RunSessionTask(Task* task); |
327 void RunSessionTaskOnSessionThread( | 329 void RunSessionTaskOnSessionThread( |
328 Task* task, | 330 Task* task, |
329 base::WaitableEvent* done_event); | 331 base::WaitableEvent* done_event); |
330 void InitOnSessionThread(const Automation::BrowserOptions& options, | 332 void InitOnSessionThread(const FilePath& browser_exe, |
| 333 const FilePath& user_data_dir, |
| 334 const CommandLine& options, |
331 Error** error); | 335 Error** error); |
332 void TerminateOnSessionThread(); | 336 void TerminateOnSessionThread(); |
333 | 337 |
334 // Executes the given |script| in the context of the given frame. | 338 // Executes the given |script| in the context of the given frame. |
335 // Waits for script to finish and parses the response. | 339 // Waits for script to finish and parses the response. |
336 // The caller is responsible for the script result |value|. | 340 // The caller is responsible for the script result |value|. |
337 Error* ExecuteScriptAndParseResponse(const FrameId& frame_id, | 341 Error* ExecuteScriptAndParseResponse(const FrameId& frame_id, |
338 const std::string& script, | 342 const std::string& script, |
339 base::Value** value); | 343 base::Value** value); |
340 | 344 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 Options options_; | 396 Options options_; |
393 | 397 |
394 DISALLOW_COPY_AND_ASSIGN(Session); | 398 DISALLOW_COPY_AND_ASSIGN(Session); |
395 }; | 399 }; |
396 | 400 |
397 } // namespace webdriver | 401 } // namespace webdriver |
398 | 402 |
399 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Session); | 403 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Session); |
400 | 404 |
401 #endif // CHROME_TEST_WEBDRIVER_SESSION_H_ | 405 #endif // CHROME_TEST_WEBDRIVER_SESSION_H_ |
OLD | NEW |