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/template_url_prepopulate_data.h" | 9 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
10 #include "chrome/browser/search_engines/template_url_service.h" | 10 #include "chrome/browser/search_engines/template_url_service.h" |
11 #include "chrome/common/chrome_switches.h" | |
12 #include "chrome/common/pref_names.h" | |
13 #include "components/google/core/browser/google_switches.h" | 11 #include "components/google/core/browser/google_switches.h" |
14 #include "components/pref_registry/testing_pref_service_syncable.h" | 12 #include "components/pref_registry/testing_pref_service_syncable.h" |
15 #include "components/search_engines/prepopulated_engines.h" | 13 #include "components/search_engines/prepopulated_engines.h" |
| 14 #include "components/search_engines/search_engines_pref_names.h" |
16 #include "components/search_engines/search_terms_data.h" | 15 #include "components/search_engines/search_terms_data.h" |
17 #include "components/search_engines/template_url.h" | 16 #include "components/search_engines/template_url.h" |
18 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
20 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
21 | 20 |
22 using base::ASCIIToUTF16; | 21 using base::ASCIIToUTF16; |
23 | 22 |
24 namespace { | 23 namespace { |
25 | 24 |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 EXPECT_EQ(SEARCH_ENGINE_OTHER, GetEngineType("invalid:search:url")); | 342 EXPECT_EQ(SEARCH_ENGINE_OTHER, GetEngineType("invalid:search:url")); |
344 | 343 |
345 // URL that doesn't look Google-related, but matches a Google base URL | 344 // URL that doesn't look Google-related, but matches a Google base URL |
346 // specified on the command line. | 345 // specified on the command line. |
347 const std::string foo_url("http://www.foo.com/search?q={searchTerms}"); | 346 const std::string foo_url("http://www.foo.com/search?q={searchTerms}"); |
348 EXPECT_EQ(SEARCH_ENGINE_OTHER, GetEngineType(foo_url)); | 347 EXPECT_EQ(SEARCH_ENGINE_OTHER, GetEngineType(foo_url)); |
349 CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kGoogleBaseURL, | 348 CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kGoogleBaseURL, |
350 "http://www.foo.com/"); | 349 "http://www.foo.com/"); |
351 EXPECT_EQ(SEARCH_ENGINE_GOOGLE, GetEngineType(foo_url)); | 350 EXPECT_EQ(SEARCH_ENGINE_GOOGLE, GetEngineType(foo_url)); |
352 } | 351 } |
OLD | NEW |