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

Side by Side Diff: components/search_engines/template_url_prepopulate_data_unittest.cc

Issue 382663004: Componentize tests under search_engines (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Include search_engines even if os=="ios" Created 6 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 "components/google/core/browser/google_switches.h" 9 #include "components/google/core/browser/google_switches.h"
10 #include "components/pref_registry/testing_pref_service_syncable.h" 10 #include "components/pref_registry/testing_pref_service_syncable.h"
11 #include "components/search_engines/prepopulated_engines.h" 11 #include "components/search_engines/prepopulated_engines.h"
12 #include "components/search_engines/search_engines_pref_names.h" 12 #include "components/search_engines/search_engines_pref_names.h"
13 #include "components/search_engines/search_terms_data.h" 13 #include "components/search_engines/search_terms_data.h"
14 #include "components/search_engines/template_url.h" 14 #include "components/search_engines/template_url.h"
15 #include "components/search_engines/template_url_prepopulate_data.h" 15 #include "components/search_engines/template_url_prepopulate_data.h"
16 #include "components/search_engines/template_url_service.h" 16 #include "components/search_engines/template_url_service.h"
17 #include "grit/generated_resources.h"
18 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
19 #include "ui/base/l10n/l10n_util.h"
20 18
21 using base::ASCIIToUTF16; 19 using base::ASCIIToUTF16;
22 20
23 namespace { 21 namespace {
24 22
25 SearchEngineType GetEngineType(const std::string& url) { 23 SearchEngineType GetEngineType(const std::string& url) {
26 TemplateURLData data; 24 TemplateURLData data;
27 data.SetURL(url); 25 data.SetURL(url);
28 return TemplateURLPrepopulateData::GetEngineType(TemplateURL(data), 26 return TemplateURLPrepopulateData::GetEngineType(TemplateURL(data),
29 SearchTermsData()); 27 SearchTermsData());
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 EXPECT_EQ(SEARCH_ENGINE_OTHER, GetEngineType("invalid:search:url")); 340 EXPECT_EQ(SEARCH_ENGINE_OTHER, GetEngineType("invalid:search:url"));
343 341
344 // URL that doesn't look Google-related, but matches a Google base URL 342 // URL that doesn't look Google-related, but matches a Google base URL
345 // specified on the command line. 343 // specified on the command line.
346 const std::string foo_url("http://www.foo.com/search?q={searchTerms}"); 344 const std::string foo_url("http://www.foo.com/search?q={searchTerms}");
347 EXPECT_EQ(SEARCH_ENGINE_OTHER, GetEngineType(foo_url)); 345 EXPECT_EQ(SEARCH_ENGINE_OTHER, GetEngineType(foo_url));
348 CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kGoogleBaseURL, 346 CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kGoogleBaseURL,
349 "http://www.foo.com/"); 347 "http://www.foo.com/");
350 EXPECT_EQ(SEARCH_ENGINE_GOOGLE, GetEngineType(foo_url)); 348 EXPECT_EQ(SEARCH_ENGINE_GOOGLE, GetEngineType(foo_url));
351 } 349 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698