OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file declares the C++ side of PyAuto, the python interface to | 5 // This file declares the C++ side of PyAuto, the python interface to |
6 // Chromium automation. It access Chromium's internals using Automation Proxy. | 6 // Chromium automation. It access Chromium's internals using Automation Proxy. |
7 | 7 |
8 #ifndef CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ | 8 #ifndef CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ |
9 #define CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ | 9 #define CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ |
10 | 10 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 // Get the URL of the active tab. | 72 // Get the URL of the active tab. |
73 GURL GetActiveTabURL(int window_index = 0); | 73 GURL GetActiveTabURL(int window_index = 0); |
74 | 74 |
75 int GetTabCount(int window_index = 0); | 75 int GetTabCount(int window_index = 0); |
76 | 76 |
77 // Activate the tab at the given zero-based index in the given or first | 77 // Activate the tab at the given zero-based index in the given or first |
78 // browser window. Also brings the window to front. | 78 // browser window. Also brings the window to front. |
79 bool ActivateTab(int tab_index, int window_index = 0); | 79 bool ActivateTab(int tab_index, int window_index = 0); |
80 | 80 |
81 // Shows or hides the download shelf. | |
82 void SetDownloadShelfVisible(bool is_visible, int window_index = 0); | |
83 | |
84 // Determines the visibility of the download shelf | |
85 bool IsDownloadShelfVisible(int window_index = 0); | |
86 | |
87 // Open the Find box | 81 // Open the Find box |
88 void OpenFindInPage(int window_index = 0); | 82 void OpenFindInPage(int window_index = 0); |
89 | 83 |
90 // Determines the visibility of the Find box | 84 // Determines the visibility of the Find box |
91 bool IsFindInPageVisible(int window_index = 0); | 85 bool IsFindInPageVisible(int window_index = 0); |
92 | 86 |
93 // Get the path to the downloads directory | |
94 FilePath GetDownloadDirectory(); | |
95 | |
96 // AutomationProxy methods | 87 // AutomationProxy methods |
97 | 88 |
98 // Open a new browser window. Returns false on failure. | 89 // Open a new browser window. Returns false on failure. |
99 bool OpenNewBrowserWindow(bool show); | 90 bool OpenNewBrowserWindow(bool show); |
100 | 91 |
101 // Close a browser window. Returns false on failure. | 92 // Close a browser window. Returns false on failure. |
102 bool CloseBrowserWindow(int window_index); | 93 bool CloseBrowserWindow(int window_index); |
103 | 94 |
104 // Fetch the number of browser windows. Includes popups. | 95 // Fetch the number of browser windows. Includes popups. |
105 int GetBrowserWindowCount(); | 96 int GetBrowserWindowCount(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // automation proxy additions. Returns response as JSON dict. | 144 // automation proxy additions. Returns response as JSON dict. |
154 // Use -ve window_index for automation calls not targetted at a browser | 145 // Use -ve window_index for automation calls not targetted at a browser |
155 // window. Example: Login call for chromeos. | 146 // window. Example: Login call for chromeos. |
156 std::string _SendJSONRequest(int window_index, | 147 std::string _SendJSONRequest(int window_index, |
157 const std::string& request, | 148 const std::string& request, |
158 int timeout); | 149 int timeout); |
159 | 150 |
160 // Resets to the default theme. Returns true on success. | 151 // Resets to the default theme. Returns true on success. |
161 bool ResetToDefaultTheme(); | 152 bool ResetToDefaultTheme(); |
162 | 153 |
163 // Sets a cookie value for a url. Returns true on success. | |
164 bool SetCookie(const GURL& cookie_url, const std::string& value, | |
165 int window_index = 0, int tab_index = 0); | |
166 // Gets a cookie value for the given url. | |
167 std::string GetCookie(const GURL& cookie_url, int window_index = 0, | |
168 int tab_index = 0); | |
169 | |
170 int action_max_timeout_ms() const { | 154 int action_max_timeout_ms() const { |
171 return TestTimeouts::action_max_timeout_ms(); | 155 return TestTimeouts::action_max_timeout_ms(); |
172 } | 156 } |
173 | 157 |
174 int large_test_timeout_ms() const { | 158 int large_test_timeout_ms() const { |
175 return TestTimeouts::large_test_timeout_ms(); | 159 return TestTimeouts::large_test_timeout_ms(); |
176 } | 160 } |
177 | 161 |
178 protected: | 162 protected: |
179 // Gets the automation proxy and checks that it exists. | 163 // Gets the automation proxy and checks that it exists. |
(...skipping 21 matching lines...) Expand all Loading... |
201 // This is necessary since python's unittest module creates instances of | 185 // This is necessary since python's unittest module creates instances of |
202 // TestCase at load time itself. | 186 // TestCase at load time itself. |
203 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); | 187 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); |
204 static MessageLoop* message_loop_; | 188 static MessageLoop* message_loop_; |
205 | 189 |
206 // Path to named channel id. | 190 // Path to named channel id. |
207 std::string named_channel_id_; | 191 std::string named_channel_id_; |
208 }; | 192 }; |
209 | 193 |
210 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ | 194 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ |
OLD | NEW |