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" | |
13 #include "base/file_path.h" | 12 #include "base/file_path.h" |
14 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
16 #include "base/task.h" | 15 #include "base/task.h" |
17 #include "chrome/common/automation_constants.h" | 16 #include "chrome/common/automation_constants.h" |
18 #include "ui/base/keycodes/keyboard_codes.h" | 17 #include "ui/base/keycodes/keyboard_codes.h" |
19 | 18 |
20 class AutomationProxy; | 19 class AutomationProxy; |
| 20 class CommandLine; |
| 21 class FilePath; |
21 class ProxyLauncher; | 22 class ProxyLauncher; |
22 struct WebKeyEvent; | 23 struct WebKeyEvent; |
23 | 24 |
24 namespace base { | 25 namespace base { |
25 class DictionaryValue; | 26 class DictionaryValue; |
26 class ListValue; | 27 class ListValue; |
27 } | 28 } |
28 | 29 |
29 namespace gfx { | 30 namespace gfx { |
30 class Point; | 31 class Point; |
31 } | 32 } |
32 | 33 |
33 namespace webdriver { | 34 namespace webdriver { |
34 | 35 |
35 class Error; | 36 class Error; |
36 class FramePath; | 37 class FramePath; |
37 | 38 |
38 // Creates and controls the Chrome instance. | 39 // Creates and controls the Chrome instance. |
39 // This class should be created and accessed on a single thread. | 40 // This class should be created and accessed on a single thread. |
40 // Note: All member functions are void because they are invoked | 41 // Note: All member functions are void because they are invoked |
41 // by posting a task from NewRunnableMethod. | 42 // by posting a task from NewRunnableMethod. |
42 class Automation { | 43 class Automation { |
43 public: | 44 public: |
44 struct BrowserOptions { | |
45 BrowserOptions(); | |
46 ~BrowserOptions(); | |
47 | |
48 CommandLine cmdline; | |
49 FilePath user_data_dir; | |
50 std::string channel_id; | |
51 }; | |
52 | |
53 Automation(); | 45 Automation(); |
54 virtual ~Automation(); | 46 virtual ~Automation(); |
55 | 47 |
| 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 |
56 // Start the system's default Chrome binary. | 54 // Start the system's default Chrome binary. |
57 void Init(const BrowserOptions& options, Error** error); | 55 void Init(const CommandLine& options, |
| 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 |