| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/extensions/extension_service_test_base.h" | 5 #include "chrome/browser/extensions/extension_service_test_base.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 namespace extensions { | 39 namespace extensions { |
| 40 | 40 |
| 41 namespace { | 41 namespace { |
| 42 | 42 |
| 43 // By default, we run on the IO loop. | 43 // By default, we run on the IO loop. |
| 44 const int kThreadOptions = content::TestBrowserThreadBundle::IO_MAINLOOP; | 44 const int kThreadOptions = content::TestBrowserThreadBundle::IO_MAINLOOP; |
| 45 | 45 |
| 46 // Create a testing profile according to |params|. | 46 // Create a testing profile according to |params|. |
| 47 scoped_ptr<TestingProfile> BuildTestingProfile( | 47 std::unique_ptr<TestingProfile> BuildTestingProfile( |
| 48 const ExtensionServiceTestBase::ExtensionServiceInitParams& params) { | 48 const ExtensionServiceTestBase::ExtensionServiceInitParams& params) { |
| 49 TestingProfile::Builder profile_builder; | 49 TestingProfile::Builder profile_builder; |
| 50 // Create a PrefService that only contains user defined preference values. | 50 // Create a PrefService that only contains user defined preference values. |
| 51 syncable_prefs::PrefServiceMockFactory factory; | 51 syncable_prefs::PrefServiceMockFactory factory; |
| 52 // If pref_file is empty, TestingProfile automatically creates | 52 // If pref_file is empty, TestingProfile automatically creates |
| 53 // syncable_prefs::TestingPrefServiceSyncable instance. | 53 // syncable_prefs::TestingPrefServiceSyncable instance. |
| 54 if (!params.pref_file.empty()) { | 54 if (!params.pref_file.empty()) { |
| 55 factory.SetUserPrefsFile(params.pref_file, | 55 factory.SetUserPrefsFile(params.pref_file, |
| 56 base::ThreadTaskRunnerHandle::Get().get()); | 56 base::ThreadTaskRunnerHandle::Get().get()); |
| 57 scoped_refptr<user_prefs::PrefRegistrySyncable> registry( | 57 scoped_refptr<user_prefs::PrefRegistrySyncable> registry( |
| 58 new user_prefs::PrefRegistrySyncable); | 58 new user_prefs::PrefRegistrySyncable); |
| 59 scoped_ptr<syncable_prefs::PrefServiceSyncable> prefs( | 59 std::unique_ptr<syncable_prefs::PrefServiceSyncable> prefs( |
| 60 factory.CreateSyncable(registry.get())); | 60 factory.CreateSyncable(registry.get())); |
| 61 chrome::RegisterUserProfilePrefs(registry.get()); | 61 chrome::RegisterUserProfilePrefs(registry.get()); |
| 62 profile_builder.SetPrefService(std::move(prefs)); | 62 profile_builder.SetPrefService(std::move(prefs)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 if (params.profile_is_supervised) | 65 if (params.profile_is_supervised) |
| 66 profile_builder.SetSupervisedUserId("asdf"); | 66 profile_builder.SetSupervisedUserId("asdf"); |
| 67 | 67 |
| 68 profile_builder.SetPath(params.profile_path); | 68 profile_builder.SetPath(params.profile_path); |
| 69 return profile_builder.Build(); | 69 return profile_builder.Build(); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 // interfere with the tests. Those tests that need an external provider | 327 // interfere with the tests. Those tests that need an external provider |
| 328 // will register one specifically. | 328 // will register one specifically. |
| 329 service_->ClearProvidersForTesting(); | 329 service_->ClearProvidersForTesting(); |
| 330 | 330 |
| 331 #if defined(OS_CHROMEOS) | 331 #if defined(OS_CHROMEOS) |
| 332 InstallLimiter::Get(profile_.get())->DisableForTest(); | 332 InstallLimiter::Get(profile_.get())->DisableForTest(); |
| 333 #endif | 333 #endif |
| 334 } | 334 } |
| 335 | 335 |
| 336 } // namespace extensions | 336 } // namespace extensions |
| OLD | NEW |