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

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

Issue 18119005: Misc. cleanup: (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 5 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 const char* kYahooURLs[] = { 297 const char* kYahooURLs[] = {
298 "http://search.yahoo.com/search?" 298 "http://search.yahoo.com/search?"
299 "ei={inputEncoding}&fr=crmas&p={searchTerms}", 299 "ei={inputEncoding}&fr=crmas&p={searchTerms}",
300 "http://search.yahoo.com/search?p={searchTerms}" 300 "http://search.yahoo.com/search?p={searchTerms}"
301 }; 301 };
302 for (size_t i = 0; i < arraysize(kYahooURLs); ++i) { 302 for (size_t i = 0; i < arraysize(kYahooURLs); ++i) {
303 EXPECT_EQ(SEARCH_ENGINE_YAHOO, 303 EXPECT_EQ(SEARCH_ENGINE_YAHOO,
304 TemplateURLPrepopulateData::GetEngineType(kYahooURLs[i])); 304 TemplateURLPrepopulateData::GetEngineType(kYahooURLs[i]));
305 } 305 }
306 // URLs for engines not present in country-specific lists. 306 // URLs for engines not present in country-specific lists.
307 std::string kNigmaURL = "http://www.nigma.ru/?s={searchTerms}&arg1=value1";
308 EXPECT_EQ(SEARCH_ENGINE_NIGMA, 307 EXPECT_EQ(SEARCH_ENGINE_NIGMA,
309 TemplateURLPrepopulateData::GetEngineType(kNigmaURL)); 308 TemplateURLPrepopulateData::GetEngineType(
309 "http://www.nigma.ru/?s={searchTerms}&arg1=value1"));
310 // Search URL for which no prepopulated search provider exists. 310 // Search URL for which no prepopulated search provider exists.
311 std::string kExampleSearchURL = "http://example.net/search?q={searchTerms}";
312 EXPECT_EQ(SEARCH_ENGINE_OTHER, 311 EXPECT_EQ(SEARCH_ENGINE_OTHER,
313 TemplateURLPrepopulateData::GetEngineType(kExampleSearchURL)); 312 TemplateURLPrepopulateData::GetEngineType(
313 "http://example.net/search?q={searchTerms}"));
314 EXPECT_EQ(SEARCH_ENGINE_OTHER, 314 EXPECT_EQ(SEARCH_ENGINE_OTHER,
315 TemplateURLPrepopulateData::GetEngineType("invalid:search:url")); 315 TemplateURLPrepopulateData::GetEngineType("invalid:search:url"));
316 } 316 }
317 317
318 TEST(TemplateURLPrepopulateDataTest, GetLogoURLGoogle) { 318 TEST(TemplateURLPrepopulateDataTest, GetLogoURLGoogle) {
319 TemplateURLData data; 319 TemplateURLData data;
320 data.SetURL("http://www.google.com/"); 320 data.SetURL("http://www.google.com/");
321 TemplateURL turl(NULL, data); 321 TemplateURL turl(NULL, data);
322 GURL logo_100_url = TemplateURLPrepopulateData::GetLogoURL( 322 GURL logo_100_url = TemplateURLPrepopulateData::GetLogoURL(
323 turl, TemplateURLPrepopulateData::LOGO_100_PERCENT); 323 turl, TemplateURLPrepopulateData::LOGO_100_PERCENT);
(...skipping 17 matching lines...) Expand all
341 341
342 TEST(TemplateURLPrepopulateDataTest, GetLogoURLInvalid) { 342 TEST(TemplateURLPrepopulateDataTest, GetLogoURLInvalid) {
343 TemplateURLData data; 343 TemplateURLData data;
344 data.SetURL("http://invalid:search:url/"); 344 data.SetURL("http://invalid:search:url/");
345 TemplateURL turl(NULL, data); 345 TemplateURL turl(NULL, data);
346 GURL logo_url = TemplateURLPrepopulateData::GetLogoURL( 346 GURL logo_url = TemplateURLPrepopulateData::GetLogoURL(
347 turl, TemplateURLPrepopulateData::LOGO_100_PERCENT); 347 turl, TemplateURLPrepopulateData::LOGO_100_PERCENT);
348 348
349 EXPECT_TRUE(logo_url.is_empty()); 349 EXPECT_TRUE(logo_url.is_empty());
350 } 350 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url.h ('k') | chrome/browser/search_engines/template_url_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698