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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 170 |
171 util_.TearDown(); | 171 util_.TearDown(); |
172 testing::Test::TearDown(); | 172 testing::Test::TearDown(); |
173 } | 173 } |
174 | 174 |
175 void SearchProviderInstallDataTest::SimulateDefaultSearchIsManaged( | 175 void SearchProviderInstallDataTest::SimulateDefaultSearchIsManaged( |
176 const std::string& url) { | 176 const std::string& url) { |
177 ASSERT_FALSE(url.empty()); | 177 ASSERT_FALSE(url.empty()); |
178 TestingPrefServiceSyncable* service = | 178 TestingPrefServiceSyncable* service = |
179 util_.profile()->GetTestingPrefService(); | 179 util_.profile()->GetTestingPrefService(); |
180 service->SetManagedPref(prefs::kDefaultSearchProviderEnabled, | 180 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue); |
181 base::Value::CreateBooleanValue(true)); | 181 value->Set(DefaultSearchManager::kShortName, |
182 service->SetManagedPref(prefs::kDefaultSearchProviderSearchURL, | 182 base::Value::CreateStringValue("managed")); |
183 base::Value::CreateStringValue(url)); | 183 value->Set(DefaultSearchManager::kKeyword, |
184 service->SetManagedPref(prefs::kDefaultSearchProviderName, | 184 base::Value::CreateStringValue("managed")); |
185 base::Value::CreateStringValue("managed")); | 185 value->Set(DefaultSearchManager::kURL, base::Value::CreateStringValue(url)); |
186 service->SetManagedPref(prefs::kDefaultSearchProviderKeyword, | 186 service->SetManagedPref( |
187 new base::StringValue("managed")); | 187 DefaultSearchManager::kDefaultSearchProviderDataPrefName, |
188 // Clear the IDs that are not specified via policy. | 188 value.release()); |
189 service->SetManagedPref(prefs::kDefaultSearchProviderID, | |
190 new base::StringValue(std::string())); | |
191 service->SetManagedPref(prefs::kDefaultSearchProviderPrepopulateID, | |
192 new base::StringValue(std::string())); | |
193 util_.model()->Observe(chrome::NOTIFICATION_DEFAULT_SEARCH_POLICY_CHANGED, | |
194 content::NotificationService::AllSources(), | |
195 content::NotificationService::NoDetails()); | |
196 } | 189 } |
197 | 190 |
198 TemplateURL* SearchProviderInstallDataTest::AddNewTemplateURL( | 191 TemplateURL* SearchProviderInstallDataTest::AddNewTemplateURL( |
199 const std::string& url, | 192 const std::string& url, |
200 const base::string16& keyword) { | 193 const base::string16& keyword) { |
201 TemplateURLData data; | 194 TemplateURLData data; |
202 data.short_name = keyword; | 195 data.short_name = keyword; |
203 data.SetKeyword(keyword); | 196 data.SetKeyword(keyword); |
204 data.SetURL(url); | 197 data.SetURL(url); |
205 TemplateURL* t_url = new TemplateURL(util_.profile(), data); | 198 TemplateURL* t_url = new TemplateURL(util_.profile(), data); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 269 |
277 // Change the Google base url. | 270 // Change the Google base url. |
278 google_host = "foo.com"; | 271 google_host = "foo.com"; |
279 util_.SetGoogleBaseURL(GURL("http://" + google_host + "/")); | 272 util_.SetGoogleBaseURL(GURL("http://" + google_host + "/")); |
280 // Wait for the I/O thread to process the update notification. | 273 // Wait for the I/O thread to process the update notification. |
281 base::RunLoop().RunUntilIdle(); | 274 base::RunLoop().RunUntilIdle(); |
282 | 275 |
283 // Verify that the change got picked up. | 276 // Verify that the change got picked up. |
284 test_get_install_state.RunTests(google_host, std::string()); | 277 test_get_install_state.RunTests(google_host, std::string()); |
285 } | 278 } |
OLD | NEW |