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

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: More correct fix 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..84a2f67905ed1ba77a7c6a60838ea1457e28956f 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 any posted ServerBoundCertServiceWorkers to finish.
+ // (By calling CallGetServerBoundCertCallbackWithResult, callbacks are
+ // called directly, short-circuiting ServerBoundCertService's usual
+ // bookkeeping.)
+ sequenced_worker_pool_->FlushForTesting();
+ base::MessageLoop::current()->RunUntilIdle();
Ryan Sleevi 2013/08/08 23:18:46 Consider updating the comments to be more descript
juanlang 2013/08/08 23:51:08 Done, I think. The rationale is different, and unl
error = callback.WaitForResult();
EXPECT_EQ(OK, error);
@@ -560,6 +566,12 @@ TEST_F(ServerBoundCertServiceTest, AsyncStoreGetOneCertInStore) {
mock_store->CallGetServerBoundCertCallbackWithResult(
OK, base::Time(), "ab", "cd");
+ // Wait for any posted ServerBoundCertServiceWorkers to finish.
+ // (By calling CallGetServerBoundCertCallbackWithResult, callbacks are
+ // called directly, short-circuiting ServerBoundCertService's usual
+ // bookkeeping.)
+ sequenced_worker_pool_->FlushForTesting();
+ base::MessageLoop::current()->RunUntilIdle();
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