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

Side by Side Diff: chrome/browser/search_engines/template_url_unittest.cc

Issue 70163003: Try to fix flaky test TemplateURLTest.ReplacePageClassification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/base_paths.h" 5 #include "base/base_paths.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 EXPECT_EQ("http://www.google.com/search?a=b&q=abc#oq=def&x", 1201 EXPECT_EQ("http://www.google.com/search?a=b&q=abc#oq=def&x",
1202 url.url_ref().ReplaceSearchTerms(search_terms)); 1202 url.url_ref().ReplaceSearchTerms(search_terms));
1203 1203
1204 // Turn off the flag. Now the command-line arg should be ignored again. 1204 // Turn off the flag. Now the command-line arg should be ignored again.
1205 search_terms.append_extra_query_params = false; 1205 search_terms.append_extra_query_params = false;
1206 EXPECT_EQ("http://www.google.com/search?q=abc#oq=def&x", 1206 EXPECT_EQ("http://www.google.com/search?q=abc#oq=def&x",
1207 url.url_ref().ReplaceSearchTerms(search_terms)); 1207 url.url_ref().ReplaceSearchTerms(search_terms));
1208 } 1208 }
1209 1209
1210 // Tests replacing pageClassification. 1210 // Tests replacing pageClassification.
1211 #if defined(OS_ANDROID) 1211 TEST_F(TemplateURLTest, ReplacePageClassification) {
1212 #define MAYBE_ReplacePageClassification DISABLED_ReplacePageClassification 1212 UIThreadSearchTermsData::SetGoogleBaseURL("http://www.google.com/");
1213 #else
1214 #define MAYBE_ReplacePageClassification ReplacePageClassification
1215 #endif
1216 TEST_F(TemplateURLTest, MAYBE_ReplacePageClassification) {
1217 TemplateURLData data; 1213 TemplateURLData data;
1218 data.input_encodings.push_back("UTF-8"); 1214 data.input_encodings.push_back("UTF-8");
1219 data.SetURL("{google:baseURL}?{google:pageClassification}q={searchTerms}"); 1215 data.SetURL("{google:baseURL}?{google:pageClassification}q={searchTerms}");
1220 TemplateURL url(NULL, data); 1216 TemplateURL url(NULL, data);
1221 EXPECT_TRUE(url.url_ref().IsValid()); 1217 EXPECT_TRUE(url.url_ref().IsValid());
1222 ASSERT_TRUE(url.url_ref().SupportsReplacement()); 1218 ASSERT_TRUE(url.url_ref().SupportsReplacement());
1223 TemplateURLRef::SearchTermsArgs search_terms_args(ASCIIToUTF16("foo")); 1219 TemplateURLRef::SearchTermsArgs search_terms_args(ASCIIToUTF16("foo"));
1224 1220
1225 std::string result = url.url_ref().ReplaceSearchTerms(search_terms_args); 1221 std::string result = url.url_ref().ReplaceSearchTerms(search_terms_args);
1226 EXPECT_EQ("http://www.google.com/?q=foo", result); 1222 EXPECT_EQ("http://www.google.com/?q=foo", result);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 url.url_ref_.showing_search_terms_ = true; 1283 url.url_ref_.showing_search_terms_ = true;
1288 search_terms_args.bookmark_bar_pinned = false; 1284 search_terms_args.bookmark_bar_pinned = false;
1289 result = url.url_ref().ReplaceSearchTerms(search_terms_args); 1285 result = url.url_ref().ReplaceSearchTerms(search_terms_args);
1290 EXPECT_EQ("http://www.google.com/?bmbp=0&q=foo", result); 1286 EXPECT_EQ("http://www.google.com/?bmbp=0&q=foo", result);
1291 1287
1292 url.url_ref_.showing_search_terms_ = true; 1288 url.url_ref_.showing_search_terms_ = true;
1293 search_terms_args.bookmark_bar_pinned = true; 1289 search_terms_args.bookmark_bar_pinned = true;
1294 result = url.url_ref().ReplaceSearchTerms(search_terms_args); 1290 result = url.url_ref().ReplaceSearchTerms(search_terms_args);
1295 EXPECT_EQ("http://www.google.com/?bmbp=1&q=foo", result); 1291 EXPECT_EQ("http://www.google.com/?bmbp=1&q=foo", result);
1296 } 1292 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698