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

Unified Diff: chrome/browser/search_engines/template_url_unittest.cc

Issue 228013002: Use whether a query is from the app list to determine the RLZ parameter. (Closed) Base URL: http://git.chromium.org/chromium/src.git@rlz-access-ids
Patch Set: Created 6 years, 8 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search_engines/template_url_unittest.cc
diff --git a/chrome/browser/search_engines/template_url_unittest.cc b/chrome/browser/search_engines/template_url_unittest.cc
index 68b907b1cb7842e1971b6649d8bd0e5699215b54..c8a4085ef104c494dea849ee069194ff147a5818 100644
--- a/chrome/browser/search_engines/template_url_unittest.cc
+++ b/chrome/browser/search_engines/template_url_unittest.cc
@@ -681,6 +681,34 @@ TEST_F(TemplateURLTest, RLZ) {
EXPECT_EQ(expected_url, result.spec());
}
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
+TEST_F(TemplateURLTest, RLZFromAppList) {
+ base::string16 rlz_string;
+#if defined(ENABLE_RLZ)
+ std::string brand;
+ if (google_util::GetBrand(&brand) && !brand.empty() &&
+ !google_util::IsOrganic(brand)) {
+ RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_APP_LIST, &rlz_string);
+ }
+#endif
+
+ TemplateURLData data;
+ data.SetURL("http://bar/?{google:RLZ}{searchTerms}");
+ TemplateURL url(NULL, data);
+ EXPECT_TRUE(url.url_ref().IsValid());
+ ASSERT_TRUE(url.url_ref().SupportsReplacement());
+ TemplateURLRef::SearchTermsArgs args(ASCIIToUTF16("x"));
+ args.from_app_list = true;
+ GURL result(url.url_ref().ReplaceSearchTerms(args));
+ ASSERT_TRUE(result.is_valid());
+ std::string expected_url = "http://bar/?";
+ if (!rlz_string.empty())
+ expected_url += "rlz=" + base::UTF16ToUTF8(rlz_string) + "&";
+ expected_url += "x";
+ EXPECT_EQ(expected_url, result.spec());
+}
+#endif
+
TEST_F(TemplateURLTest, HostAndSearchTermKey) {
struct TestData {
const std::string url;
« no previous file with comments | « chrome/browser/search_engines/template_url.cc ('k') | chrome/browser/ui/app_list/search/omnibox_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698