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

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

Issue 22945004: InstantExtended: Add new_tab_url to TemplateURL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 4 months 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) 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 EXPECT_NE(ASCIIToUTF16("fook"), t_urls[i]->keyword()); 226 EXPECT_NE(ASCIIToUTF16("fook"), t_urls[i]->keyword());
227 EXPECT_NE("foi.com", t_urls[i]->favicon_url().host()); 227 EXPECT_NE("foi.com", t_urls[i]->favicon_url().host());
228 EXPECT_NE("foo.com", t_urls[i]->url_ref().GetHost()); 228 EXPECT_NE("foo.com", t_urls[i]->url_ref().GetHost());
229 EXPECT_NE(1001, t_urls[i]->prepopulate_id()); 229 EXPECT_NE(1001, t_urls[i]->prepopulate_id());
230 } 230 }
231 // Ensures the default URL is Google and has the optional fields filled. 231 // Ensures the default URL is Google and has the optional fields filled.
232 EXPECT_EQ(ASCIIToUTF16("Google"), t_urls[default_index]->short_name()); 232 EXPECT_EQ(ASCIIToUTF16("Google"), t_urls[default_index]->short_name());
233 EXPECT_FALSE(t_urls[default_index]->suggestions_url().empty()); 233 EXPECT_FALSE(t_urls[default_index]->suggestions_url().empty());
234 EXPECT_FALSE(t_urls[default_index]->instant_url().empty()); 234 EXPECT_FALSE(t_urls[default_index]->instant_url().empty());
235 EXPECT_FALSE(t_urls[default_index]->image_url().empty()); 235 EXPECT_FALSE(t_urls[default_index]->image_url().empty());
236 EXPECT_FALSE(t_urls[default_index]->new_tab_url().empty());
236 EXPECT_FALSE(t_urls[default_index]->image_url_post_params().empty()); 237 EXPECT_FALSE(t_urls[default_index]->image_url_post_params().empty());
237 EXPECT_EQ(SEARCH_ENGINE_GOOGLE, 238 EXPECT_EQ(SEARCH_ENGINE_GOOGLE,
238 TemplateURLPrepopulateData::GetEngineType(*t_urls[default_index])); 239 TemplateURLPrepopulateData::GetEngineType(*t_urls[default_index]));
239 } 240 }
240 241
241 // Verifies that built-in search providers are processed correctly. 242 // Verifies that built-in search providers are processed correctly.
242 TEST(TemplateURLPrepopulateDataTest, ProvidersFromPrepopulated) { 243 TEST(TemplateURLPrepopulateDataTest, ProvidersFromPrepopulated) {
243 // Use United States. 244 // Use United States.
244 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 245 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
245 switches::kCountry, "US"); 246 switches::kCountry, "US");
(...skipping 12 matching lines...) Expand all
258 ASSERT_FALSE(t_urls[i]->url_ref().GetHost().empty()); 259 ASSERT_FALSE(t_urls[i]->url_ref().GetHost().empty());
259 ASSERT_FALSE(t_urls[i]->input_encodings().empty()); 260 ASSERT_FALSE(t_urls[i]->input_encodings().empty());
260 EXPECT_GT(t_urls[i]->prepopulate_id(), 0); 261 EXPECT_GT(t_urls[i]->prepopulate_id(), 0);
261 } 262 }
262 263
263 // Ensures the default URL is Google and has the optional fields filled. 264 // Ensures the default URL is Google and has the optional fields filled.
264 EXPECT_EQ(ASCIIToUTF16("Google"), t_urls[default_index]->short_name()); 265 EXPECT_EQ(ASCIIToUTF16("Google"), t_urls[default_index]->short_name());
265 EXPECT_FALSE(t_urls[default_index]->suggestions_url().empty()); 266 EXPECT_FALSE(t_urls[default_index]->suggestions_url().empty());
266 EXPECT_FALSE(t_urls[default_index]->instant_url().empty()); 267 EXPECT_FALSE(t_urls[default_index]->instant_url().empty());
267 EXPECT_FALSE(t_urls[default_index]->image_url().empty()); 268 EXPECT_FALSE(t_urls[default_index]->image_url().empty());
269 EXPECT_FALSE(t_urls[default_index]->new_tab_url().empty());
268 EXPECT_FALSE(t_urls[default_index]->image_url_post_params().empty()); 270 EXPECT_FALSE(t_urls[default_index]->image_url_post_params().empty());
269 // Expect at least 2 alternate_urls. 271 // Expect at least 2 alternate_urls.
270 // This caught a bug with static initialization of arrays, so leave this in. 272 // This caught a bug with static initialization of arrays, so leave this in.
271 EXPECT_GT(t_urls[default_index]->alternate_urls().size(), 1u); 273 EXPECT_GT(t_urls[default_index]->alternate_urls().size(), 1u);
272 for (size_t i = 0; i < t_urls[default_index]->alternate_urls().size(); ++i) 274 for (size_t i = 0; i < t_urls[default_index]->alternate_urls().size(); ++i)
273 EXPECT_FALSE(t_urls[default_index]->alternate_urls()[i].empty()); 275 EXPECT_FALSE(t_urls[default_index]->alternate_urls()[i].empty());
274 EXPECT_EQ(SEARCH_ENGINE_GOOGLE, 276 EXPECT_EQ(SEARCH_ENGINE_GOOGLE,
275 TemplateURLPrepopulateData::GetEngineType(*t_urls[default_index])); 277 TemplateURLPrepopulateData::GetEngineType(*t_urls[default_index]));
276 EXPECT_FALSE(t_urls[default_index]->search_terms_replacement_key().empty()); 278 EXPECT_FALSE(t_urls[default_index]->search_terms_replacement_key().empty());
277 } 279 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 362
361 TEST(TemplateURLPrepopulateDataTest, GetLogoURLInvalid) { 363 TEST(TemplateURLPrepopulateDataTest, GetLogoURLInvalid) {
362 TemplateURLData data; 364 TemplateURLData data;
363 data.SetURL("http://invalid:search:url/"); 365 data.SetURL("http://invalid:search:url/");
364 TemplateURL turl(NULL, data); 366 TemplateURL turl(NULL, data);
365 GURL logo_url = TemplateURLPrepopulateData::GetLogoURL( 367 GURL logo_url = TemplateURLPrepopulateData::GetLogoURL(
366 turl, TemplateURLPrepopulateData::LOGO_100_PERCENT); 368 turl, TemplateURLPrepopulateData::LOGO_100_PERCENT);
367 369
368 EXPECT_TRUE(logo_url.is_empty()); 370 EXPECT_TRUE(logo_url.is_empty());
369 } 371 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url_prepopulate_data.cc ('k') | chrome/browser/search_engines/template_url_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698