diff options
author | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-20 00:59:38 +0000 |
---|---|---|
committer | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-20 00:59:38 +0000 |
commit | 060e9ddba52b3ac3704bbdcfc1c755e53b695e1b (patch) | |
tree | 24e5c75523302405922d7c7a99652c713fbc55c7 /chrome/test/automation/automation_proxy.h | |
parent | 09a9da72051e7543bd800167c88e5d56c523b5fe (diff) | |
download | chromium_src-060e9ddba52b3ac3704bbdcfc1c755e53b695e1b.zip chromium_src-060e9ddba52b3ac3704bbdcfc1c755e53b695e1b.tar.gz chromium_src-060e9ddba52b3ac3704bbdcfc1c755e53b695e1b.tar.bz2 |
Revert 66840 - Add named testing interface. This allows you to connect to a pre-existing Chrome process and run tests on it. This is an addition to the low level interface underlying testing frameworks like PyAuto and WebDriver.
Normally, test frameworks communicate with Chrome over an unnamed socket pair on POSIX. The test creates the socket pair and then launches the browser as a child process, passing an open file descriptor for one end of the socket to the browser. This change adds a command line switch that, when passed to the browser, causes it to listen on a named socket instead, eliminating this parent/child process requirement. Therefore, you can potentially connect any number of tests to a preexisting browser process.
For ChromeOS, this allows you to run tests on the instance of Chrome that is launched on startup, which controls things like the login and lock screens, the battery meter, the wireless UI, etc. Currently there is no way to run tests on a pre-existing Chrome instance. Eventually this will also allow you to connect both PyAuto and WebDriver to the same Chrome instance and run both in the same test.
If you pass the browser the following command line switch:
./chrome --testing-channel=NamedTestingInterface:/path/to/file
This causes the browser to listen for incoming connections. An AutomationProxy can connect to the browser by connecting a Unix domain socket to the specified path and control the browser over the socket.
This is currently only for POSIX. Windows support will come in a future change. Also, this initial change only allows one connection; multiple connection support will come in a future change.
BUG=chromium-os:8512
TEST=Run Chrome with --testing-interface=/var/tmp/NamedTestingInterface, then run NamedInterfaceTest.BasicNamedInterface under ui_tests.
Review URL: http://codereview.chromium.org/4202004
TBR=nirnimesh@chromium.org
Review URL: http://codereview.chromium.org/5177007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66856 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/automation/automation_proxy.h')
-rw-r--r-- | chrome/test/automation/automation_proxy.h | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h index 7902ef0..853a6d3 100644 --- a/chrome/test/automation/automation_proxy.h +++ b/chrome/test/automation/automation_proxy.h @@ -61,17 +61,6 @@ class AutomationProxy : public IPC::Channel::Listener, AutomationProxy(int command_execution_timeout_ms, bool disconnect_on_failure); virtual ~AutomationProxy(); - // Creates a previously unused channel id. - static std::string GenerateChannelID(); - - // Initializes a channel for a connection to an AutomationProvider. - // If use_named_interface is false, it will act as a client - // and connect to the named IPC socket with channel_id as its path. - // If use_named_interface is true, it will act as a server and - // use an anonymous socketpair instead. - void InitializeChannel(const std::string& channel_id, - bool use_named_interface); - // IPC callback virtual void OnMessageReceived(const IPC::Message& msg); virtual void OnChannelError(); @@ -219,6 +208,10 @@ class AutomationProxy : public IPC::Channel::Listener, const std::string& password) WARN_UNUSED_RESULT; #endif + // Returns the ID of the automation IPC channel, so that it can be + // passed to the app as a launch parameter. + const std::string& channel_id() const { return channel_id_; } + #if defined(OS_POSIX) base::file_handle_mapping_vector fds_to_map() const; #endif @@ -270,9 +263,12 @@ class AutomationProxy : public IPC::Channel::Listener, protected: template <class T> scoped_refptr<T> ProxyObjectFromHandle(int handle); + void InitializeChannelID(); void InitializeThread(); + void InitializeChannel(); void InitializeHandleTracker(); + std::string channel_id_; scoped_ptr<base::Thread> thread_; scoped_ptr<IPC::SyncChannel> channel_; scoped_ptr<AutomationHandleTracker> tracker_; |