| 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/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 service->SetManagedPref(prefs::kDefaultSearchProviderPrepopulateID, | 225 service->SetManagedPref(prefs::kDefaultSearchProviderPrepopulateID, |
| 226 new StringValue(std::string())); | 226 new StringValue(std::string())); |
| 227 util_.model()->Observe(chrome::NOTIFICATION_PREF_CHANGED, | 227 util_.model()->Observe(chrome::NOTIFICATION_PREF_CHANGED, |
| 228 content::Source<PrefService>(util_.profile()->GetTestingPrefService()), | 228 content::Source<PrefService>(util_.profile()->GetTestingPrefService()), |
| 229 content::Details<std::string>(NULL)); | 229 content::Details<std::string>(NULL)); |
| 230 } | 230 } |
| 231 | 231 |
| 232 TemplateURL* SearchProviderInstallDataTest::AddNewTemplateURL( | 232 TemplateURL* SearchProviderInstallDataTest::AddNewTemplateURL( |
| 233 const std::string& url, | 233 const std::string& url, |
| 234 const string16& keyword) { | 234 const string16& keyword) { |
| 235 TemplateURL* t_url = new TemplateURL(); | 235 TemplateURLData data; |
| 236 t_url->set_short_name(keyword); | 236 data.short_name = keyword; |
| 237 t_url->set_keyword(keyword); | 237 data.SetKeyword(keyword); |
| 238 t_url->SetURL(url); | 238 data.SetURL(url); |
| 239 TemplateURL* t_url = new TemplateURL(data); |
| 239 util_.model()->Add(t_url); | 240 util_.model()->Add(t_url); |
| 240 return t_url; | 241 return t_url; |
| 241 } | 242 } |
| 242 | 243 |
| 243 | 244 |
| 244 // Actual tests --------------------------------------------------------------- | 245 // Actual tests --------------------------------------------------------------- |
| 245 | 246 |
| 246 TEST_F(SearchProviderInstallDataTest, GetInstallState) { | 247 TEST_F(SearchProviderInstallDataTest, GetInstallState) { |
| 247 // Set up the database. | 248 // Set up the database. |
| 248 util_.ChangeModelToLoadState(); | 249 util_.ChangeModelToLoadState(); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 // Change the Google base url. | 320 // Change the Google base url. |
| 320 google_host = "foo.com"; | 321 google_host = "foo.com"; |
| 321 util_.SetGoogleBaseURL("http://" + google_host + "/"); | 322 util_.SetGoogleBaseURL("http://" + google_host + "/"); |
| 322 // Wait for the I/O thread to process the update notification. | 323 // Wait for the I/O thread to process the update notification. |
| 323 TemplateURLServiceTestUtil::BlockTillIOThreadProcessesRequests(); | 324 TemplateURLServiceTestUtil::BlockTillIOThreadProcessesRequests(); |
| 324 | 325 |
| 325 // Verify that the change got picked up. | 326 // Verify that the change got picked up. |
| 326 test_get_install_state->set_search_provider_host(google_host); | 327 test_get_install_state->set_search_provider_host(google_host); |
| 327 EXPECT_TRUE(test_get_install_state->RunTests()); | 328 EXPECT_TRUE(test_get_install_state->RunTests()); |
| 328 } | 329 } |
| OLD | NEW |