Chromium Code Reviews| 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/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/memory/scoped_vector.h" | 6 #include "base/memory/scoped_vector.h" |
| 7 #include "base/scoped_temp_dir.h" | 7 #include "base/scoped_temp_dir.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/search_engines/search_terms_data.h" | 9 #include "chrome/browser/search_engines/search_terms_data.h" |
| 10 #include "chrome/browser/search_engines/template_url.h" | 10 #include "chrome/browser/search_engines/template_url.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 std::string kNigmaURL = "http://www.nigma.ru/?s={searchTerms}&arg1=value1"; | 169 std::string kNigmaURL = "http://www.nigma.ru/?s={searchTerms}&arg1=value1"; |
| 170 EXPECT_EQ(SEARCH_ENGINE_NIGMA, | 170 EXPECT_EQ(SEARCH_ENGINE_NIGMA, |
| 171 TemplateURLPrepopulateData::GetEngineType(kNigmaURL)); | 171 TemplateURLPrepopulateData::GetEngineType(kNigmaURL)); |
| 172 // Search URL for which no prepopulated search provider exists. | 172 // Search URL for which no prepopulated search provider exists. |
| 173 std::string kExampleSearchURL = "http://example.net/search?q={searchTerms}"; | 173 std::string kExampleSearchURL = "http://example.net/search?q={searchTerms}"; |
| 174 EXPECT_EQ(SEARCH_ENGINE_OTHER, | 174 EXPECT_EQ(SEARCH_ENGINE_OTHER, |
| 175 TemplateURLPrepopulateData::GetEngineType(kExampleSearchURL)); | 175 TemplateURLPrepopulateData::GetEngineType(kExampleSearchURL)); |
| 176 EXPECT_EQ(SEARCH_ENGINE_OTHER, | 176 EXPECT_EQ(SEARCH_ENGINE_OTHER, |
| 177 TemplateURLPrepopulateData::GetEngineType("invalid:search:url")); | 177 TemplateURLPrepopulateData::GetEngineType("invalid:search:url")); |
| 178 } | 178 } |
| 179 | |
| 180 TEST(TemplateURLPrepopulateDataTest, GetLogoURLGoogle) { | |
| 181 EXPECT_EQ("www.google.com", | |
|
msw
2012/08/27 21:57:26
nit: get each logo URL once and test the host/sche
samarth
2012/08/28 16:18:15
Done.
| |
| 182 TemplateURLPrepopulateData::GetLogoURL( | |
| 183 "http://www.google.com/").host()); | |
| 184 EXPECT_EQ("www.google.com", | |
| 185 TemplateURLPrepopulateData::GetLogo200PercentURL( | |
| 186 "http://www.google.com/").host()); | |
| 187 EXPECT_TRUE(TemplateURLPrepopulateData::GetLogoURL( | |
| 188 "http://www.google.com/").SchemeIsSecure()); | |
| 189 EXPECT_TRUE(TemplateURLPrepopulateData::GetLogo200PercentURL( | |
| 190 "http://www.google.com/").SchemeIsSecure()); | |
| 191 } | |
| 192 | |
| 193 TEST(TemplateURLPrepopulateDataTest, GetLogoURLUnknown) { | |
| 194 EXPECT_TRUE(TemplateURLPrepopulateData::GetLogoURL( | |
| 195 "http://www.yahoo.com/").is_empty()); | |
|
msw
2012/08/27 21:57:26
nit: this will fail if/when yahoo is added, use a
samarth
2012/08/28 16:18:15
Done.
| |
| 196 EXPECT_TRUE(TemplateURLPrepopulateData::GetLogoURL( | |
| 197 "invalid:search:url").is_empty()); | |
| 198 } | |
| OLD | NEW |