OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/chrome/test/ios_chrome_unit_test_suite.h" | 5 #include "ios/chrome/test/ios_chrome_unit_test_suite.h" |
6 | 6 |
| 7 #include "ios/chrome/browser/browser_state/browser_state_keyed_service_factories
.h" |
| 8 #include "ios/chrome/browser/chrome_paths.h" |
7 #include "ios/public/test/test_chrome_browser_provider.h" | 9 #include "ios/public/test/test_chrome_browser_provider.h" |
8 #include "ios/public/test/test_chrome_provider_initializer.h" | 10 #include "ios/public/test/test_chrome_provider_initializer.h" |
9 #include "ios/web/public/web_client.h" | 11 #include "ios/web/public/web_client.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
11 #include "ui/base/ui_base_paths.h" | 13 #include "ui/base/ui_base_paths.h" |
12 #include "url/url_util.h" | 14 #include "url/url_util.h" |
13 | 15 |
14 namespace { | 16 namespace { |
15 | 17 |
16 class IOSChromeUnitTestSuiteInitializer | 18 class IOSChromeUnitTestSuiteInitializer |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 } | 51 } |
50 | 52 |
51 void IOSChromeUnitTestSuite::Initialize() { | 53 void IOSChromeUnitTestSuite::Initialize() { |
52 // Add an additional listener to do the extra initialization for unit tests. | 54 // Add an additional listener to do the extra initialization for unit tests. |
53 // It will be started before the base class listeners and ended after the | 55 // It will be started before the base class listeners and ended after the |
54 // base class listeners. | 56 // base class listeners. |
55 testing::TestEventListeners& listeners = | 57 testing::TestEventListeners& listeners = |
56 testing::UnitTest::GetInstance()->listeners(); | 58 testing::UnitTest::GetInstance()->listeners(); |
57 listeners.Append(new IOSChromeUnitTestSuiteInitializer); | 59 listeners.Append(new IOSChromeUnitTestSuiteInitializer); |
58 | 60 |
| 61 // Ensure that all BrowserStateKeyedServiceFactories are built before any |
| 62 // test is run so that the dependencies are correctly resolved. |
| 63 EnsureBrowserStateKeyedServiceFactoriesBuilt(); |
| 64 |
| 65 ios::RegisterPathProvider(); |
59 ui::RegisterPathProvider(); | 66 ui::RegisterPathProvider(); |
60 | 67 |
61 { | 68 { |
62 ios::TestChromeBrowserProvider provider; | 69 ios::TestChromeBrowserProvider provider; |
63 url::AddStandardScheme(provider.GetChromeUIScheme()); | 70 url::AddStandardScheme(provider.GetChromeUIScheme()); |
64 } | 71 } |
65 | 72 |
66 base::TestSuite::Initialize(); | 73 base::TestSuite::Initialize(); |
67 } | 74 } |
OLD | NEW |