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

Side by Side Diff: chrome/browser/ui/search/instant_search_prerenderer_unittest.cc

Issue 2816353002: Make const versions GetTemplateURLForKeyword, GetTemplateURLForGUID, GetTemplateURLForHost (Closed)
Patch Set: Make definition and declaration order of new functions match Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 "chrome/browser/ui/search/instant_search_prerenderer.h" 5 #include "chrome/browser/ui/search/instant_search_prerenderer.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <tuple> 10 #include <tuple>
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 data.SetKeyword(ASCIIToUTF16("k")); 348 data.SetKeyword(ASCIIToUTF16("k"));
349 TemplateURLService* service = 349 TemplateURLService* service =
350 TemplateURLServiceFactory::GetForProfile(profile()); 350 TemplateURLServiceFactory::GetForProfile(profile());
351 service->Add(base::MakeUnique<TemplateURL>(data)); 351 service->Add(base::MakeUnique<TemplateURL>(data));
352 service->Load(); 352 service->Load();
353 AutocompleteMatch custom_search_type_match( 353 AutocompleteMatch custom_search_type_match(
354 NULL, 1100, false, AutocompleteMatchType::SEARCH_SUGGEST); 354 NULL, 1100, false, AutocompleteMatchType::SEARCH_SUGGEST);
355 custom_search_type_match.keyword = ASCIIToUTF16("k"); 355 custom_search_type_match.keyword = ASCIIToUTF16("k");
356 custom_search_type_match.destination_url = 356 custom_search_type_match.destination_url =
357 GURL("https://www.dummyurl.com/search?q=fan&img=1"); 357 GURL("https://www.dummyurl.com/search?q=fan&img=1");
358 TemplateURL* template_url = 358 const TemplateURL* template_url =
359 custom_search_type_match.GetTemplateURL(service, false); 359 custom_search_type_match.GetTemplateURL(service, false);
360 EXPECT_TRUE(template_url); 360 EXPECT_TRUE(template_url);
361 EXPECT_TRUE(AutocompleteMatch::IsSearchType(custom_search_type_match.type)); 361 EXPECT_TRUE(AutocompleteMatch::IsSearchType(custom_search_type_match.type));
362 EXPECT_FALSE(prerenderer->IsAllowed(custom_search_type_match, active_tab)); 362 EXPECT_FALSE(prerenderer->IsAllowed(custom_search_type_match, active_tab));
363 363
364 AutocompleteMatch url_type_match(NULL, 1100, true, 364 AutocompleteMatch url_type_match(NULL, 1100, true,
365 AutocompleteMatchType::URL_WHAT_YOU_TYPED); 365 AutocompleteMatchType::URL_WHAT_YOU_TYPED);
366 EXPECT_FALSE(AutocompleteMatch::IsSearchType(url_type_match.type)); 366 EXPECT_FALSE(AutocompleteMatch::IsSearchType(url_type_match.type));
367 EXPECT_FALSE(prerenderer->IsAllowed(url_type_match, active_tab)); 367 EXPECT_FALSE(prerenderer->IsAllowed(url_type_match, active_tab));
368 } 368 }
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 Eq(base::ASCIIToUTF16("chrome...0")))))); 535 Eq(base::ASCIIToUTF16("chrome...0"))))));
536 536
537 // Open a search results page. Query extraction flag is disabled in field 537 // Open a search results page. Query extraction flag is disabled in field
538 // trials. Search results page URL does not contain search terms replacement 538 // trials. Search results page URL does not contain search terms replacement
539 // key. 539 // key.
540 GURL url("https://www.google.com/url?bar=foo&aqs=chrome...0&ie=utf-8&oq=f"); 540 GURL url("https://www.google.com/url?bar=foo&aqs=chrome...0&ie=utf-8&oq=f");
541 browser()->instant_controller()->OpenInstant( 541 browser()->instant_controller()->OpenInstant(
542 WindowOpenDisposition::CURRENT_TAB, url); 542 WindowOpenDisposition::CURRENT_TAB, url);
543 } 543 }
544 #endif 544 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/chrome_omnibox_client.cc ('k') | chrome/browser/ui/search_engines/edit_search_engine_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698