OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/search_engines/template_url_service_test_util.h" | 5 #include "chrome/browser/search_engines/template_url_service_test_util.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
10 #include "chrome/browser/history/history_service_factory.h" | 10 #include "chrome/browser/history/history_service_factory.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 } // namespace | 44 } // namespace |
45 | 45 |
46 void SetManagedDefaultSearchPreferences(const TemplateURLData& managed_data, | 46 void SetManagedDefaultSearchPreferences(const TemplateURLData& managed_data, |
47 bool enabled, | 47 bool enabled, |
48 TestingProfile* profile) { | 48 TestingProfile* profile) { |
49 auto dict = TemplateURLDataToDictionary(managed_data); | 49 auto dict = TemplateURLDataToDictionary(managed_data); |
50 dict->SetBoolean(DefaultSearchManager::kDisabledByPolicy, !enabled); | 50 dict->SetBoolean(DefaultSearchManager::kDisabledByPolicy, !enabled); |
51 | 51 |
52 profile->GetTestingPrefService()->SetManagedPref( | 52 profile->GetTestingPrefService()->SetManagedPref( |
53 DefaultSearchManager::kDefaultSearchProviderDataPrefName, dict.release()); | 53 DefaultSearchManager::kDefaultSearchProviderDataPrefName, |
| 54 std::move(dict)); |
54 } | 55 } |
55 | 56 |
56 void RemoveManagedDefaultSearchPreferences(TestingProfile* profile) { | 57 void RemoveManagedDefaultSearchPreferences(TestingProfile* profile) { |
57 profile->GetTestingPrefService()->RemoveManagedPref( | 58 profile->GetTestingPrefService()->RemoveManagedPref( |
58 DefaultSearchManager::kDefaultSearchProviderDataPrefName); | 59 DefaultSearchManager::kDefaultSearchProviderDataPrefName); |
59 } | 60 } |
60 | 61 |
61 TemplateURLServiceTestUtil::TemplateURLServiceTestUtil() | 62 TemplateURLServiceTestUtil::TemplateURLServiceTestUtil() |
62 : changed_count_(0), | 63 : changed_count_(0), |
63 search_terms_data_(NULL) { | 64 search_terms_data_(NULL) { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 const std::string& extension_id) { | 180 const std::string& extension_id) { |
180 TemplateURL* turl = model()->FindTemplateURLForExtension( | 181 TemplateURL* turl = model()->FindTemplateURLForExtension( |
181 extension_id, TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION); | 182 extension_id, TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION); |
182 ASSERT_TRUE(turl); | 183 ASSERT_TRUE(turl); |
183 ASSERT_TRUE(turl->GetExtensionInfoForTesting()); | 184 ASSERT_TRUE(turl->GetExtensionInfoForTesting()); |
184 if (turl->GetExtensionInfoForTesting()->wants_to_be_default_engine) | 185 if (turl->GetExtensionInfoForTesting()->wants_to_be_default_engine) |
185 RemoveExtensionDefaultSearchFromPrefs(profile()->GetTestingPrefService()); | 186 RemoveExtensionDefaultSearchFromPrefs(profile()->GetTestingPrefService()); |
186 model()->RemoveExtensionControlledTURL( | 187 model()->RemoveExtensionControlledTURL( |
187 extension_id, TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION); | 188 extension_id, TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION); |
188 } | 189 } |
OLD | NEW |