Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Side by Side Diff: chrome/test/automation/automation_proxy.h

Issue 113722: Make automation proxy objects to ref_counted. That allows to process async no... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_AUTOMATION_AUTOMATION_PROXY_H__ 5 #ifndef CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H__
6 #define CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H__ 6 #define CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H__
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "app/message_box_flags.h" 10 #include "app/message_box_flags.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // Block the thread until one of the tabs in any window (including windows 113 // Block the thread until one of the tabs in any window (including windows
114 // opened after the call) displays given url. Returns true on success. 114 // opened after the call) displays given url. Returns true on success.
115 bool WaitForURLDisplayed(GURL url, int wait_timeout); 115 bool WaitForURLDisplayed(GURL url, int wait_timeout);
116 116
117 // Returns the BrowserProxy for the browser window at the given index, 117 // Returns the BrowserProxy for the browser window at the given index,
118 // transferring ownership of the pointer to the caller. 118 // transferring ownership of the pointer to the caller.
119 // On failure, returns NULL. 119 // On failure, returns NULL.
120 // 120 //
121 // Use GetBrowserWindowCount to see how many browser windows you can ask for. 121 // Use GetBrowserWindowCount to see how many browser windows you can ask for.
122 // Window numbers are 0-based. 122 // Window numbers are 0-based.
123 BrowserProxy* GetBrowserWindow(int window_index); 123 scoped_refptr<BrowserProxy> GetBrowserWindow(int window_index);
124 124
125 // Finds the first browser window that is not incognito mode and of type 125 // Finds the first browser window that is not incognito mode and of type
126 // TYPE_NORMAL, and returns its corresponding BrowserProxy, transferring 126 // TYPE_NORMAL, and returns its corresponding BrowserProxy, transferring
127 // ownership of the pointer to the caller. 127 // ownership of the pointer to the caller.
128 // On failure, returns NULL. 128 // On failure, returns NULL.
129 BrowserProxy* FindNormalBrowserWindow(); 129 scoped_refptr<BrowserProxy> FindNormalBrowserWindow();
130 130
131 // Returns the BrowserProxy for the browser window which was last active, 131 // Returns the BrowserProxy for the browser window which was last active,
132 // transferring ownership of the pointer to the caller. 132 // transferring ownership of the pointer to the caller.
133 // TODO: If there was no last active browser window, or the last active 133 // TODO: If there was no last active browser window, or the last active
134 // browser window no longer exists (for example, if it was closed), 134 // browser window no longer exists (for example, if it was closed),
135 // returns GetBrowserWindow(0). See crbug.com/10501. As for now this 135 // returns GetBrowserWindow(0). See crbug.com/10501. As for now this
136 // function is flakey. 136 // function is flakey.
137 BrowserProxy* GetLastActiveBrowserWindow(); 137 scoped_refptr<BrowserProxy> GetLastActiveBrowserWindow();
138 138
139 // Returns the WindowProxy for the currently active window, transferring 139 // Returns the WindowProxy for the currently active window, transferring
140 // ownership of the pointer to the caller. 140 // ownership of the pointer to the caller.
141 // On failure, returns NULL. 141 // On failure, returns NULL.
142 WindowProxy* GetActiveWindow(); 142 scoped_refptr<WindowProxy> GetActiveWindow();
143 143
144 // Tells the browser to enable or disable network request filtering. Returns 144 // Tells the browser to enable or disable network request filtering. Returns
145 // false if the message fails to send to the browser. 145 // false if the message fails to send to the browser.
146 bool SetFilteredInet(bool enabled); 146 bool SetFilteredInet(bool enabled);
147 147
148 // Sends the browser a new proxy configuration to start using. Returns true 148 // Sends the browser a new proxy configuration to start using. Returns true
149 // if the proxy config was successfully sent, false otherwise. 149 // if the proxy config was successfully sent, false otherwise.
150 bool SendProxyConfig(const std::string& new_proxy_config); 150 bool SendProxyConfig(const std::string& new_proxy_config);
151 151
152 // These methods are intended to be called by the background thread 152 // These methods are intended to be called by the background thread
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // message from AutomationProxy, unpacks the messages and routes that call to 185 // message from AutomationProxy, unpacks the messages and routes that call to
186 // the tracker. 186 // the tracker.
187 void InvalidateHandle(const IPC::Message& message); 187 void InvalidateHandle(const IPC::Message& message);
188 188
189 #if defined(OS_WIN) 189 #if defined(OS_WIN)
190 // TODO(port): Enable when we can replace HWND. 190 // TODO(port): Enable when we can replace HWND.
191 191
192 // Creates a tab that can hosted in an external process. The function 192 // Creates a tab that can hosted in an external process. The function
193 // returns a TabProxy representing the tab as well as a window handle 193 // returns a TabProxy representing the tab as well as a window handle
194 // that can be reparented in another process. 194 // that can be reparented in another process.
195 TabProxy* CreateExternalTab(HWND parent, const gfx::Rect& dimensions, 195 scoped_refptr<TabProxy> CreateExternalTab(HWND parent,
196 unsigned int style, bool incognito, 196 const gfx::Rect& dimensions, unsigned int style, bool incognito,
197 HWND* external_tab_container); 197 HWND* external_tab_container);
198 #endif // defined(OS_WIN) 198 #endif // defined(OS_WIN)
199 199
200 int command_execution_timeout_ms() const { 200 int command_execution_timeout_ms() const {
201 return static_cast<int>(command_execution_timeout_.InMilliseconds()); 201 return static_cast<int>(command_execution_timeout_.InMilliseconds());
202 } 202 }
203 203
204 // Returns the server version of the server connected. You may only call this 204 // Returns the server version of the server connected. You may only call this
205 // method after WaitForAppLaunch() has returned SUCCESS or VERSION_MISMATCH. 205 // method after WaitForAppLaunch() has returned SUCCESS or VERSION_MISMATCH.
206 // If you call it before this, the return value is undefined. 206 // If you call it before this, the return value is undefined.
207 std::string server_version() const { 207 std::string server_version() const {
208 return server_version_; 208 return server_version_;
209 } 209 }
210 210
211 // Call this while passing true to tell the automation proxy to perform 211 // Call this while passing true to tell the automation proxy to perform
212 // a version check when WaitForAppLaunch() is called. Note that 212 // a version check when WaitForAppLaunch() is called. Note that
213 // platform_version_check_ defaults to false. 213 // platform_version_check_ defaults to false.
214 void set_perform_version_check(bool perform_version_check) { 214 void set_perform_version_check(bool perform_version_check) {
215 perform_version_check_ = perform_version_check; 215 perform_version_check_ = perform_version_check;
216 } 216 }
217 217
218 private: 218 private:
219 template <class T> scoped_refptr<T> ProxyObjectFromHandle(int handle);
219 void InitializeChannelID(); 220 void InitializeChannelID();
220 void InitializeThread(); 221 void InitializeThread();
221 void InitializeChannel(); 222 void InitializeChannel();
222 void InitializeHandleTracker(); 223 void InitializeHandleTracker();
223 224
224 std::wstring channel_id_; 225 std::wstring channel_id_;
225 scoped_ptr<base::Thread> thread_; 226 scoped_ptr<base::Thread> thread_;
226 scoped_ptr<IPC::SyncChannel> channel_; 227 scoped_ptr<IPC::SyncChannel> channel_;
227 scoped_ptr<AutomationHandleTracker> tracker_; 228 scoped_ptr<AutomationHandleTracker> tracker_;
228 229
(...skipping 17 matching lines...) Expand all
246 // a version resource. 247 // a version resource.
247 bool perform_version_check_; 248 bool perform_version_check_;
248 249
249 // Delay to let the browser execute the command. 250 // Delay to let the browser execute the command.
250 base::TimeDelta command_execution_timeout_; 251 base::TimeDelta command_execution_timeout_;
251 252
252 DISALLOW_COPY_AND_ASSIGN(AutomationProxy); 253 DISALLOW_COPY_AND_ASSIGN(AutomationProxy);
253 }; 254 };
254 255
255 #endif // CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H__ 256 #endif // CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H__
OLDNEW
« no previous file with comments | « chrome/test/automation/automation_handle_tracker.cc ('k') | chrome/test/automation/automation_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698