Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: chrome/browser/search_engines/search_provider_install_data_unittest.cc

Issue 5646003: Sanitize PrefStore interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix PrefService mock construction in PrefServiceTest to include command line store. Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "base/task.h" 10 #include "base/task.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 Source<SearchProviderInstallDataTest>(this), 183 Source<SearchProviderInstallDataTest>(this),
184 NotificationService::NoDetails()); 184 NotificationService::NoDetails());
185 185
186 util_.TearDown(); 186 util_.TearDown();
187 testing::Test::TearDown(); 187 testing::Test::TearDown();
188 } 188 }
189 189
190 void SimulateDefaultSearchIsManaged(const std::string& url) { 190 void SimulateDefaultSearchIsManaged(const std::string& url) {
191 ASSERT_FALSE(url.empty()); 191 ASSERT_FALSE(url.empty());
192 TestingPrefService* service = util_.profile()->GetTestingPrefService(); 192 TestingPrefService* service = util_.profile()->GetTestingPrefService();
193 service->SetManagedPrefWithoutNotification( 193 service->SetManagedPref(
194 prefs::kDefaultSearchProviderEnabled, 194 prefs::kDefaultSearchProviderEnabled,
195 Value::CreateBooleanValue(true)); 195 Value::CreateBooleanValue(true));
196 service->SetManagedPrefWithoutNotification( 196 service->SetManagedPref(
197 prefs::kDefaultSearchProviderSearchURL, 197 prefs::kDefaultSearchProviderSearchURL,
198 Value::CreateStringValue(url)); 198 Value::CreateStringValue(url));
199 service->SetManagedPrefWithoutNotification( 199 service->SetManagedPref(
200 prefs::kDefaultSearchProviderName, 200 prefs::kDefaultSearchProviderName,
201 Value::CreateStringValue("managed")); 201 Value::CreateStringValue("managed"));
202 // Clear the IDs that are not specified via policy. 202 // Clear the IDs that are not specified via policy.
203 service->SetManagedPrefWithoutNotification( 203 service->SetManagedPref(
204 prefs::kDefaultSearchProviderID, new StringValue("")); 204 prefs::kDefaultSearchProviderID, new StringValue(""));
205 service->SetManagedPrefWithoutNotification( 205 service->SetManagedPref(
206 prefs::kDefaultSearchProviderPrepopulateID, new StringValue("")); 206 prefs::kDefaultSearchProviderPrepopulateID, new StringValue(""));
207 util_.model()->Observe( 207 util_.model()->Observe(
208 NotificationType::PREF_CHANGED, 208 NotificationType::PREF_CHANGED,
209 Source<PrefService>(util_.profile()->GetTestingPrefService()), 209 Source<PrefService>(util_.profile()->GetTestingPrefService()),
210 Details<std::string>(NULL)); 210 Details<std::string>(NULL));
211 } 211 }
212 212
213 protected: 213 protected:
214 TemplateURLModelTestUtil util_; 214 TemplateURLModelTestUtil util_;
215 215
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 // Change the Google base url. 304 // Change the Google base url.
305 google_host = "foo.com"; 305 google_host = "foo.com";
306 util_.SetGoogleBaseURL("http://" + google_host + "/"); 306 util_.SetGoogleBaseURL("http://" + google_host + "/");
307 // Wait for the I/O thread to process the update notification. 307 // Wait for the I/O thread to process the update notification.
308 TemplateURLModelTestUtil::BlockTillIOThreadProcessesRequests(); 308 TemplateURLModelTestUtil::BlockTillIOThreadProcessesRequests();
309 309
310 // Verify that the change got picked up. 310 // Verify that the change got picked up.
311 test_get_install_state->set_search_provider_host(google_host); 311 test_get_install_state->set_search_provider_host(google_host);
312 EXPECT_TRUE(test_get_install_state->RunTests()); 312 EXPECT_TRUE(test_get_install_state->RunTests());
313 } 313 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698