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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 Error* GetBrowserConnectionState(bool* online); | 320 Error* GetBrowserConnectionState(bool* online); |
323 | 321 |
324 // Gets the status of the application cache. | 322 // Gets the status of the application cache. |
325 Error* GetAppCacheStatus(int* status); | 323 Error* GetAppCacheStatus(int* status); |
326 | 324 |
327 private: | 325 private: |
328 void RunSessionTask(Task* task); | 326 void RunSessionTask(Task* task); |
329 void RunSessionTaskOnSessionThread( | 327 void RunSessionTaskOnSessionThread( |
330 Task* task, | 328 Task* task, |
331 base::WaitableEvent* done_event); | 329 base::WaitableEvent* done_event); |
332 void InitOnSessionThread(const FilePath& browser_exe, | 330 void InitOnSessionThread(const Automation::BrowserOptions& options, |
333 const FilePath& user_data_dir, | |
334 const CommandLine& options, | |
335 Error** error); | 331 Error** error); |
336 void TerminateOnSessionThread(); | 332 void TerminateOnSessionThread(); |
337 | 333 |
338 // Executes the given |script| in the context of the given frame. | 334 // Executes the given |script| in the context of the given frame. |
339 // Waits for script to finish and parses the response. | 335 // Waits for script to finish and parses the response. |
340 // The caller is responsible for the script result |value|. | 336 // The caller is responsible for the script result |value|. |
341 Error* ExecuteScriptAndParseResponse(const FrameId& frame_id, | 337 Error* ExecuteScriptAndParseResponse(const FrameId& frame_id, |
342 const std::string& script, | 338 const std::string& script, |
343 base::Value** value); | 339 base::Value** value); |
344 | 340 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 Options options_; | 392 Options options_; |
397 | 393 |
398 DISALLOW_COPY_AND_ASSIGN(Session); | 394 DISALLOW_COPY_AND_ASSIGN(Session); |
399 }; | 395 }; |
400 | 396 |
401 } // namespace webdriver | 397 } // namespace webdriver |
402 | 398 |
403 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Session); | 399 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Session); |
404 | 400 |
405 #endif // CHROME_TEST_WEBDRIVER_SESSION_H_ | 401 #endif // CHROME_TEST_WEBDRIVER_SESSION_H_ |
OLD | NEW |