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

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

Issue 2516963002: Fix TemplateUrl::MatchesData comparison of search_terms_replacement_key (Closed)
Patch Set: More fixes after review Created 4 years, 1 month 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
OLDNEW
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 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 GURL("https://www.foo.org/search?q=Y+Z"), 1866 GURL("https://www.foo.org/search?q=Y+Z"),
1867 search_terms_data_, &search_terms)); 1867 search_terms_data_, &search_terms));
1868 EXPECT_EQ(base::ASCIIToUTF16("Y Z"), search_terms); 1868 EXPECT_EQ(base::ASCIIToUTF16("Y Z"), search_terms);
1869 EXPECT_TRUE(url.ExtractSearchTermsFromURL( 1869 EXPECT_TRUE(url.ExtractSearchTermsFromURL(
1870 GURL("https://www.foo.org/s#q=123"), 1870 GURL("https://www.foo.org/s#q=123"),
1871 search_terms_data_, &search_terms)); 1871 search_terms_data_, &search_terms));
1872 EXPECT_EQ(base::ASCIIToUTF16("123"), search_terms); 1872 EXPECT_EQ(base::ASCIIToUTF16("123"), search_terms);
1873 1873
1874 search_terms_data_.set_google_base_url("http://www.google.com/"); 1874 search_terms_data_.set_google_base_url("http://www.google.com/");
1875 } 1875 }
1876
1877 // Test that TemplateURL object created with settings for google engine
1878 // matches its TemplateURLData.
1879 TEST_F(TemplateURLTest, MatchesData) {
1880 TemplateURLData data;
1881 data.SetURL("{google:baseURL}search?q={searchTerms}");
1882 data.SetShortName(ASCIIToUTF16("Google"));
1883 data.SetKeyword(ASCIIToUTF16("google.com"));
1884 data.suggestions_url = "{google:baseSuggestURL}search?q={searchTerms}";
1885 data.instant_url = "{google:baseURL}webhp";
1886 data.image_url = "{google:baseURL}searchbyimage/upload";
1887 data.new_tab_url = "{google:baseURL}_/chrome/newtab";
1888 data.contextual_search_url = "{google:baseURL}_/contextualsearch";
1889 data.image_url_post_params = "encoded_image={google:imageThumbnail}";
1890 data.alternate_urls.push_back("{google:baseURL}s#q={searchTerms}");
1891 // search_terms_replacement_key with value of
1892 // "{google:instantExtendedEnabledKey}" is replaced inside TemplateUrl
1893 // constructor so must be handled specially inside MatchesData.
1894 data.search_terms_replacement_key = "{google:instantExtendedEnabledKey}";
1895 TemplateURL url(data);
1896 EXPECT_TRUE(TemplateURL::MatchesData(&url, &data, search_terms_data_));
1897 }
OLDNEW
« components/search_engines/template_url.cc ('K') | « components/search_engines/template_url.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698