| 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/memory/ptr_util.h" |
| 9 #include "base/metrics/statistics_recorder.h" | 9 #include "base/metrics/statistics_recorder.h" |
| 10 #include "base/path_service.h" |
| 10 #import "ios/web/public/test/test_web_client.h" | 11 #import "ios/web/public/test/test_web_client.h" |
| 11 #include "ios/web/public/url_schemes.h" | 12 #include "ios/web/public/url_schemes.h" |
| 12 #include "ios/web/web_thread_impl.h" | 13 #include "ios/web/web_thread_impl.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "ui/base/resource/resource_bundle.h" |
| 14 | 16 |
| 15 namespace web { | 17 namespace web { |
| 16 | 18 |
| 17 class WebTestSuiteListener : public testing::EmptyTestEventListener { | 19 class WebTestSuiteListener : public testing::EmptyTestEventListener { |
| 18 public: | 20 public: |
| 19 WebTestSuiteListener() {} | 21 WebTestSuiteListener() {} |
| 20 void OnTestEnd(const testing::TestInfo& test_info) override { | 22 void OnTestEnd(const testing::TestInfo& test_info) override { |
| 21 WebThreadImpl::FlushThreadPoolHelperForTesting(); | 23 WebThreadImpl::FlushThreadPoolHelperForTesting(); |
| 22 } | 24 } |
| 23 | 25 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 36 | 38 |
| 37 // Initialize the histograms subsystem, so that any histograms hit in tests | 39 // Initialize the histograms subsystem, so that any histograms hit in tests |
| 38 // are correctly registered with the statistics recorder and can be queried | 40 // are correctly registered with the statistics recorder and can be queried |
| 39 // by tests. | 41 // by tests. |
| 40 base::StatisticsRecorder::Initialize(); | 42 base::StatisticsRecorder::Initialize(); |
| 41 | 43 |
| 42 testing::UnitTest::GetInstance()->listeners().Append( | 44 testing::UnitTest::GetInstance()->listeners().Append( |
| 43 new WebTestSuiteListener); | 45 new WebTestSuiteListener); |
| 44 | 46 |
| 45 RegisterWebSchemes(false); | 47 RegisterWebSchemes(false); |
| 48 |
| 49 // Load test resources if they are present in the bundle. |
| 50 base::FilePath resources_pack_path; |
| 51 base::PathService::Get(base::DIR_MODULE, &resources_pack_path); |
| 52 resources_pack_path = |
| 53 resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak")); |
| 54 ui::ResourceBundle::InitSharedInstanceWithPakPath(resources_pack_path); |
| 46 } | 55 } |
| 47 | 56 |
| 48 } // namespace web | 57 } // namespace web |
| OLD | NEW |