From 87b99b8a14a750b6fa5eb0b414956a01ee0bb35e Mon Sep 17 00:00:00 2001 From: sdefresne Date: Mon, 15 Jun 2015 07:12:22 -0700 Subject: [iOS] KeyedServiceProvider improvements Decouple the KeyedServiceProvider access and lifetime from ChromeBrowserProvider as the KeyedService factory dependencies is resolved at instantiation time and thus KeyedServiceProvider must never be replaced. KeyedServiceProvider export a method to force instantiation of all factories so that the dependencies are correctly enforced. BUG=478763 Review URL: https://codereview.chromium.org/1179173006 Cr-Commit-Position: refs/heads/master@{#334373} --- ios/chrome/test/ios_chrome_unit_test_suite.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ios/chrome/test') diff --git a/ios/chrome/test/ios_chrome_unit_test_suite.cc b/ios/chrome/test/ios_chrome_unit_test_suite.cc index 7b59a14..c7c2bb3 100644 --- a/ios/chrome/test/ios_chrome_unit_test_suite.cc +++ b/ios/chrome/test/ios_chrome_unit_test_suite.cc @@ -8,6 +8,7 @@ #include "ios/chrome/browser/chrome_paths.h" #include "ios/public/test/test_chrome_browser_provider.h" #include "ios/public/test/test_chrome_provider_initializer.h" +#include "ios/public/test/test_keyed_service_provider.h" #include "ios/web/public/web_client.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/resource/resource_bundle.h" @@ -64,6 +65,8 @@ void IOSChromeUnitTestSuite::Initialize() { // Ensure that all BrowserStateKeyedServiceFactories are built before any // test is run so that the dependencies are correctly resolved. + ios::TestKeyedServiceProvider keyed_service_provider; + ios::SetKeyedServiceProvider(&keyed_service_provider); EnsureBrowserStateKeyedServiceFactoriesBuilt(); ios::RegisterPathProvider(); -- cgit v1.1