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/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/memory/scoped_vector.h" | 6 #include "base/memory/scoped_vector.h" |
7 #include "base/scoped_temp_dir.h" | 7 #include "base/scoped_temp_dir.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/search_engines/search_terms_data.h" | 9 #include "chrome/browser/search_engines/search_terms_data.h" |
10 #include "chrome/browser/search_engines/template_url.h" | 10 #include "chrome/browser/search_engines/template_url.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 prefs->SetUserPref(prefs::kSearchProviderOverridesVersion, | 97 prefs->SetUserPref(prefs::kSearchProviderOverridesVersion, |
98 Value::CreateIntegerValue(1)); | 98 Value::CreateIntegerValue(1)); |
99 ListValue* overrides = new ListValue; | 99 ListValue* overrides = new ListValue; |
100 DictionaryValue* entry = new DictionaryValue; | 100 DictionaryValue* entry = new DictionaryValue; |
101 entry->SetString("name", "foo"); | 101 entry->SetString("name", "foo"); |
102 entry->SetString("keyword", "fook"); | 102 entry->SetString("keyword", "fook"); |
103 entry->SetString("search_url", "http://foo.com/s?q={searchTerms}"); | 103 entry->SetString("search_url", "http://foo.com/s?q={searchTerms}"); |
104 entry->SetString("favicon_url", "http://foi.com/favicon.ico"); | 104 entry->SetString("favicon_url", "http://foi.com/favicon.ico"); |
105 entry->SetString("suggest_url", ""); | 105 entry->SetString("suggest_url", ""); |
106 entry->SetString("instant_url", ""); | 106 entry->SetString("instant_url", ""); |
| 107 entry->SetString("alternate_urls", ""); |
107 entry->SetString("encoding", "UTF-8"); | 108 entry->SetString("encoding", "UTF-8"); |
108 entry->SetInteger("id", 1001); | 109 entry->SetInteger("id", 1001); |
109 overrides->Append(entry); | 110 overrides->Append(entry); |
110 prefs->SetUserPref(prefs::kSearchProviderOverrides, overrides); | 111 prefs->SetUserPref(prefs::kSearchProviderOverrides, overrides); |
111 | 112 |
112 int version = TemplateURLPrepopulateData::GetDataVersion(prefs); | 113 int version = TemplateURLPrepopulateData::GetDataVersion(prefs); |
113 EXPECT_EQ(1, version); | 114 EXPECT_EQ(1, version); |
114 | 115 |
115 ScopedVector<TemplateURL> t_urls; | 116 ScopedVector<TemplateURL> t_urls; |
116 size_t default_index; | 117 size_t default_index; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 204 |
204 TEST(TemplateURLPrepopulateDataTest, GetLogoURLInvalid) { | 205 TEST(TemplateURLPrepopulateDataTest, GetLogoURLInvalid) { |
205 TemplateURLData data; | 206 TemplateURLData data; |
206 data.SetURL("http://invalid:search:url/"); | 207 data.SetURL("http://invalid:search:url/"); |
207 TemplateURL turl(NULL, data); | 208 TemplateURL turl(NULL, data); |
208 GURL logo_url = TemplateURLPrepopulateData::GetLogoURL( | 209 GURL logo_url = TemplateURLPrepopulateData::GetLogoURL( |
209 turl, TemplateURLPrepopulateData::LOGO_100_PERCENT); | 210 turl, TemplateURLPrepopulateData::LOGO_100_PERCENT); |
210 | 211 |
211 EXPECT_TRUE(logo_url.is_empty()); | 212 EXPECT_TRUE(logo_url.is_empty()); |
212 } | 213 } |
OLD | NEW |