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

Unified Diff: net/test/embedded_test_server/embedded_test_server.cc

Issue 2562893002: Adds ScopedPortExceptions to EmbeddedTestServer. (Closed)
Patch Set: Created 4 years 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/embedded_test_server/embedded_test_server.cc
diff --git a/net/test/embedded_test_server/embedded_test_server.cc b/net/test/embedded_test_server/embedded_test_server.cc
index 3d57df5ed6a28d8638d7761bde540c5f2c8789a1..d217ed4120510deb0a689372dbab0b7842c7bc6b 100644
--- a/net/test/embedded_test_server/embedded_test_server.cc
+++ b/net/test/embedded_test_server/embedded_test_server.cc
@@ -23,6 +23,7 @@
#include "crypto/rsa_private_key.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
+#include "net/base/port_util.h"
#include "net/cert/pem_tokenizer.h"
#include "net/cert/test_root_certs.h"
#include "net/log/net_log_source.h"
@@ -163,6 +164,7 @@ void EmbeddedTestServer::StartAcceptingConnections() {
bool EmbeddedTestServer::ShutdownAndWaitUntilComplete() {
DCHECK(thread_checker_.CalledOnValidThread());
+ port_exception_ = nullptr;
return PostTaskToIOThreadAndWait(base::Bind(
&EmbeddedTestServer::ShutdownOnIOThread, base::Unretained(this)));
}
@@ -234,6 +236,15 @@ bool EmbeddedTestServer::GetAddressList(AddressList* address_list) const {
return true;
}
+void EmbeddedTestServer::SetPortExceptionEnabled(bool enabled) {
svaldez 2016/12/09 15:26:53 Might as well default this to true and then remove
rohitrao (ping after 24h) 2016/12/09 16:08:53 Done.
+ if (enabled) {
+ DCHECK(Started());
+ port_exception_ = base::MakeUnique<ScopedPortException>(port_);
+ } else {
+ port_exception_ = nullptr;
+ }
+}
+
void EmbeddedTestServer::SetSSLConfig(ServerCertificate cert,
const SSLServerConfig& ssl_config) {
DCHECK(!Started());

Powered by Google App Engine
This is Rietveld 408576698