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

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

Issue 276073002: [AiS] Provide Answers queries with a session token. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to HEAD, update kCurrentDataVersion Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/search_engines/template_url.cc ('k') | 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 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 std::string result = url.url_ref().ReplaceSearchTerms(search_terms_args); 1336 std::string result = url.url_ref().ReplaceSearchTerms(search_terms_args);
1337 EXPECT_EQ("http://bar/search?q=foo&xssi=t", result); 1337 EXPECT_EQ("http://bar/search?q=foo&xssi=t", result);
1338 1338
1339 CommandLine::ForCurrentProcess()->AppendSwitch( 1339 CommandLine::ForCurrentProcess()->AppendSwitch(
1340 switches::kEnableAnswersInSuggest); 1340 switches::kEnableAnswersInSuggest);
1341 TemplateURL url2(NULL, data); 1341 TemplateURL url2(NULL, data);
1342 result = url2.url_ref().ReplaceSearchTerms(search_terms_args); 1342 result = url2.url_ref().ReplaceSearchTerms(search_terms_args);
1343 EXPECT_EQ("http://bar/search?q=foo&gs_rn=42&xssi=t", result); 1343 EXPECT_EQ("http://bar/search?q=foo&gs_rn=42&xssi=t", result);
1344 } 1344 }
1345 #endif 1345 #endif
1346
1347 TEST_F(TemplateURLTest, SessionToken) {
1348 TemplateURLData data;
1349 UIThreadSearchTermsData::SetGoogleBaseURL("http://bar/");
1350 data.SetURL("http://bar/search?q={searchTerms}&{google:sessionToken}xssi=t");
1351
1352 TemplateURL url(NULL, data);
1353 TemplateURLRef::SearchTermsArgs search_terms_args(ASCIIToUTF16("foo"));
1354 search_terms_args.session_token = "SESSIONTOKENGOESHERE";
1355 std::string result = url.url_ref().ReplaceSearchTerms(search_terms_args);
1356 EXPECT_EQ("http://bar/search?q=foo&psi=SESSIONTOKENGOESHERE&xssi=t", result);
1357
1358 TemplateURL url2(NULL, data);
1359 search_terms_args.session_token = "";
1360 result = url.url_ref().ReplaceSearchTerms(search_terms_args);
1361 EXPECT_EQ("http://bar/search?q=foo&xssi=t", result);
1362 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698