| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/search_engines/search_terms_data.h" | 10 #include "chrome/browser/search_engines/search_terms_data.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 unique_ids.end()); | 88 unique_ids.end()); |
| 89 unique_ids.insert(urls[turl_i]->prepopulate_id()); | 89 unique_ids.insert(urls[turl_i]->prepopulate_id()); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 // Verifies that default search providers from the preferences file | 94 // Verifies that default search providers from the preferences file |
| 95 // override the built-in ones. | 95 // override the built-in ones. |
| 96 TEST(TemplateURLPrepopulateDataTest, ProvidersFromPrefs) { | 96 TEST(TemplateURLPrepopulateDataTest, ProvidersFromPrefs) { |
| 97 TestingProfile profile; | 97 TestingProfile profile; |
| 98 TestingPrefService* prefs = profile.GetTestingPrefService(); | 98 TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService(); |
| 99 prefs->SetUserPref(prefs::kSearchProviderOverridesVersion, | 99 prefs->SetUserPref(prefs::kSearchProviderOverridesVersion, |
| 100 Value::CreateIntegerValue(1)); | 100 Value::CreateIntegerValue(1)); |
| 101 ListValue* overrides = new ListValue; | 101 ListValue* overrides = new ListValue; |
| 102 scoped_ptr<DictionaryValue> entry(new DictionaryValue); | 102 scoped_ptr<DictionaryValue> entry(new DictionaryValue); |
| 103 // Set only the minimal required settings for a search provider configuration. | 103 // Set only the minimal required settings for a search provider configuration. |
| 104 entry->SetString("name", "foo"); | 104 entry->SetString("name", "foo"); |
| 105 entry->SetString("keyword", "fook"); | 105 entry->SetString("keyword", "fook"); |
| 106 entry->SetString("search_url", "http://foo.com/s?q={searchTerms}"); | 106 entry->SetString("search_url", "http://foo.com/s?q={searchTerms}"); |
| 107 entry->SetString("favicon_url", "http://foi.com/favicon.ico"); | 107 entry->SetString("favicon_url", "http://foi.com/favicon.ico"); |
| 108 entry->SetString("encoding", "UTF-8"); | 108 entry->SetString("encoding", "UTF-8"); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 291 |
| 292 TEST(TemplateURLPrepopulateDataTest, GetLogoURLInvalid) { | 292 TEST(TemplateURLPrepopulateDataTest, GetLogoURLInvalid) { |
| 293 TemplateURLData data; | 293 TemplateURLData data; |
| 294 data.SetURL("http://invalid:search:url/"); | 294 data.SetURL("http://invalid:search:url/"); |
| 295 TemplateURL turl(NULL, data); | 295 TemplateURL turl(NULL, data); |
| 296 GURL logo_url = TemplateURLPrepopulateData::GetLogoURL( | 296 GURL logo_url = TemplateURLPrepopulateData::GetLogoURL( |
| 297 turl, TemplateURLPrepopulateData::LOGO_100_PERCENT); | 297 turl, TemplateURLPrepopulateData::LOGO_100_PERCENT); |
| 298 | 298 |
| 299 EXPECT_TRUE(logo_url.is_empty()); | 299 EXPECT_TRUE(logo_url.is_empty()); |
| 300 } | 300 } |
| OLD | NEW |