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

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

Issue 5707006: Revert "Add named testing interface." (Closed)
Patch Set: Created 10 years 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
« no previous file with comments | « chrome/common/automation_constants.cc ('k') | chrome/test/automation/automation_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 }; 54 };
55 55
56 // This is the interface that external processes can use to interact with 56 // This is the interface that external processes can use to interact with
57 // a running instance of the app. 57 // a running instance of the app.
58 class AutomationProxy : public IPC::Channel::Listener, 58 class AutomationProxy : public IPC::Channel::Listener,
59 public AutomationMessageSender { 59 public AutomationMessageSender {
60 public: 60 public:
61 AutomationProxy(int command_execution_timeout_ms, bool disconnect_on_failure); 61 AutomationProxy(int command_execution_timeout_ms, bool disconnect_on_failure);
62 virtual ~AutomationProxy(); 62 virtual ~AutomationProxy();
63 63
64 // Creates a previously unused channel id.
65 static std::string GenerateChannelID();
66
67 // Initializes a channel for a connection to an AutomationProvider.
68 // If use_named_interface is false, it will act as a client
69 // and connect to the named IPC socket with channel_id as its path.
70 // If use_named_interface is true, it will act as a server and
71 // use an anonymous socketpair instead.
72 void InitializeChannel(const std::string& channel_id,
73 bool use_named_interface);
74
75 // IPC callback 64 // IPC callback
76 virtual void OnMessageReceived(const IPC::Message& msg); 65 virtual void OnMessageReceived(const IPC::Message& msg);
77 virtual void OnChannelError(); 66 virtual void OnChannelError();
78 67
79 // Close the automation IPC channel. 68 // Close the automation IPC channel.
80 void Disconnect(); 69 void Disconnect();
81 70
82 // Waits for the app to launch and the automation provider to say hello 71 // Waits for the app to launch and the automation provider to say hello
83 // (the app isn't fully done loading by this point). 72 // (the app isn't fully done loading by this point).
84 // Returns SUCCESS if the launch is successful. 73 // Returns SUCCESS if the launch is successful.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // Resets to the default theme. Returns true on success. 201 // Resets to the default theme. Returns true on success.
213 bool ResetToDefaultTheme(); 202 bool ResetToDefaultTheme();
214 203
215 #if defined(OS_CHROMEOS) 204 #if defined(OS_CHROMEOS)
216 // Logs in through the Chrome OS login wizard with given |username| 205 // Logs in through the Chrome OS login wizard with given |username|
217 // and |password|. Returns true on success. 206 // and |password|. Returns true on success.
218 bool LoginWithUserAndPass(const std::string& username, 207 bool LoginWithUserAndPass(const std::string& username,
219 const std::string& password) WARN_UNUSED_RESULT; 208 const std::string& password) WARN_UNUSED_RESULT;
220 #endif 209 #endif
221 210
211 // Returns the ID of the automation IPC channel, so that it can be
212 // passed to the app as a launch parameter.
213 const std::string& channel_id() const { return channel_id_; }
214
222 #if defined(OS_POSIX) 215 #if defined(OS_POSIX)
223 base::file_handle_mapping_vector fds_to_map() const; 216 base::file_handle_mapping_vector fds_to_map() const;
224 #endif 217 #endif
225 218
226 // AutomationMessageSender implementation. 219 // AutomationMessageSender implementation.
227 virtual bool Send(IPC::Message* message) WARN_UNUSED_RESULT; 220 virtual bool Send(IPC::Message* message) WARN_UNUSED_RESULT;
228 221
229 // Wrapper over AutomationHandleTracker::InvalidateHandle. Receives the 222 // Wrapper over AutomationHandleTracker::InvalidateHandle. Receives the
230 // message from AutomationProxy, unpacks the messages and routes that call to 223 // message from AutomationProxy, unpacks the messages and routes that call to
231 // the tracker. 224 // the tracker.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 void set_perform_version_check(bool perform_version_check) { 256 void set_perform_version_check(bool perform_version_check) {
264 perform_version_check_ = perform_version_check; 257 perform_version_check_ = perform_version_check;
265 } 258 }
266 259
267 // These functions set and reset the IPC::Channel pointer on the tracker. 260 // These functions set and reset the IPC::Channel pointer on the tracker.
268 void SetChannel(IPC::Channel* channel); 261 void SetChannel(IPC::Channel* channel);
269 void ResetChannel(); 262 void ResetChannel();
270 263
271 protected: 264 protected:
272 template <class T> scoped_refptr<T> ProxyObjectFromHandle(int handle); 265 template <class T> scoped_refptr<T> ProxyObjectFromHandle(int handle);
266 void InitializeChannelID();
273 void InitializeThread(); 267 void InitializeThread();
268 void InitializeChannel();
274 void InitializeHandleTracker(); 269 void InitializeHandleTracker();
275 270
271 std::string channel_id_;
276 scoped_ptr<base::Thread> thread_; 272 scoped_ptr<base::Thread> thread_;
277 scoped_ptr<IPC::SyncChannel> channel_; 273 scoped_ptr<IPC::SyncChannel> channel_;
278 scoped_ptr<AutomationHandleTracker> tracker_; 274 scoped_ptr<AutomationHandleTracker> tracker_;
279 275
280 base::WaitableEvent app_launched_; 276 base::WaitableEvent app_launched_;
281 base::WaitableEvent initial_loads_complete_; 277 base::WaitableEvent initial_loads_complete_;
282 base::WaitableEvent new_tab_ui_load_complete_; 278 base::WaitableEvent new_tab_ui_load_complete_;
283 int new_tab_ui_load_time_; 279 int new_tab_ui_load_time_;
284 280
285 // An event that notifies when we are shutting-down. 281 // An event that notifies when we are shutting-down.
(...skipping 17 matching lines...) Expand all
303 299
304 // Delay to let the browser execute the command. 300 // Delay to let the browser execute the command.
305 base::TimeDelta command_execution_timeout_; 301 base::TimeDelta command_execution_timeout_;
306 302
307 PlatformThreadId listener_thread_id_; 303 PlatformThreadId listener_thread_id_;
308 304
309 DISALLOW_COPY_AND_ASSIGN(AutomationProxy); 305 DISALLOW_COPY_AND_ASSIGN(AutomationProxy);
310 }; 306 };
311 307
312 #endif // CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H__ 308 #endif // CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H__
OLDNEW
« no previous file with comments | « chrome/common/automation_constants.cc ('k') | chrome/test/automation/automation_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698