| 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/macros.h" |
| 8 #include "base/memory/ptr_util.h" |
| 8 #include "base/metrics/statistics_recorder.h" | 9 #include "base/metrics/statistics_recorder.h" |
| 10 #import "ios/web/public/test/test_web_client.h" |
| 11 #include "ios/web/public/url_schemes.h" |
| 9 #include "ios/web/web_thread_impl.h" | 12 #include "ios/web/web_thread_impl.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 14 |
| 12 namespace web { | 15 namespace web { |
| 13 | 16 |
| 14 class WebTestSuiteListener : public testing::EmptyTestEventListener { | 17 class WebTestSuiteListener : public testing::EmptyTestEventListener { |
| 15 public: | 18 public: |
| 16 WebTestSuiteListener() {} | 19 WebTestSuiteListener() {} |
| 17 void OnTestEnd(const testing::TestInfo& test_info) override { | 20 void OnTestEnd(const testing::TestInfo& test_info) override { |
| 18 WebThreadImpl::FlushThreadPoolHelperForTesting(); | 21 WebThreadImpl::FlushThreadPoolHelperForTesting(); |
| 19 } | 22 } |
| 20 | 23 |
| 21 private: | 24 private: |
| 22 DISALLOW_COPY_AND_ASSIGN(WebTestSuiteListener); | 25 DISALLOW_COPY_AND_ASSIGN(WebTestSuiteListener); |
| 23 }; | 26 }; |
| 24 | 27 |
| 25 WebTestSuite::WebTestSuite(int argc, char** argv) | 28 WebTestSuite::WebTestSuite(int argc, char** argv) |
| 26 : base::TestSuite(argc, argv) { | 29 : base::TestSuite(argc, argv), |
| 27 } | 30 web_client_(base::WrapUnique(new TestWebClient)) {} |
| 28 | 31 |
| 29 WebTestSuite::~WebTestSuite() { | 32 WebTestSuite::~WebTestSuite() {} |
| 30 } | |
| 31 | 33 |
| 32 void WebTestSuite::Initialize() { | 34 void WebTestSuite::Initialize() { |
| 33 base::TestSuite::Initialize(); | 35 base::TestSuite::Initialize(); |
| 34 | 36 |
| 35 // Initialize the histograms subsystem, so that any histograms hit in tests | 37 // Initialize the histograms subsystem, so that any histograms hit in tests |
| 36 // are correctly registered with the statistics recorder and can be queried | 38 // are correctly registered with the statistics recorder and can be queried |
| 37 // by tests. | 39 // by tests. |
| 38 base::StatisticsRecorder::Initialize(); | 40 base::StatisticsRecorder::Initialize(); |
| 39 | 41 |
| 40 testing::UnitTest::GetInstance()->listeners().Append( | 42 testing::UnitTest::GetInstance()->listeners().Append( |
| 41 new WebTestSuiteListener); | 43 new WebTestSuiteListener); |
| 44 |
| 45 RegisterWebSchemes(false); |
| 42 } | 46 } |
| 43 | 47 |
| 44 } // namespace web | 48 } // namespace web |
| OLD | NEW |