summaryrefslogtreecommitdiffstats
path: root/net/test
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-15 20:39:27 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-15 20:39:27 +0000
commit4b833b4419eccb5e1bc30c6d3c8829ca952939e6 (patch)
tree13c0dc0d908129a0cf891cfcc9ccf5cf8cf9599b /net/test
parentdee6c70aa294bbd7df4c9b092af8995caa8a46fd (diff)
downloadchromium_src-4b833b4419eccb5e1bc30c6d3c8829ca952939e6.zip
chromium_src-4b833b4419eccb5e1bc30c6d3c8829ca952939e6.tar.gz
chromium_src-4b833b4419eccb5e1bc30c6d3c8829ca952939e6.tar.bz2
GTTF: Make the parallel launcher use different ports for test https servers for different shards.
BUG=54098 TEST=none Review URL: http://codereview.chromium.org/3452001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59547 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/test')
-rw-r--r--net/test/test_server.cc23
1 files changed, 21 insertions, 2 deletions
diff --git a/net/test/test_server.cc b/net/test/test_server.cc
index 4456993..36227cf 100644
--- a/net/test/test_server.cc
+++ b/net/test/test_server.cc
@@ -14,6 +14,7 @@
#include "net/base/x509_certificate.h"
#endif
+#include "base/command_line.h"
#include "base/file_util.h"
#include "base/leak_annotations.h"
#include "base/logging.h"
@@ -37,10 +38,12 @@ const int kServerConnectionAttempts = 10;
// Connection timeout in milliseconds for tests.
const int kServerConnectionTimeoutMs = 1000;
-int GetPort(net::TestServer::Type type) {
+const char kTestServerShardFlag[] = "test-server-shard";
+
+int GetPortBase(net::TestServer::Type type) {
switch (type) {
case net::TestServer::TYPE_FTP:
- return 1338;
+ return 3117;
case net::TestServer::TYPE_HTTP:
return 1337;
case net::TestServer::TYPE_HTTPS:
@@ -55,6 +58,22 @@ int GetPort(net::TestServer::Type type) {
return -1;
}
+int GetPort(net::TestServer::Type type) {
+ int port = GetPortBase(type);
+ if (CommandLine::ForCurrentProcess()->HasSwitch(kTestServerShardFlag)) {
+ std::string shard_str(CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ kTestServerShardFlag));
+ int shard = -1;
+ if (base::StringToInt(shard_str, &shard)) {
+ port += shard;
+ } else {
+ LOG(FATAL) << "Got invalid " << kTestServerShardFlag << " flag value. "
+ << "An integer is expected.";
+ }
+ }
+ return port;
+}
+
std::string GetHostname(net::TestServer::Type type) {
if (type == net::TestServer::TYPE_HTTPS_MISMATCHED_HOSTNAME) {
// Return a different hostname string that resolves to the same hostname.