1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/search/instant_search_prerenderer.h"
7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/metrics/field_trial.h"
11 #include "base/strings/string16.h"
12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/browser/prerender/prerender_contents.h"
14 #include "chrome/browser/prerender/prerender_handle.h"
15 #include "chrome/browser/prerender/prerender_manager.h"
16 #include "chrome/browser/prerender/prerender_manager_factory.h"
17 #include "chrome/browser/prerender/prerender_origin.h"
18 #include "chrome/browser/prerender/prerender_tab_helper.h"
19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/search/instant_service.h"
21 #include "chrome/browser/search/instant_unittest_base.h"
22 #include "chrome/browser/search/search.h"
23 #include "chrome/browser/search_engines/template_url_service_factory.h"
24 #include "chrome/browser/ui/browser_instant_controller.h"
25 #include "chrome/browser/ui/search/search_tab_helper.h"
26 #include "chrome/browser/ui/tabs/tab_strip_model.h"
27 #include "chrome/common/instant_types.h"
28 #include "chrome/common/render_messages.h"
29 #include "components/omnibox/autocomplete_match.h"
30 #include "content/public/browser/navigation_controller.h"
31 #include "content/public/browser/web_contents.h"
32 #include "content/public/common/url_constants.h"
33 #include "content/public/test/mock_render_process_host.h"
34 #include "ipc/ipc_message.h"
35 #include "ipc/ipc_test_sink.h"
36 #include "testing/gmock/include/gmock/gmock.h"
37 #include "ui/gfx/geometry/size.h"
39 using base::ASCIIToUTF16
;
43 using content::Referrer
;
44 using prerender::Origin
;
45 using prerender::PrerenderContents
;
46 using prerender::PrerenderHandle
;
47 using prerender::PrerenderManager
;
48 using prerender::PrerenderManagerFactory
;
49 using prerender::PrerenderTabHelper
;
51 class DummyPrerenderContents
: public PrerenderContents
{
53 DummyPrerenderContents(
54 PrerenderManager
* prerender_manager
,
57 const Referrer
& referrer
,
59 bool call_did_finish_load
);
61 void StartPrerendering(
62 const gfx::Size
& size
,
63 content::SessionStorageNamespace
* session_storage_namespace
) override
;
64 bool GetChildId(int* child_id
) const override
;
65 bool GetRouteId(int* route_id
) const override
;
70 bool call_did_finish_load_
;
72 DISALLOW_COPY_AND_ASSIGN(DummyPrerenderContents
);
75 class DummyPrerenderContentsFactory
: public PrerenderContents::Factory
{
77 explicit DummyPrerenderContentsFactory(bool call_did_finish_load
)
78 : call_did_finish_load_(call_did_finish_load
) {
81 PrerenderContents
* CreatePrerenderContents(
82 PrerenderManager
* prerender_manager
,
85 const Referrer
& referrer
,
87 uint8 experiment_id
) override
;
90 bool call_did_finish_load_
;
92 DISALLOW_COPY_AND_ASSIGN(DummyPrerenderContentsFactory
);
95 DummyPrerenderContents::DummyPrerenderContents(
96 PrerenderManager
* prerender_manager
,
99 const Referrer
& referrer
,
101 bool call_did_finish_load
)
102 : PrerenderContents(prerender_manager
, profile
, url
, referrer
, origin
,
103 PrerenderManager::kNoExperiment
),
106 call_did_finish_load_(call_did_finish_load
) {
109 void DummyPrerenderContents::StartPrerendering(
110 const gfx::Size
& size
,
111 content::SessionStorageNamespace
* session_storage_namespace
) {
112 content::SessionStorageNamespaceMap session_storage_namespace_map
;
113 session_storage_namespace_map
[std::string()] = session_storage_namespace
;
114 prerender_contents_
.reset(content::WebContents::CreateWithSessionStorage(
115 content::WebContents::CreateParams(profile_
),
116 session_storage_namespace_map
));
117 PrerenderTabHelper::CreateForWebContents(prerender_contents_
.get());
118 content::NavigationController::LoadURLParams
params(url_
);
119 prerender_contents_
->GetController().LoadURLWithParams(params
);
120 SearchTabHelper::CreateForWebContents(prerender_contents_
.get());
122 prerendering_has_started_
= true;
123 DCHECK(session_storage_namespace
);
124 session_storage_namespace_id_
= session_storage_namespace
->id();
125 NotifyPrerenderStart();
127 if (call_did_finish_load_
)
128 DidFinishLoad(prerender_contents_
->GetMainFrame(), url_
);
131 bool DummyPrerenderContents::GetChildId(int* child_id
) const {
136 bool DummyPrerenderContents::GetRouteId(int* route_id
) const {
141 PrerenderContents
* DummyPrerenderContentsFactory::CreatePrerenderContents(
142 PrerenderManager
* prerender_manager
,
145 const Referrer
& referrer
,
147 uint8 experiment_id
) {
148 return new DummyPrerenderContents(prerender_manager
, profile
, url
, referrer
,
149 origin
, call_did_finish_load_
);
154 class InstantSearchPrerendererTest
: public InstantUnitTestBase
{
156 InstantSearchPrerendererTest() {}
159 void SetUp() override
{
160 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("EmbeddedSearch",
162 InstantUnitTestBase::SetUp();
165 void Init(bool prerender_search_results_base_page
,
166 bool call_did_finish_load
) {
167 AddTab(browser(), GURL(url::kAboutBlankURL
));
169 PrerenderManagerFactory::GetForProfile(browser()->profile())->
170 SetPrerenderContentsFactory(
171 new DummyPrerenderContentsFactory(call_did_finish_load
));
172 if (prerender_search_results_base_page
) {
173 content::SessionStorageNamespace
* session_storage_namespace
=
174 GetActiveWebContents()->GetController().
175 GetDefaultSessionStorageNamespace();
176 InstantSearchPrerenderer
* prerenderer
= GetInstantSearchPrerenderer();
177 prerenderer
->Init(session_storage_namespace
, gfx::Size(640, 480));
178 EXPECT_NE(static_cast<PrerenderHandle
*>(NULL
), prerender_handle());
182 InstantSearchPrerenderer
* GetInstantSearchPrerenderer() {
183 return instant_service_
->instant_search_prerenderer();
186 const GURL
& GetPrerenderURL() {
187 return GetInstantSearchPrerenderer()->prerender_url_
;
190 void SetLastQuery(const base::string16
& query
) {
191 GetInstantSearchPrerenderer()->last_instant_suggestion_
=
192 InstantSuggestion(query
, std::string());
195 content::WebContents
* prerender_contents() {
196 return GetInstantSearchPrerenderer()->prerender_contents();
199 bool MessageWasSent(uint32 id
) {
200 content::MockRenderProcessHost
* process
=
201 static_cast<content::MockRenderProcessHost
*>(
202 prerender_contents()->GetRenderViewHost()->GetProcess());
203 return process
->sink().GetFirstMessageMatching(id
) != NULL
;
206 content::WebContents
* GetActiveWebContents() const {
207 return browser()->tab_strip_model()->GetWebContentsAt(0);
210 PrerenderHandle
* prerender_handle() {
211 return GetInstantSearchPrerenderer()->prerender_handle_
.get();
214 void PrerenderSearchQuery(const base::string16
& query
) {
216 InstantSearchPrerenderer
* prerenderer
= GetInstantSearchPrerenderer();
217 prerenderer
->Prerender(InstantSuggestion(query
, std::string()));
218 CommitPendingLoad(&prerender_contents()->GetController());
219 EXPECT_TRUE(prerenderer
->CanCommitQuery(GetActiveWebContents(), query
));
220 EXPECT_NE(static_cast<PrerenderHandle
*>(NULL
), prerender_handle());
224 TEST_F(InstantSearchPrerendererTest
, GetSearchTermsFromPrerenderedPage
) {
226 InstantSearchPrerenderer
* prerenderer
= GetInstantSearchPrerenderer();
227 GURL
url(GetPrerenderURL());
228 EXPECT_EQ(GURL("https://www.google.com/instant?ion=1&foo=foo#foo=foo&strk"),
230 EXPECT_EQ(base::UTF16ToASCII(prerenderer
->get_last_query()),
232 chrome::ExtractSearchTermsFromURL(profile(), url
)));
234 // Assume the prerendered page prefetched search results for the query
236 SetLastQuery(ASCIIToUTF16("flowers"));
237 EXPECT_EQ("flowers", base::UTF16ToASCII(prerenderer
->get_last_query()));
238 EXPECT_EQ(base::UTF16ToASCII(prerenderer
->get_last_query()),
240 chrome::ExtractSearchTermsFromURL(profile(), url
)));
243 TEST_F(InstantSearchPrerendererTest
, PrefetchSearchResults
) {
245 EXPECT_TRUE(prerender_handle()->IsFinishedLoading());
246 InstantSearchPrerenderer
* prerenderer
= GetInstantSearchPrerenderer();
247 prerenderer
->Prerender(
248 InstantSuggestion(ASCIIToUTF16("flowers"), std::string()));
249 EXPECT_EQ("flowers", base::UTF16ToASCII(prerenderer
->get_last_query()));
250 EXPECT_TRUE(MessageWasSent(
251 ChromeViewMsg_SearchBoxSetSuggestionToPrefetch::ID
));
254 TEST_F(InstantSearchPrerendererTest
, DoNotPrefetchSearchResults
) {
256 // Page hasn't finished loading yet.
257 EXPECT_FALSE(prerender_handle()->IsFinishedLoading());
258 InstantSearchPrerenderer
* prerenderer
= GetInstantSearchPrerenderer();
259 prerenderer
->Prerender(
260 InstantSuggestion(ASCIIToUTF16("flowers"), std::string()));
261 EXPECT_EQ("", base::UTF16ToASCII(prerenderer
->get_last_query()));
262 EXPECT_FALSE(MessageWasSent(
263 ChromeViewMsg_SearchBoxSetSuggestionToPrefetch::ID
));
266 TEST_F(InstantSearchPrerendererTest
, CanCommitQuery
) {
268 InstantSearchPrerenderer
* prerenderer
= GetInstantSearchPrerenderer();
269 base::string16 query
= ASCIIToUTF16("flowers");
270 prerenderer
->Prerender(InstantSuggestion(query
, std::string()));
271 EXPECT_TRUE(prerenderer
->CanCommitQuery(GetActiveWebContents(), query
));
273 // Make sure InstantSearchPrerenderer::CanCommitQuery() returns false for
274 // invalid search queries.
275 EXPECT_TRUE(prerenderer
->CanCommitQuery(GetActiveWebContents(),
276 ASCIIToUTF16("joy")));
277 EXPECT_FALSE(prerenderer
->CanCommitQuery(GetActiveWebContents(),
281 TEST_F(InstantSearchPrerendererTest
, CommitQuery
) {
282 base::string16 query
= ASCIIToUTF16("flowers");
283 PrerenderSearchQuery(query
);
284 InstantSearchPrerenderer
* prerenderer
= GetInstantSearchPrerenderer();
285 prerenderer
->Commit(query
, EmbeddedSearchRequestParams());
286 EXPECT_TRUE(MessageWasSent(ChromeViewMsg_SearchBoxSubmit::ID
));
289 TEST_F(InstantSearchPrerendererTest
, CancelPrerenderRequestOnTabChangeEvent
) {
291 EXPECT_NE(static_cast<PrerenderHandle
*>(NULL
), prerender_handle());
293 // Add a new tab to deactivate the current tab.
294 AddTab(browser(), GURL(url::kAboutBlankURL
));
295 EXPECT_EQ(2, browser()->tab_strip_model()->count());
297 // Make sure the pending prerender request is cancelled.
298 EXPECT_EQ(static_cast<PrerenderHandle
*>(NULL
), prerender_handle());
301 TEST_F(InstantSearchPrerendererTest
, CancelPendingPrerenderRequest
) {
303 EXPECT_NE(static_cast<PrerenderHandle
*>(NULL
), prerender_handle());
305 InstantSearchPrerenderer
* prerenderer
= GetInstantSearchPrerenderer();
306 prerenderer
->Cancel();
307 EXPECT_EQ(static_cast<PrerenderHandle
*>(NULL
), prerender_handle());
310 TEST_F(InstantSearchPrerendererTest
, PrerenderingAllowed
) {
312 InstantSearchPrerenderer
* prerenderer
= GetInstantSearchPrerenderer();
313 content::WebContents
* active_tab
= GetActiveWebContents();
314 EXPECT_EQ(GURL(url::kAboutBlankURL
), active_tab
->GetURL());
316 // Allow prerendering only for search type AutocompleteMatch suggestions.
317 AutocompleteMatch
search_type_match(NULL
, 1100, false,
318 AutocompleteMatchType::SEARCH_SUGGEST
);
319 search_type_match
.keyword
= ASCIIToUTF16("{google:baseurl}");
320 EXPECT_TRUE(AutocompleteMatch::IsSearchType(search_type_match
.type
));
321 EXPECT_TRUE(prerenderer
->IsAllowed(search_type_match
, active_tab
));
323 // Do not allow prerendering for custom search provider requests.
324 TemplateURLData data
;
325 data
.SetURL("https://www.dummyurl.com/search?q=%s&img=1");
326 data
.short_name
= ASCIIToUTF16("t");
327 data
.SetKeyword(ASCIIToUTF16("k"));
328 TemplateURL
* t_url
= new TemplateURL(data
);
329 TemplateURLService
* service
=
330 TemplateURLServiceFactory::GetForProfile(profile());
333 AutocompleteMatch
custom_search_type_match(
334 NULL
, 1100, false, AutocompleteMatchType::SEARCH_SUGGEST
);
335 custom_search_type_match
.keyword
= ASCIIToUTF16("k");
336 custom_search_type_match
.destination_url
=
337 GURL("https://www.dummyurl.com/search?q=fan&img=1");
338 TemplateURL
* template_url
=
339 custom_search_type_match
.GetTemplateURL(service
, false);
340 EXPECT_TRUE(template_url
);
341 EXPECT_TRUE(AutocompleteMatch::IsSearchType(custom_search_type_match
.type
));
342 EXPECT_FALSE(prerenderer
->IsAllowed(custom_search_type_match
, active_tab
));
344 AutocompleteMatch
url_type_match(NULL
, 1100, true,
345 AutocompleteMatchType::URL_WHAT_YOU_TYPED
);
346 EXPECT_FALSE(AutocompleteMatch::IsSearchType(url_type_match
.type
));
347 EXPECT_FALSE(prerenderer
->IsAllowed(url_type_match
, active_tab
));
349 // Search results page supports Instant search. InstantSearchPrerenderer is
350 // used only when the underlying page doesn't support Instant.
351 NavigateAndCommitActiveTab(GURL("https://www.google.com/alt#quux=foo&strk"));
352 active_tab
= GetActiveWebContents();
353 EXPECT_FALSE(chrome::ExtractSearchTermsFromURL(profile(),
354 active_tab
->GetURL()).empty());
355 EXPECT_FALSE(chrome::ShouldPrefetchSearchResultsOnSRP());
356 EXPECT_FALSE(prerenderer
->IsAllowed(search_type_match
, active_tab
));
359 TEST_F(InstantSearchPrerendererTest
, UsePrerenderPage
) {
360 PrerenderSearchQuery(ASCIIToUTF16("foo"));
362 // Open a search results page. A prerendered page exists for |url|. Make sure
363 // the browser swaps the current tab contents with the prerendered contents.
364 GURL
url("https://www.google.com/alt#quux=foo&strk");
365 browser()->OpenURL(content::OpenURLParams(url
, Referrer(), CURRENT_TAB
,
366 ui::PAGE_TRANSITION_TYPED
,
368 EXPECT_EQ(GetPrerenderURL(), GetActiveWebContents()->GetURL());
369 EXPECT_EQ(static_cast<PrerenderHandle
*>(NULL
), prerender_handle());
372 TEST_F(InstantSearchPrerendererTest
, PrerenderRequestCancelled
) {
373 PrerenderSearchQuery(ASCIIToUTF16("foo"));
375 // Cancel the prerender request.
376 InstantSearchPrerenderer
* prerenderer
= GetInstantSearchPrerenderer();
377 prerenderer
->Cancel();
378 EXPECT_EQ(static_cast<PrerenderHandle
*>(NULL
), prerender_handle());
380 // Open a search results page. Prerendered page does not exists for |url|.
381 // Make sure the browser navigates the current tab to this |url|.
382 GURL
url("https://www.google.com/alt#quux=foo&strk");
383 browser()->OpenURL(content::OpenURLParams(url
, Referrer(), CURRENT_TAB
,
384 ui::PAGE_TRANSITION_TYPED
,
386 EXPECT_NE(GetPrerenderURL(), GetActiveWebContents()->GetURL());
387 EXPECT_EQ(url
, GetActiveWebContents()->GetURL());
390 TEST_F(InstantSearchPrerendererTest
,
391 UsePrerenderedPage_SearchQueryMistmatch
) {
392 PrerenderSearchQuery(ASCIIToUTF16("foo"));
394 // Open a search results page. Committed query("pen") doesn't match with the
395 // prerendered search query("foo"). Make sure the browser swaps the current
396 // tab contents with the prerendered contents.
397 GURL
url("https://www.google.com/alt#quux=pen&strk");
398 browser()->OpenURL(content::OpenURLParams(url
, Referrer(), CURRENT_TAB
,
399 ui::PAGE_TRANSITION_TYPED
,
401 EXPECT_EQ(GetPrerenderURL(), GetActiveWebContents()->GetURL());
402 EXPECT_EQ(static_cast<PrerenderHandle
*>(NULL
), prerender_handle());
405 TEST_F(InstantSearchPrerendererTest
,
406 CancelPrerenderRequest_EmptySearchQueryCommitted
) {
407 PrerenderSearchQuery(ASCIIToUTF16("foo"));
409 // Open a search results page. Make sure the InstantSearchPrerenderer cancels
410 // the active prerender request upon the receipt of empty search query.
411 GURL
url("https://www.google.com/alt#quux=&strk");
412 browser()->OpenURL(content::OpenURLParams(url
, Referrer(), CURRENT_TAB
,
413 ui::PAGE_TRANSITION_TYPED
,
415 EXPECT_NE(GetPrerenderURL(), GetActiveWebContents()->GetURL());
416 EXPECT_EQ(url
, GetActiveWebContents()->GetURL());
417 EXPECT_EQ(static_cast<PrerenderHandle
*>(NULL
), prerender_handle());
420 TEST_F(InstantSearchPrerendererTest
,
421 CancelPrerenderRequest_UnsupportedDispositions
) {
422 PrerenderSearchQuery(ASCIIToUTF16("pen"));
424 // Open a search results page. Make sure the InstantSearchPrerenderer cancels
425 // the active prerender request for unsupported window dispositions.
426 GURL
url("https://www.google.com/alt#quux=pen&strk");
427 browser()->OpenURL(content::OpenURLParams(url
, Referrer(), NEW_FOREGROUND_TAB
,
428 ui::PAGE_TRANSITION_TYPED
,
430 content::WebContents
* new_tab
=
431 browser()->tab_strip_model()->GetWebContentsAt(1);
432 EXPECT_NE(GetPrerenderURL(), new_tab
->GetURL());
433 EXPECT_EQ(url
, new_tab
->GetURL());
434 EXPECT_EQ(static_cast<PrerenderHandle
*>(NULL
), prerender_handle());
437 class ReuseInstantSearchBasePageTest
: public InstantSearchPrerendererTest
{
439 ReuseInstantSearchBasePageTest() {}
442 void SetUp() override
{
443 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("EmbeddedSearch",
445 InstantUnitTestBase::SetUp();
449 TEST_F(ReuseInstantSearchBasePageTest
, CanCommitQuery
) {
451 InstantSearchPrerenderer
* prerenderer
= GetInstantSearchPrerenderer();
452 base::string16 query
= ASCIIToUTF16("flowers");
453 prerenderer
->Prerender(InstantSuggestion(query
, std::string()));
454 EXPECT_TRUE(prerenderer
->CanCommitQuery(GetActiveWebContents(), query
));
456 // When the Instant search base page has finished loading,
457 // InstantSearchPrerenderer can commit any search query to the prerendered
458 // page (even if it doesn't match the last known suggestion query).
459 EXPECT_TRUE(prerenderer
->CanCommitQuery(GetActiveWebContents(),
460 ASCIIToUTF16("joy")));
461 // Invalid search query committed.
462 EXPECT_FALSE(prerenderer
->CanCommitQuery(GetActiveWebContents(),
466 TEST_F(ReuseInstantSearchBasePageTest
,
467 CanCommitQuery_InstantSearchBasePageLoadInProgress
) {
469 InstantSearchPrerenderer
* prerenderer
= GetInstantSearchPrerenderer();
470 base::string16 query
= ASCIIToUTF16("flowers");
471 prerenderer
->Prerender(InstantSuggestion(query
, std::string()));
473 // When the Instant search base page hasn't finished loading,
474 // InstantSearchPrerenderer cannot commit any search query to the base page.
475 EXPECT_FALSE(prerenderer
->CanCommitQuery(GetActiveWebContents(), query
));
476 EXPECT_FALSE(prerenderer
->CanCommitQuery(GetActiveWebContents(),
477 ASCIIToUTF16("joy")));
480 #if !defined(OS_IOS) && !defined(OS_ANDROID)
481 class TestUsePrerenderPage
: public InstantSearchPrerendererTest
{
483 void SetUp() override
{
484 // Disable query extraction flag in field trials.
485 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
486 "EmbeddedSearch", "Group1 strk:20 query_extraction:0"));
487 InstantUnitTestBase::SetUpWithoutQueryExtraction();
491 TEST_F(TestUsePrerenderPage
, ExtractSearchTermsAndUsePrerenderPage
) {
492 PrerenderSearchQuery(ASCIIToUTF16("foo"));
494 // Open a search results page. Query extraction flag is disabled in field
495 // trials. Search results page URL does not contain search terms replacement
496 // key. Make sure UsePrerenderedPage() extracts the search terms from the URL
497 // and uses the prerendered page contents.
498 GURL
url("https://www.google.com/alt#quux=foo");
499 browser()->OpenURL(content::OpenURLParams(url
, Referrer(), CURRENT_TAB
,
500 ui::PAGE_TRANSITION_TYPED
,
502 EXPECT_EQ(GetPrerenderURL(), GetActiveWebContents()->GetURL());
503 EXPECT_EQ(static_cast<PrerenderHandle
*>(NULL
), prerender_handle());
506 TEST_F(TestUsePrerenderPage
, DoNotUsePrerenderPage
) {
507 PrerenderSearchQuery(ASCIIToUTF16("foo"));
509 // Do not use prerendered page for renderer initiated search request.
510 GURL
url("https://www.google.com/alt#quux=foo");
511 browser()->OpenURL(content::OpenURLParams(url
, Referrer(), CURRENT_TAB
,
512 ui::PAGE_TRANSITION_LINK
,
513 true /* is_renderer_initiated */));
514 EXPECT_NE(GetPrerenderURL(), GetActiveWebContents()->GetURL());
515 EXPECT_EQ(static_cast<PrerenderHandle
*>(NULL
), prerender_handle());
518 TEST_F(TestUsePrerenderPage
, SetEmbeddedSearchRequestParams
) {
519 PrerenderSearchQuery(ASCIIToUTF16("foo"));
520 EXPECT_TRUE(browser()->instant_controller());
522 // Open a search results page. Query extraction flag is disabled in field
523 // trials. Search results page URL does not contain search terms replacement
525 GURL
url("https://www.google.com/url?bar=foo&aqs=chrome...0&ie=utf-8&oq=f");
526 browser()->instant_controller()->OpenInstant(CURRENT_TAB
, url
);
527 content::MockRenderProcessHost
* process
=
528 static_cast<content::MockRenderProcessHost
*>(
529 prerender_contents()->GetRenderViewHost()->GetProcess());
530 const IPC::Message
* message
= process
->sink().GetFirstMessageMatching(
531 ChromeViewMsg_SearchBoxSubmit::ID
);
532 ASSERT_TRUE(message
);
534 // Verify the IPC message params.
535 Tuple
<base::string16
, EmbeddedSearchRequestParams
> params
;
536 ChromeViewMsg_SearchBoxSubmit::Read(message
, ¶ms
);
537 EXPECT_EQ("foo", base::UTF16ToASCII(get
<0>(params
)));
538 EXPECT_EQ("f", base::UTF16ToASCII(get
<1>(params
).original_query
));
539 EXPECT_EQ("utf-8", base::UTF16ToASCII(get
<1>(params
).input_encoding
));
540 EXPECT_EQ("", base::UTF16ToASCII(get
<1>(params
).rlz_parameter_value
));
541 EXPECT_EQ("chrome...0",
542 base::UTF16ToASCII(get
<1>(params
).assisted_query_stats
));