| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1861 GURL("https://www.foo.org/search?q=Y+Z"), | 1861 GURL("https://www.foo.org/search?q=Y+Z"), |
| 1862 search_terms_data_, &search_terms)); | 1862 search_terms_data_, &search_terms)); |
| 1863 EXPECT_EQ(base::ASCIIToUTF16("Y Z"), search_terms); | 1863 EXPECT_EQ(base::ASCIIToUTF16("Y Z"), search_terms); |
| 1864 EXPECT_TRUE(url.ExtractSearchTermsFromURL( | 1864 EXPECT_TRUE(url.ExtractSearchTermsFromURL( |
| 1865 GURL("https://www.foo.org/s#q=123"), | 1865 GURL("https://www.foo.org/s#q=123"), |
| 1866 search_terms_data_, &search_terms)); | 1866 search_terms_data_, &search_terms)); |
| 1867 EXPECT_EQ(base::ASCIIToUTF16("123"), search_terms); | 1867 EXPECT_EQ(base::ASCIIToUTF16("123"), search_terms); |
| 1868 | 1868 |
| 1869 search_terms_data_.set_google_base_url("http://www.google.com/"); | 1869 search_terms_data_.set_google_base_url("http://www.google.com/"); |
| 1870 } | 1870 } |
| 1871 | |
| 1872 // Test that TemplateURL object created with settings for google engine | |
| 1873 // matches its TemplateURLData. | |
| 1874 TEST_F(TemplateURLTest, MatchesData) { | |
| 1875 TemplateURLData data; | |
| 1876 data.SetURL("{google:baseURL}search?q={searchTerms}"); | |
| 1877 data.SetShortName(ASCIIToUTF16("Google")); | |
| 1878 data.SetKeyword(ASCIIToUTF16("google.com")); | |
| 1879 data.suggestions_url = "{google:baseSuggestURL}search?q={searchTerms}"; | |
| 1880 data.instant_url = "{google:baseURL}webhp"; | |
| 1881 data.image_url = "{google:baseURL}searchbyimage/upload"; | |
| 1882 data.new_tab_url = "{google:baseURL}_/chrome/newtab"; | |
| 1883 data.contextual_search_url = "{google:baseURL}_/contextualsearch"; | |
| 1884 data.image_url_post_params = "encoded_image={google:imageThumbnail}"; | |
| 1885 data.alternate_urls.push_back("{google:baseURL}s#q={searchTerms}"); | |
| 1886 // search_terms_replacement_key with value of | |
| 1887 // "{google:instantExtendedEnabledKey}" is replaced inside TemplateUrl | |
| 1888 // constructor so must be handled specially inside MatchesData. | |
| 1889 data.search_terms_replacement_key = "{google:instantExtendedEnabledKey}"; | |
| 1890 TemplateURL url(data); | |
| 1891 EXPECT_TRUE(TemplateURL::MatchesData(&url, &data, search_terms_data_)); | |
| 1892 } | |
| OLD | NEW |