Commit 8a342a4d authored by Lucía Cantú-Miller's avatar Lucía Cantú-Miller Committed by Commit Bot

[chromedriver] Pipe Set Up

Chromedriver will now have the option to connect to Chrome through a
pipe instead of a websocket. In this commit the PipeSetUp method is
added to chrome_lancher to create the two pipes needed to communicate.

Bug: chromedriver:3480
Change-Id: I7e3b70a7ef72b756a092b36d02dc3c091bfeb04f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2336015
Commit-Queue: Lucía Cantú-Miller <cantumiller@google.com>
Reviewed-by: default avatarJohn Chen <johnchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#794652}
parent 135a9cb9
......@@ -65,6 +65,7 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#elif defined(OS_WIN)
#include "chrome/test/chromedriver/keycode_text_conversion.h"
#endif
......@@ -728,6 +729,33 @@ Status LaunchReplayChrome(network::mojom::URLLoaderFactory* factory,
} // namespace
Status PipeSetUp(base::LaunchOptions* options, int* write_fd, int* read_fd) {
#if defined(OS_POSIX)
int chrome_to_driver_pipe_fds[2];
int driver_to_chrome_pipe_fds[2];
if (pipe(chrome_to_driver_pipe_fds) == -1 ||
pipe(driver_to_chrome_pipe_fds) == -1)
return Status(kUnknownError, "cannot set up pipe");
// Numbers 3 & 4 come from kReadDf and kWriteFD in
// content/browser/devtools/devtools_pipe_handler.cc
options->fds_to_remap.emplace_back(driver_to_chrome_pipe_fds[0], 3);
options->fds_to_remap.emplace_back(chrome_to_driver_pipe_fds[1], 4);
close(driver_to_chrome_pipe_fds[0]);
close(chrome_to_driver_pipe_fds[1]);
*write_fd = driver_to_chrome_pipe_fds[1];
*read_fd = chrome_to_driver_pipe_fds[0];
return Status(kOk);
#endif
return Status(kUnknownError, "feature not supported");
}
Status LaunchChrome(network::mojom::URLLoaderFactory* factory,
const SyncWebSocketFactory& socket_factory,
DeviceManager* device_manager,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment