summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-20 00:59:38 +0000
committerkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-20 00:59:38 +0000
commit060e9ddba52b3ac3704bbdcfc1c755e53b695e1b (patch)
tree24e5c75523302405922d7c7a99652c713fbc55c7 /ipc
parent09a9da72051e7543bd800167c88e5d56c523b5fe (diff)
downloadchromium_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 'ipc')
-rw-r--r--ipc/ipc_channel.h4
-rw-r--r--ipc/ipc_channel_posix.cc16
2 files changed, 6 insertions, 14 deletions
diff --git a/ipc/ipc_channel.h b/ipc/ipc_channel.h
index 27b055c1..2445e51 100644
--- a/ipc/ipc_channel.h
+++ b/ipc/ipc_channel.h
@@ -38,9 +38,7 @@ class Channel : public Message::Sender {
enum Mode {
MODE_NONE,
MODE_SERVER,
- MODE_CLIENT,
- MODE_NAMED_SERVER,
- MODE_NAMED_CLIENT
+ MODE_CLIENT
};
enum {
diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc
index 65a04e1..86d1673 100644
--- a/ipc/ipc_channel_posix.cc
+++ b/ipc/ipc_channel_posix.cc
@@ -273,9 +273,8 @@ Channel::ChannelImpl::ChannelImpl(const std::string& channel_id, Mode mode,
: mode_(mode),
is_blocked_on_write_(false),
message_send_bytes_written_(0),
- uses_fifo_(
- CommandLine::ForCurrentProcess()->HasSwitch(switches::kIPCUseFIFO) ||
- mode == MODE_NAMED_SERVER || mode == MODE_NAMED_CLIENT),
+ uses_fifo_(CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kIPCUseFIFO)),
server_listen_pipe_(-1),
pipe_(-1),
client_pipe_(-1),
@@ -286,15 +285,10 @@ Channel::ChannelImpl::ChannelImpl(const std::string& channel_id, Mode mode,
listener_(listener),
waiting_connect_(true),
factory_(this) {
- if (mode_ == MODE_NAMED_SERVER)
- mode_ = MODE_SERVER;
- if (mode_ == MODE_NAMED_CLIENT)
- mode_ = MODE_CLIENT;
-
- if (!CreatePipe(channel_id, mode_)) {
+ if (!CreatePipe(channel_id, mode)) {
// The pipe may have been closed already.
PLOG(WARNING) << "Unable to create pipe named \"" << channel_id
- << "\" in " << (mode_ == MODE_SERVER ? "server" : "client")
+ << "\" in " << (mode == MODE_SERVER ? "server" : "client")
<< " mode";
}
}
@@ -352,7 +346,7 @@ bool Channel::ChannelImpl::CreatePipe(const std::string& channel_id,
// TODO(playmobil): We shouldn't need to create fifos on disk.
// TODO(playmobil): If we do, they should be in the user data directory.
// TODO(playmobil): Cleanup any stale fifos.
- pipe_name_ = channel_id;
+ pipe_name_ = "/var/tmp/chrome_" + channel_id;
if (mode == MODE_SERVER) {
if (!CreateServerFifo(pipe_name_, &server_listen_pipe_)) {
return false;