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

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

Issue 2175933002: More aggressive IO asserts in content_browsertests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use 1 less instance of ScopedAllowIO in DumpAccessibilityTestBase::RunTestForPlatform. Created 4 years, 5 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
« no previous file with comments | « net/cert/test_root_certs.cc ('k') | net/test/spawned_test_server/local_test_server.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 51596b1ad5e91ad4c35242dc20415f01d106f85b..28b65a5afd412d5fe17ae7f99d17bd2b2dd28d5b 100644
--- a/net/test/embedded_test_server/embedded_test_server.cc
+++ b/net/test/embedded_test_server/embedded_test_server.cc
@@ -52,6 +52,7 @@ EmbeddedTestServer::EmbeddedTestServer(Type type)
DCHECK(thread_checker_.CalledOnValidThread());
if (is_using_ssl_) {
+ base::ThreadRestrictions::ScopedAllowIO allow_io_for_importing_test_cert;
TestRootCerts* root_certs = TestRootCerts::GetInstance();
base::FilePath certs_dir(GetTestCertsDirectory());
root_certs->AddFromFile(certs_dir.AppendASCII("root_ca_cert.pem"));
@@ -64,6 +65,13 @@ EmbeddedTestServer::~EmbeddedTestServer() {
if (Started() && !ShutdownAndWaitUntilComplete()) {
LOG(ERROR) << "EmbeddedTestServer failed to shut down.";
}
+
+ {
+ // Thread::Join induced by test code should cause an assert.
+ base::ThreadRestrictions::ScopedAllowIO allow_io_for_thread_join;
+
+ io_thread_.reset();
+ }
}
void EmbeddedTestServer::SetConnectionListener(
@@ -118,6 +126,7 @@ bool EmbeddedTestServer::InitializeAndListen() {
}
void EmbeddedTestServer::InitializeSSLServerContext() {
+ base::ThreadRestrictions::ScopedAllowIO allow_io_for_ssl_initialization;
base::FilePath certs_dir(GetTestCertsDirectory());
std::string cert_name = GetCertificateName();
@@ -258,6 +267,8 @@ std::string EmbeddedTestServer::GetCertificateName() const {
scoped_refptr<X509Certificate> EmbeddedTestServer::GetCertificate() const {
DCHECK(is_using_ssl_);
base::FilePath certs_dir(GetTestCertsDirectory());
+
+ base::ThreadRestrictions::ScopedAllowIO allow_io_for_importing_test_cert;
return ImportCertFromFile(certs_dir, GetCertificateName());
}
« no previous file with comments | « net/cert/test_root_certs.cc ('k') | net/test/spawned_test_server/local_test_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698