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/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
7 #include "base/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/search_engines/prepopulated_engines.h" | 9 #include "chrome/browser/search_engines/prepopulated_engines.h" |
10 #include "chrome/browser/search_engines/search_terms_data.h" | 10 #include "chrome/browser/search_engines/search_terms_data.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 EXPECT_NE("foi.com", t_urls[i]->favicon_url().host()); | 219 EXPECT_NE("foi.com", t_urls[i]->favicon_url().host()); |
220 EXPECT_NE("foo.com", t_urls[i]->url_ref().GetHost()); | 220 EXPECT_NE("foo.com", t_urls[i]->url_ref().GetHost()); |
221 EXPECT_NE(1001, t_urls[i]->prepopulate_id()); | 221 EXPECT_NE(1001, t_urls[i]->prepopulate_id()); |
222 } | 222 } |
223 // Ensures the default URL is Google and has the optional fields filled. | 223 // Ensures the default URL is Google and has the optional fields filled. |
224 EXPECT_EQ(ASCIIToUTF16("Google"), t_urls[default_index]->short_name()); | 224 EXPECT_EQ(ASCIIToUTF16("Google"), t_urls[default_index]->short_name()); |
225 EXPECT_FALSE(t_urls[default_index]->suggestions_url().empty()); | 225 EXPECT_FALSE(t_urls[default_index]->suggestions_url().empty()); |
226 EXPECT_FALSE(t_urls[default_index]->instant_url().empty()); | 226 EXPECT_FALSE(t_urls[default_index]->instant_url().empty()); |
227 EXPECT_FALSE(t_urls[default_index]->image_url().empty()); | 227 EXPECT_FALSE(t_urls[default_index]->image_url().empty()); |
228 EXPECT_FALSE(t_urls[default_index]->image_url_post_params().empty()); | 228 EXPECT_FALSE(t_urls[default_index]->image_url_post_params().empty()); |
229 EXPECT_FALSE(t_urls[default_index]->new_tab_url().empty()); | |
Peter Kasting
2013/08/14 23:21:45
Nit: Move up one line (2 places)
Jered
2013/08/15 16:44:03
Done.
| |
229 EXPECT_EQ( | 230 EXPECT_EQ( |
230 SEARCH_ENGINE_GOOGLE, | 231 SEARCH_ENGINE_GOOGLE, |
231 TemplateURLPrepopulateData::GetEngineType(t_urls[default_index]->url())); | 232 TemplateURLPrepopulateData::GetEngineType(t_urls[default_index]->url())); |
232 } | 233 } |
233 | 234 |
234 // Verifies that built-in search providers are processed correctly. | 235 // Verifies that built-in search providers are processed correctly. |
235 TEST(TemplateURLPrepopulateDataTest, ProvidersFromPrepopulated) { | 236 TEST(TemplateURLPrepopulateDataTest, ProvidersFromPrepopulated) { |
236 // Use United States. | 237 // Use United States. |
237 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 238 CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
238 switches::kCountry, "US"); | 239 switches::kCountry, "US"); |
(...skipping 13 matching lines...) Expand all Loading... | |
252 ASSERT_FALSE(t_urls[i]->input_encodings().empty()); | 253 ASSERT_FALSE(t_urls[i]->input_encodings().empty()); |
253 EXPECT_GT(t_urls[i]->prepopulate_id(), 0); | 254 EXPECT_GT(t_urls[i]->prepopulate_id(), 0); |
254 } | 255 } |
255 | 256 |
256 // Ensures the default URL is Google and has the optional fields filled. | 257 // Ensures the default URL is Google and has the optional fields filled. |
257 EXPECT_EQ(ASCIIToUTF16("Google"), t_urls[default_index]->short_name()); | 258 EXPECT_EQ(ASCIIToUTF16("Google"), t_urls[default_index]->short_name()); |
258 EXPECT_FALSE(t_urls[default_index]->suggestions_url().empty()); | 259 EXPECT_FALSE(t_urls[default_index]->suggestions_url().empty()); |
259 EXPECT_FALSE(t_urls[default_index]->instant_url().empty()); | 260 EXPECT_FALSE(t_urls[default_index]->instant_url().empty()); |
260 EXPECT_FALSE(t_urls[default_index]->image_url().empty()); | 261 EXPECT_FALSE(t_urls[default_index]->image_url().empty()); |
261 EXPECT_FALSE(t_urls[default_index]->image_url_post_params().empty()); | 262 EXPECT_FALSE(t_urls[default_index]->image_url_post_params().empty()); |
263 EXPECT_FALSE(t_urls[default_index]->new_tab_url().empty()); | |
262 // Expect at least 2 alternate_urls. | 264 // Expect at least 2 alternate_urls. |
263 // This caught a bug with static initialization of arrays, so leave this in. | 265 // This caught a bug with static initialization of arrays, so leave this in. |
264 EXPECT_GT(t_urls[default_index]->alternate_urls().size(), 1u); | 266 EXPECT_GT(t_urls[default_index]->alternate_urls().size(), 1u); |
265 for (size_t i = 0; i < t_urls[default_index]->alternate_urls().size(); ++i) | 267 for (size_t i = 0; i < t_urls[default_index]->alternate_urls().size(); ++i) |
266 EXPECT_FALSE(t_urls[default_index]->alternate_urls()[i].empty()); | 268 EXPECT_FALSE(t_urls[default_index]->alternate_urls()[i].empty()); |
267 EXPECT_EQ( | 269 EXPECT_EQ( |
268 SEARCH_ENGINE_GOOGLE, | 270 SEARCH_ENGINE_GOOGLE, |
269 TemplateURLPrepopulateData::GetEngineType(t_urls[default_index]->url())); | 271 TemplateURLPrepopulateData::GetEngineType(t_urls[default_index]->url())); |
270 EXPECT_FALSE(t_urls[default_index]->search_terms_replacement_key().empty()); | 272 EXPECT_FALSE(t_urls[default_index]->search_terms_replacement_key().empty()); |
271 } | 273 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
366 | 368 |
367 TEST(TemplateURLPrepopulateDataTest, GetLogoURLInvalid) { | 369 TEST(TemplateURLPrepopulateDataTest, GetLogoURLInvalid) { |
368 TemplateURLData data; | 370 TemplateURLData data; |
369 data.SetURL("http://invalid:search:url/"); | 371 data.SetURL("http://invalid:search:url/"); |
370 TemplateURL turl(NULL, data); | 372 TemplateURL turl(NULL, data); |
371 GURL logo_url = TemplateURLPrepopulateData::GetLogoURL( | 373 GURL logo_url = TemplateURLPrepopulateData::GetLogoURL( |
372 turl, TemplateURLPrepopulateData::LOGO_100_PERCENT); | 374 turl, TemplateURLPrepopulateData::LOGO_100_PERCENT); |
373 | 375 |
374 EXPECT_TRUE(logo_url.is_empty()); | 376 EXPECT_TRUE(logo_url.is_empty()); |
375 } | 377 } |
OLD | NEW |