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_AUTOMATION_H_ | 5 #ifndef CHROME_TEST_WEBDRIVER_AUTOMATION_H_ |
6 #define CHROME_TEST_WEBDRIVER_AUTOMATION_H_ | 6 #define CHROME_TEST_WEBDRIVER_AUTOMATION_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
| 12 #include "base/command_line.h" |
12 #include "base/file_path.h" | 13 #include "base/file_path.h" |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "base/task.h" | 16 #include "base/task.h" |
16 #include "chrome/common/automation_constants.h" | 17 #include "chrome/common/automation_constants.h" |
17 #include "ui/base/keycodes/keyboard_codes.h" | 18 #include "ui/base/keycodes/keyboard_codes.h" |
18 | 19 |
19 class AutomationProxy; | 20 class AutomationProxy; |
20 class CommandLine; | |
21 class FilePath; | |
22 class ProxyLauncher; | 21 class ProxyLauncher; |
23 struct WebKeyEvent; | 22 struct WebKeyEvent; |
24 | 23 |
25 namespace base { | 24 namespace base { |
26 class DictionaryValue; | 25 class DictionaryValue; |
27 class ListValue; | 26 class ListValue; |
28 } | 27 } |
29 | 28 |
30 namespace gfx { | 29 namespace gfx { |
31 class Point; | 30 class Point; |
32 } | 31 } |
33 | 32 |
34 namespace webdriver { | 33 namespace webdriver { |
35 | 34 |
36 class Error; | 35 class Error; |
37 class FramePath; | 36 class FramePath; |
38 | 37 |
39 // Creates and controls the Chrome instance. | 38 // Creates and controls the Chrome instance. |
40 // This class should be created and accessed on a single thread. | 39 // This class should be created and accessed on a single thread. |
41 // Note: All member functions are void because they are invoked | 40 // Note: All member functions are void because they are invoked |
42 // by posting a task from NewRunnableMethod. | 41 // by posting a task from NewRunnableMethod. |
43 class Automation { | 42 class Automation { |
44 public: | 43 public: |
| 44 struct BrowserOptions { |
| 45 BrowserOptions(); |
| 46 ~BrowserOptions(); |
| 47 |
| 48 CommandLine command; |
| 49 FilePath user_data_dir; |
| 50 std::string channel_id; |
| 51 }; |
| 52 |
45 Automation(); | 53 Automation(); |
46 virtual ~Automation(); | 54 virtual ~Automation(); |
47 | 55 |
48 // Creates a browser, using the specified |browser_exe| and |user_data_dir|. | |
49 void InitWithBrowserPath(const FilePath& browser_exe, | |
50 const FilePath& user_data_dir, | |
51 const CommandLine& options, | |
52 Error** error); | |
53 | |
54 // Start the system's default Chrome binary. | 56 // Start the system's default Chrome binary. |
55 void Init(const CommandLine& options, | 57 void Init(const BrowserOptions& options, Error** error); |
56 const FilePath& user_data_dir, | |
57 Error** error); | |
58 | 58 |
59 // Terminates this session and disconnects its automation proxy. After | 59 // Terminates this session and disconnects its automation proxy. After |
60 // invoking this method, the Automation can safely be deleted. | 60 // invoking this method, the Automation can safely be deleted. |
61 void Terminate(); | 61 void Terminate(); |
62 | 62 |
63 // Executes the given |script| in the specified frame of the current | 63 // Executes the given |script| in the specified frame of the current |
64 // tab. |result| will be set to the JSON result. Returns true on success. | 64 // tab. |result| will be set to the JSON result. Returns true on success. |
65 void ExecuteScript(int tab_id, | 65 void ExecuteScript(int tab_id, |
66 const FramePath& frame_path, | 66 const FramePath& frame_path, |
67 const std::string& script, | 67 const std::string& script, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 scoped_ptr<ProxyLauncher> launcher_; | 169 scoped_ptr<ProxyLauncher> launcher_; |
170 | 170 |
171 DISALLOW_COPY_AND_ASSIGN(Automation); | 171 DISALLOW_COPY_AND_ASSIGN(Automation); |
172 }; | 172 }; |
173 | 173 |
174 } // namespace webdriver | 174 } // namespace webdriver |
175 | 175 |
176 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Automation); | 176 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Automation); |
177 | 177 |
178 #endif // CHROME_TEST_WEBDRIVER_AUTOMATION_H_ | 178 #endif // CHROME_TEST_WEBDRIVER_AUTOMATION_H_ |
OLD | NEW |