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

[Fuchsia] Remove layout_test_proxy

layout_test_proxy is no longer needed for layout tests because we can
use SSH.

Bug: 778467
Change-Id: I802ee687a9dab6448fc902a074553dbeb5bbafee
Reviewed-on: https://chromium-review.googlesource.com/1053394
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarJohn Budorick <jbudorick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557609}
parent 0a8d63a4
...@@ -949,7 +949,6 @@ if (!is_ios) { ...@@ -949,7 +949,6 @@ if (!is_ios) {
if (is_fuchsia) { if (is_fuchsia) {
data_deps += [ data_deps += [
"//content/shell:content_shell_fuchsia", "//content/shell:content_shell_fuchsia",
"//build/fuchsia/layout_test_proxy:layout_test_proxy_runner",
] ]
} }
......
# 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_executable_runner("layout_test_proxy_runner") {
testonly = true
exe_target = ":layout_test_proxy"
}
include_rules = [
"+net",
]
\ No newline at end of file
// 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_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.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::MessageLoopForIO message_loop;
std::vector<std::unique_ptr<net::TcpSocketProxy>> proxies;
for (int port : ports) {
auto test_server_proxy =
std::make_unique<net::TcpSocketProxy>(message_loop.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 message loop indefinitely.
base::RunLoop().Run();
return 0;
}
\ No newline at end of file
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