OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ios/web/test/web_test_suite.h" | 5 #include "ios/web/test/web_test_suite.h" |
6 | 6 |
| 7 #include "base/macros.h" |
7 #include "base/metrics/statistics_recorder.h" | 8 #include "base/metrics/statistics_recorder.h" |
| 9 #include "ios/web/web_thread_impl.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" |
8 | 11 |
9 namespace web { | 12 namespace web { |
10 | 13 |
| 14 class WebTestSuiteListener : public testing::EmptyTestEventListener { |
| 15 public: |
| 16 WebTestSuiteListener() {} |
| 17 void OnTestEnd(const testing::TestInfo& test_info) override { |
| 18 WebThreadImpl::FlushThreadPoolHelperForTesting(); |
| 19 } |
| 20 |
| 21 private: |
| 22 DISALLOW_COPY_AND_ASSIGN(WebTestSuiteListener); |
| 23 }; |
| 24 |
11 WebTestSuite::WebTestSuite(int argc, char** argv) | 25 WebTestSuite::WebTestSuite(int argc, char** argv) |
12 : base::TestSuite(argc, argv) { | 26 : base::TestSuite(argc, argv) { |
13 } | 27 } |
14 | 28 |
15 WebTestSuite::~WebTestSuite() { | 29 WebTestSuite::~WebTestSuite() { |
16 } | 30 } |
17 | 31 |
18 void WebTestSuite::Initialize() { | 32 void WebTestSuite::Initialize() { |
19 base::TestSuite::Initialize(); | 33 base::TestSuite::Initialize(); |
20 | 34 |
21 // Initialize the histograms subsystem, so that any histograms hit in tests | 35 // Initialize the histograms subsystem, so that any histograms hit in tests |
22 // are correctly registered with the statistics recorder and can be queried | 36 // are correctly registered with the statistics recorder and can be queried |
23 // by tests. | 37 // by tests. |
24 base::StatisticsRecorder::Initialize(); | 38 base::StatisticsRecorder::Initialize(); |
| 39 |
| 40 testing::UnitTest::GetInstance()->listeners().Append( |
| 41 new WebTestSuiteListener); |
25 } | 42 } |
26 | 43 |
27 } // namespace web | 44 } // namespace web |
OLD | NEW |