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

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

Issue 2290503003: Remove use of stl_util in search_engines. (Closed)
Patch Set: ios for reals 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 (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/shortcuts_backend.h" 5 #include "components/omnibox/browser/shortcuts_backend.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 return ShortcutsBackend::MatchToMatchCore(match, template_url_service_.get(), 97 return ShortcutsBackend::MatchToMatchCore(match, template_url_service_.get(),
98 &search_terms_data); 98 &search_terms_data);
99 } 99 }
100 100
101 void ShortcutsBackendTest::SetSearchProvider() { 101 void ShortcutsBackendTest::SetSearchProvider() {
102 TemplateURLData data; 102 TemplateURLData data;
103 data.SetURL("http://foo.com/search?bar={searchTerms}"); 103 data.SetURL("http://foo.com/search?bar={searchTerms}");
104 data.SetShortName(base::UTF8ToUTF16("foo")); 104 data.SetShortName(base::UTF8ToUTF16("foo"));
105 data.SetKeyword(base::UTF8ToUTF16("foo")); 105 data.SetKeyword(base::UTF8ToUTF16("foo"));
106 106
107 TemplateURL* template_url = new TemplateURL(data); 107 std::unique_ptr<TemplateURL> template_url_ptr =
108 // Takes ownership of |template_url|. 108 base::MakeUnique<TemplateURL>(data);
109 template_url_service_->Add(template_url); 109 TemplateURL* template_url = template_url_ptr.get();
110 template_url_service_->Add(std::move(template_url_ptr));
Peter Kasting 2016/08/31 04:12:56 Nit: Just use the old code and add a WrapUnique()
Avi (use Gerrit) 2016/09/01 00:34:26 Done.
110 template_url_service_->SetUserSelectedDefaultSearchProvider(template_url); 111 template_url_service_->SetUserSelectedDefaultSearchProvider(template_url);
111 } 112 }
112 113
113 void ShortcutsBackendTest::SetUp() { 114 void ShortcutsBackendTest::SetUp() {
114 template_url_service_.reset(new TemplateURLService(nullptr, 0)); 115 template_url_service_.reset(new TemplateURLService(nullptr, 0));
115 if (profile_dir_.CreateUniqueTempDir()) 116 if (profile_dir_.CreateUniqueTempDir())
116 history_service_ = history::CreateHistoryService(profile_dir_.path(), true); 117 history_service_ = history::CreateHistoryService(profile_dir_.path(), true);
117 ASSERT_TRUE(history_service_); 118 ASSERT_TRUE(history_service_);
118 119
119 db_thread_.Start(); 120 db_thread_.Start();
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 ASSERT_TRUE(shortcut4_iter != shortcuts_map().end()); 317 ASSERT_TRUE(shortcut4_iter != shortcuts_map().end());
317 EXPECT_EQ(shortcut4.id, shortcut4_iter->second.id); 318 EXPECT_EQ(shortcut4.id, shortcut4_iter->second.id);
318 319
319 ShortcutsDatabase::ShortcutIDs deleted_ids; 320 ShortcutsDatabase::ShortcutIDs deleted_ids;
320 deleted_ids.push_back(shortcut3.id); 321 deleted_ids.push_back(shortcut3.id);
321 deleted_ids.push_back(shortcut4.id); 322 deleted_ids.push_back(shortcut4.id);
322 EXPECT_TRUE(DeleteShortcutsWithIDs(deleted_ids)); 323 EXPECT_TRUE(DeleteShortcutsWithIDs(deleted_ids));
323 324
324 ASSERT_EQ(0U, shortcuts_map().size()); 325 ASSERT_EQ(0U, shortcuts_map().size());
325 } 326 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698