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

Side by Side Diff: components/omnibox/browser/scored_history_match_unittest.cc

Issue 2252343002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 (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 "components/omnibox/browser/scored_history_match.h" 5 #include "components/omnibox/browser/scored_history_match.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 // Now allow credit for the match in the scheme. 265 // Now allow credit for the match in the scheme.
266 base::AutoReset<bool> reset(&ScoredHistoryMatch::allow_scheme_matches_, true); 266 base::AutoReset<bool> reset(&ScoredHistoryMatch::allow_scheme_matches_, true);
267 ScoredHistoryMatch scored_with_scheme(row, visits, ASCIIToUTF16("fed http"), 267 ScoredHistoryMatch scored_with_scheme(row, visits, ASCIIToUTF16("fed http"),
268 Make2Terms("fed", "http"), two_words_no_offsets, word_starts, false, 268 Make2Terms("fed", "http"), two_words_no_offsets, word_starts, false,
269 nullptr, now); 269 nullptr, now);
270 EXPECT_GT(scored_with_scheme.raw_score, 0); 270 EXPECT_GT(scored_with_scheme.raw_score, 0);
271 } 271 }
272 272
273 TEST_F(ScoredHistoryMatchTest, CullSearchResults) { 273 TEST_F(ScoredHistoryMatchTest, CullSearchResults) {
274 std::unique_ptr<TemplateURLService> template_url_service = 274 std::unique_ptr<TemplateURLService> template_url_service =
275 base::WrapUnique(new TemplateURLService( 275 base::MakeUnique<TemplateURLService>(
276 nullptr, base::WrapUnique(new SearchTermsData), nullptr, 276 nullptr, base::WrapUnique(new SearchTermsData), nullptr,
277 std::unique_ptr<TemplateURLServiceClient>(), nullptr, nullptr, 277 std::unique_ptr<TemplateURLServiceClient>(), nullptr, nullptr,
278 base::Closure())); 278 base::Closure());
279 279
280 // We use NowFromSystemTime() because MakeURLRow uses the same function 280 // We use NowFromSystemTime() because MakeURLRow uses the same function
281 // to calculate last visit time when building a row. 281 // to calculate last visit time when building a row.
282 base::Time now = base::Time::NowFromSystemTime(); 282 base::Time now = base::Time::NowFromSystemTime();
283 283
284 // Pretend we've visited a search engine query URL, but that it's not 284 // Pretend we've visited a search engine query URL, but that it's not
285 // associated with the default search engine. 285 // associated with the default search engine.
286 history::URLRow row(MakeURLRow( 286 history::URLRow row(MakeURLRow(
287 "http://testsearch.com/thequery", "Test Search Engine", 3, 30, 1)); 287 "http://testsearch.com/thequery", "Test Search Engine", 3, 30, 1));
288 RowWordStarts word_starts; 288 RowWordStarts word_starts;
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 654
655 EXPECT_TRUE( 655 EXPECT_TRUE(
656 ScoredHistoryMatch::GetHQPBucketsFromString(buckets_str, &hqp_buckets)); 656 ScoredHistoryMatch::GetHQPBucketsFromString(buckets_str, &hqp_buckets));
657 EXPECT_THAT(hqp_buckets, ElementsAre(Pair(0.0, 400), Pair(1.5, 600), 657 EXPECT_THAT(hqp_buckets, ElementsAre(Pair(0.0, 400), Pair(1.5, 600),
658 Pair(12.0, 1300), Pair(20.0, 1399))); 658 Pair(12.0, 1300), Pair(20.0, 1399)));
659 // invalid string. 659 // invalid string.
660 buckets_str = "0.0,400,1.5,600"; 660 buckets_str = "0.0,400,1.5,600";
661 EXPECT_FALSE( 661 EXPECT_FALSE(
662 ScoredHistoryMatch::GetHQPBucketsFromString(buckets_str, &hqp_buckets)); 662 ScoredHistoryMatch::GetHQPBucketsFromString(buckets_str, &hqp_buckets));
663 } 663 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/omnibox_edit_unittest.cc ('k') | components/omnibox/browser/shortcuts_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698