| 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/files/file_util.h" | 5 #include "base/files/file_util.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
| 10 #include "components/search_engines/search_terms_data.h" | 10 #include "components/search_engines/search_terms_data.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 return (name_str_.empty() || key.find(name_str_) == std::string::npos) && | 45 return (name_str_.empty() || key.find(name_str_) == std::string::npos) && |
| 46 (value_str_.empty() || value.find(value_str_) == std::string::npos); | 46 (value_str_.empty() || value.find(value_str_) == std::string::npos); |
| 47 } | 47 } |
| 48 | 48 |
| 49 | 49 |
| 50 // TemplateURLParserTest ------------------------------------------------------ | 50 // TemplateURLParserTest ------------------------------------------------------ |
| 51 | 51 |
| 52 class TemplateURLParserTest : public testing::Test { | 52 class TemplateURLParserTest : public testing::Test { |
| 53 protected: | 53 protected: |
| 54 TemplateURLParserTest(); | 54 TemplateURLParserTest(); |
| 55 virtual ~TemplateURLParserTest(); | 55 ~TemplateURLParserTest() override; |
| 56 | 56 |
| 57 virtual void SetUp() override; | 57 void SetUp() override; |
| 58 | 58 |
| 59 bool is_disabled() const; | 59 bool is_disabled() const; |
| 60 | 60 |
| 61 // Parses the OpenSearch description document at file_name (relative to the | 61 // Parses the OpenSearch description document at file_name (relative to the |
| 62 // data dir). The TemplateURL is placed in |template_url_|. | 62 // data dir). The TemplateURL is placed in |template_url_|. |
| 63 void ParseFile(const std::string& file_name, | 63 void ParseFile(const std::string& file_name, |
| 64 TemplateURLParser::ParameterFilter* filter); | 64 TemplateURLParser::ParameterFilter* filter); |
| 65 | 65 |
| 66 // ParseFile parses the results into this template_url. | 66 // ParseFile parses the results into this template_url. |
| 67 scoped_ptr<TemplateURL> template_url_; | 67 scoped_ptr<TemplateURL> template_url_; |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 EXPECT_EQ(ASCIIToUTF16("Yahoo"), template_url_->short_name()); | 253 EXPECT_EQ(ASCIIToUTF16("Yahoo"), template_url_->short_name()); |
| 254 EXPECT_TRUE(template_url_->url_ref().SupportsReplacement(SearchTermsData())); | 254 EXPECT_TRUE(template_url_->url_ref().SupportsReplacement(SearchTermsData())); |
| 255 EXPECT_TRUE(template_url_->suggestions_url().empty()); | 255 EXPECT_TRUE(template_url_->suggestions_url().empty()); |
| 256 EXPECT_EQ("http://search.yahoo.com/search?p={searchTerms}&ei=UTF-8", | 256 EXPECT_EQ("http://search.yahoo.com/search?p={searchTerms}&ei=UTF-8", |
| 257 template_url_->url()); | 257 template_url_->url()); |
| 258 ASSERT_EQ(1U, template_url_->input_encodings().size()); | 258 ASSERT_EQ(1U, template_url_->input_encodings().size()); |
| 259 EXPECT_EQ("UTF-8", template_url_->input_encodings()[0]); | 259 EXPECT_EQ("UTF-8", template_url_->input_encodings()[0]); |
| 260 EXPECT_EQ(GURL("http://search.yahoo.com/favicon.ico"), | 260 EXPECT_EQ(GURL("http://search.yahoo.com/favicon.ico"), |
| 261 template_url_->favicon_url()); | 261 template_url_->favicon_url()); |
| 262 } | 262 } |
| OLD | NEW |