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

Unified Diff: net/ssl/server_bound_cert_service_unittest.cc

Issue 22702003: Fix leak of sequenced worker pool in unit tests when service_ is replaced. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Flush, just in case, when generation occurs Created 7 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ssl/server_bound_cert_service_unittest.cc
diff --git a/net/ssl/server_bound_cert_service_unittest.cc b/net/ssl/server_bound_cert_service_unittest.cc
index 0063f496036854c4c3a1ae2be4cbc1dea394ae66..0476379a90afbb4970f56dfc390f7635fa89d8ce 100644
--- a/net/ssl/server_bound_cert_service_unittest.cc
+++ b/net/ssl/server_bound_cert_service_unittest.cc
@@ -529,6 +529,12 @@ TEST_F(ServerBoundCertServiceTest, AsyncStoreGetNoCertsInStore) {
mock_store->CallGetServerBoundCertCallbackWithResult(
ERR_FILE_NOT_FOUND, base::Time(), std::string(), std::string());
+ // Wait for generation to finish.
+ sequenced_worker_pool_->FlushForTesting();
+ // Wait for reply from the ServerBoundCertServiceWorkers to be posted back to
+ // the ServerBoundCertService. (There will be more than two, one to track the
+ // failing lookup, and another to track the generation of the cert.)
+ base::MessageLoop::current()->RunUntilIdle();
error = callback.WaitForResult();
EXPECT_EQ(OK, error);
@@ -560,6 +566,9 @@ TEST_F(ServerBoundCertServiceTest, AsyncStoreGetOneCertInStore) {
mock_store->CallGetServerBoundCertCallbackWithResult(
OK, base::Time(), "ab", "cd");
+ // Wait for reply from ServerBoundCertServiceWorker to be posted back to the
+ // ServerBoundCertService.
+ base::MessageLoop::current()->RunUntilIdle();
juanlang 2013/08/09 04:48:52 But here I believe I don't need to Flush(), becaus
error = callback.WaitForResult();
EXPECT_EQ(OK, error);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698