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

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

Issue 2290503003: Remove use of stl_util in search_engines. (Closed)
Patch Set: fix broken test Created 4 years, 3 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>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ptr_util.h"
14 #include "base/metrics/field_trial.h" 15 #include "base/metrics/field_trial.h"
15 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
16 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
17 #include "build/build_config.h" 18 #include "build/build_config.h"
18 #include "chrome/browser/prerender/prerender_contents.h" 19 #include "chrome/browser/prerender/prerender_contents.h"
19 #include "chrome/browser/prerender/prerender_handle.h" 20 #include "chrome/browser/prerender/prerender_handle.h"
20 #include "chrome/browser/prerender/prerender_manager.h" 21 #include "chrome/browser/prerender/prerender_manager.h"
21 #include "chrome/browser/prerender/prerender_manager_factory.h" 22 #include "chrome/browser/prerender/prerender_manager_factory.h"
22 #include "chrome/browser/prerender/prerender_origin.h" 23 #include "chrome/browser/prerender/prerender_origin.h"
23 #include "chrome/browser/prerender/prerender_tab_helper.h" 24 #include "chrome/browser/prerender/prerender_tab_helper.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 AutocompleteMatchType::SEARCH_SUGGEST); 321 AutocompleteMatchType::SEARCH_SUGGEST);
321 search_type_match.keyword = ASCIIToUTF16("{google:baseurl}"); 322 search_type_match.keyword = ASCIIToUTF16("{google:baseurl}");
322 EXPECT_TRUE(AutocompleteMatch::IsSearchType(search_type_match.type)); 323 EXPECT_TRUE(AutocompleteMatch::IsSearchType(search_type_match.type));
323 EXPECT_TRUE(prerenderer->IsAllowed(search_type_match, active_tab)); 324 EXPECT_TRUE(prerenderer->IsAllowed(search_type_match, active_tab));
324 325
325 // Do not allow prerendering for custom search provider requests. 326 // Do not allow prerendering for custom search provider requests.
326 TemplateURLData data; 327 TemplateURLData data;
327 data.SetURL("https://www.dummyurl.com/search?q=%s&img=1"); 328 data.SetURL("https://www.dummyurl.com/search?q=%s&img=1");
328 data.SetShortName(ASCIIToUTF16("t")); 329 data.SetShortName(ASCIIToUTF16("t"));
329 data.SetKeyword(ASCIIToUTF16("k")); 330 data.SetKeyword(ASCIIToUTF16("k"));
330 TemplateURL* t_url = new TemplateURL(data);
331 TemplateURLService* service = 331 TemplateURLService* service =
332 TemplateURLServiceFactory::GetForProfile(profile()); 332 TemplateURLServiceFactory::GetForProfile(profile());
333 service->Add(t_url); 333 service->Add(base::MakeUnique<TemplateURL>(data));
334 service->Load(); 334 service->Load();
335 AutocompleteMatch custom_search_type_match( 335 AutocompleteMatch custom_search_type_match(
336 NULL, 1100, false, AutocompleteMatchType::SEARCH_SUGGEST); 336 NULL, 1100, false, AutocompleteMatchType::SEARCH_SUGGEST);
337 custom_search_type_match.keyword = ASCIIToUTF16("k"); 337 custom_search_type_match.keyword = ASCIIToUTF16("k");
338 custom_search_type_match.destination_url = 338 custom_search_type_match.destination_url =
339 GURL("https://www.dummyurl.com/search?q=fan&img=1"); 339 GURL("https://www.dummyurl.com/search?q=fan&img=1");
340 TemplateURL* template_url = 340 TemplateURL* template_url =
341 custom_search_type_match.GetTemplateURL(service, false); 341 custom_search_type_match.GetTemplateURL(service, false);
342 EXPECT_TRUE(template_url); 342 EXPECT_TRUE(template_url);
343 EXPECT_TRUE(AutocompleteMatch::IsSearchType(custom_search_type_match.type)); 343 EXPECT_TRUE(AutocompleteMatch::IsSearchType(custom_search_type_match.type));
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 std::tuple<base::string16, EmbeddedSearchRequestParams> params; 522 std::tuple<base::string16, EmbeddedSearchRequestParams> params;
523 ChromeViewMsg_SearchBoxSubmit::Read(message, &params); 523 ChromeViewMsg_SearchBoxSubmit::Read(message, &params);
524 EXPECT_EQ("foo", base::UTF16ToASCII(std::get<0>(params))); 524 EXPECT_EQ("foo", base::UTF16ToASCII(std::get<0>(params)));
525 EXPECT_EQ("f", base::UTF16ToASCII(std::get<1>(params).original_query)); 525 EXPECT_EQ("f", base::UTF16ToASCII(std::get<1>(params).original_query));
526 EXPECT_EQ("utf-8", base::UTF16ToASCII(std::get<1>(params).input_encoding)); 526 EXPECT_EQ("utf-8", base::UTF16ToASCII(std::get<1>(params).input_encoding));
527 EXPECT_EQ("", base::UTF16ToASCII(std::get<1>(params).rlz_parameter_value)); 527 EXPECT_EQ("", base::UTF16ToASCII(std::get<1>(params).rlz_parameter_value));
528 EXPECT_EQ("chrome...0", 528 EXPECT_EQ("chrome...0",
529 base::UTF16ToASCII(std::get<1>(params).assisted_query_stats)); 529 base::UTF16ToASCII(std::get<1>(params).assisted_query_stats));
530 } 530 }
531 #endif 531 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698