| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ios/web/test/web_test_suite.h" | |
| 6 | |
| 7 #include "base/macros.h" | |
| 8 #include "base/metrics/statistics_recorder.h" | |
| 9 #include "ios/web/web_thread_impl.h" | |
| 10 #include "testing/gtest/include/gtest/gtest.h" | |
| 11 | |
| 12 namespace web { | |
| 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 | |
| 25 WebTestSuite::WebTestSuite(int argc, char** argv) | |
| 26 : base::TestSuite(argc, argv) { | |
| 27 } | |
| 28 | |
| 29 WebTestSuite::~WebTestSuite() { | |
| 30 } | |
| 31 | |
| 32 void WebTestSuite::Initialize() { | |
| 33 base::TestSuite::Initialize(); | |
| 34 | |
| 35 // Initialize the histograms subsystem, so that any histograms hit in tests | |
| 36 // are correctly registered with the statistics recorder and can be queried | |
| 37 // by tests. | |
| 38 base::StatisticsRecorder::Initialize(); | |
| 39 | |
| 40 testing::UnitTest::GetInstance()->listeners().Append( | |
| 41 new WebTestSuiteListener); | |
| 42 } | |
| 43 | |
| 44 } // namespace web | |
| OLD | NEW |