Index: ios/web/test/web_test_suite.cc |
diff --git a/ios/web/test/web_test_suite.cc b/ios/web/test/web_test_suite.cc |
index cc218e9cc26d4791dfd4dcc761280c78ce86fb0e..ec72565024b87a8d2dc14b450f73acb198b1fbea 100644 |
--- a/ios/web/test/web_test_suite.cc |
+++ b/ios/web/test/web_test_suite.cc |
@@ -4,10 +4,24 @@ |
#include "ios/web/test/web_test_suite.h" |
+#include "base/macros.h" |
#include "base/metrics/statistics_recorder.h" |
+#include "ios/web/web_thread_impl.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
namespace web { |
+class WebTestSuiteListener : public testing::EmptyTestEventListener { |
+ public: |
+ WebTestSuiteListener() {} |
+ void OnTestEnd(const testing::TestInfo& test_info) override { |
+ WebThreadImpl::FlushThreadPoolHelperForTesting(); |
+ } |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(WebTestSuiteListener); |
+}; |
+ |
WebTestSuite::WebTestSuite(int argc, char** argv) |
: base::TestSuite(argc, argv) { |
} |
@@ -22,6 +36,9 @@ void WebTestSuite::Initialize() { |
// are correctly registered with the statistics recorder and can be queried |
// by tests. |
base::StatisticsRecorder::Initialize(); |
+ |
+ testing::UnitTest::GetInstance()->listeners().Append( |
+ new WebTestSuiteListener); |
} |
} // namespace web |