Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Unified Diff: net/test/base_test_server.cc

Issue 10879029: reland: Launch pywebsocket via net::TestServer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reflects Pawel's comment on previous CL Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/test/base_test_server.cc
diff --git a/net/test/base_test_server.cc b/net/test/base_test_server.cc
index a4d1ff9ecfd061bee34625ddf948fbd4d2f0b911..cc8f1b8d94cf6bba5bb4585d6188501a64b511ac 100644
--- a/net/test/base_test_server.cc
+++ b/net/test/base_test_server.cc
@@ -27,10 +27,14 @@ namespace net {
namespace {
+bool UsingSSL(BaseTestServer::Type type) {
+ return type == BaseTestServer::TYPE_HTTPS ||
+ type == BaseTestServer::TYPE_WSS;
+}
+
std::string GetHostname(BaseTestServer::Type type,
const BaseTestServer::SSLOptions& options) {
- if ((type == BaseTestServer::TYPE_HTTPS ||
- type == BaseTestServer::TYPE_WSS) &&
+ if (UsingSSL(type) &&
options.server_certificate ==
BaseTestServer::SSLOptions::CERT_MISMATCHED_NAME) {
// Return a different hostname string that resolves to the same hostname.
@@ -127,7 +131,7 @@ BaseTestServer::BaseTestServer(Type type, const SSLOptions& ssl_options)
type_(type),
started_(false),
log_to_console_(false) {
- DCHECK(type == TYPE_HTTPS || type == TYPE_WSS);
+ DCHECK(UsingSSL(type));
Init(GetHostname(type, ssl_options));
}
@@ -309,7 +313,7 @@ bool BaseTestServer::LoadTestRootCert() const {
bool BaseTestServer::SetupWhenServerStarted() {
DCHECK(host_port_pair_.port());
- if ((type_ == TYPE_HTTPS || type_ == TYPE_WSS) && !LoadTestRootCert())
+ if (UsingSSL(type_) && !LoadTestRootCert())
return false;
started_ = true;

Powered by Google App Engine
This is Rietveld 408576698