Commit afa1d412 authored by Sergey Ulanov's avatar Sergey Ulanov Committed by Commit Bot

[Fuchsia] Remove layout_test_proxy.

layout_test_proxy was added to proxy TCP connections for blink layout
tests on Fuchsia, but it hasn't been used for a while (SSH port
forwarding is used instead).

Change-Id: Ib191bdd6a8497595122f1e6b0483853c60752b47
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1998822
Auto-Submit: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#731010}
parent 39f0e57c
...@@ -1101,10 +1101,7 @@ if (!is_ios) { ...@@ -1101,10 +1101,7 @@ if (!is_ios) {
} }
if (is_fuchsia) { if (is_fuchsia) {
data_deps += [ data_deps += [ "//content/shell:content_shell_fuchsia" ]
"//build/fuchsia/layout_test_proxy:layout_test_proxy_runner",
"//content/shell:content_shell_fuchsia",
]
} }
data = [ data = [
......
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
assert(is_fuchsia)
import("//testing/test.gni")
# Binary used to proxy TCP connections from a Fuchsia process. Potentially SSH
# can be used to forward TCP, but this feature is currently broken on Fuchsia,
# see ZX-1555. layout_test_proxy can be removed once that issue with sshd is
# fixed and layout tests are updated to use SSH.
executable("layout_test_proxy") {
testonly = true
sources = [
"layout_test_proxy.cc",
]
deps = [
"//net",
"//net:test_support",
]
}
fuchsia_package("layout_test_proxy_pkg") {
testonly = true
binary = ":layout_test_proxy"
package_name_override = "layout_test_proxy"
}
fuchsia_package_runner("layout_test_proxy_runner") {
testonly = true
package = ":layout_test_proxy_pkg"
package_name_override = "layout_test_proxy"
}
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/command_line.h"
#include "base/message_loop/message_pump_type.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/task/single_thread_task_executor.h"
#include "net/base/ip_endpoint.h"
#include "net/test/tcp_socket_proxy.h"
const char kPortsSwitch[] = "ports";
const char kRemoteAddressSwitch[] = "remote-address";
int main(int argc, char** argv) {
base::CommandLine::Init(argc, argv);
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (!command_line->HasSwitch(kPortsSwitch)) {
LOG(ERROR) << "--" << kPortsSwitch << " was not specified.";
return 1;
}
std::vector<std::string> ports_strings =
base::SplitString(command_line->GetSwitchValueASCII(kPortsSwitch), ",",
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
if (ports_strings.empty()) {
LOG(ERROR) << "At least one port must be specified with --" << kPortsSwitch;
return 1;
}
std::vector<int> ports;
for (auto& port_string : ports_strings) {
int port;
if (!base::StringToInt(port_string, &port) || port <= 0 || port > 65535) {
LOG(ERROR) << "Invalid value specified for --" << kPortsSwitch << ": "
<< port_string;
return 1;
}
ports.push_back(port);
}
if (!command_line->HasSwitch(kRemoteAddressSwitch)) {
LOG(ERROR) << "--" << kRemoteAddressSwitch << " was not specified.";
return 1;
}
std::string remote_address_str =
command_line->GetSwitchValueASCII(kRemoteAddressSwitch);
net::IPAddress remote_address;
if (!remote_address.AssignFromIPLiteral(remote_address_str)) {
LOG(ERROR) << "Invalid value specified for --" << kRemoteAddressSwitch
<< ": " << remote_address_str;
return 1;
}
base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO);
std::vector<std::unique_ptr<net::TcpSocketProxy>> proxies;
for (int port : ports) {
auto test_server_proxy =
std::make_unique<net::TcpSocketProxy>(io_task_executor.task_runner());
if (!test_server_proxy->Initialize(port)) {
LOG(ERROR) << "Can't bind proxy to port " << port;
return 1;
}
LOG(INFO) << "Listening on port " << test_server_proxy->local_port();
test_server_proxy->Start(net::IPEndPoint(remote_address, port));
proxies.push_back(std::move(test_server_proxy));
}
// Run the task executor indefinitely.
base::RunLoop().Run();
return 0;
}
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