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

Side by Side Diff: components/omnibox/browser/shortcuts_backend_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 (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 TemplateURL* template_url =
108 // Takes ownership of |template_url|. 108 template_url_service_->Add(base::MakeUnique<TemplateURL>(data));
109 template_url_service_->Add(template_url);
110 template_url_service_->SetUserSelectedDefaultSearchProvider(template_url); 109 template_url_service_->SetUserSelectedDefaultSearchProvider(template_url);
111 } 110 }
112 111
113 void ShortcutsBackendTest::SetUp() { 112 void ShortcutsBackendTest::SetUp() {
114 template_url_service_.reset(new TemplateURLService(nullptr, 0)); 113 template_url_service_.reset(new TemplateURLService(nullptr, 0));
115 if (profile_dir_.CreateUniqueTempDir()) 114 if (profile_dir_.CreateUniqueTempDir())
116 history_service_ = history::CreateHistoryService(profile_dir_.path(), true); 115 history_service_ = history::CreateHistoryService(profile_dir_.path(), true);
117 ASSERT_TRUE(history_service_); 116 ASSERT_TRUE(history_service_);
118 117
119 db_thread_.Start(); 118 db_thread_.Start();
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 ASSERT_TRUE(shortcut4_iter != shortcuts_map().end()); 315 ASSERT_TRUE(shortcut4_iter != shortcuts_map().end());
317 EXPECT_EQ(shortcut4.id, shortcut4_iter->second.id); 316 EXPECT_EQ(shortcut4.id, shortcut4_iter->second.id);
318 317
319 ShortcutsDatabase::ShortcutIDs deleted_ids; 318 ShortcutsDatabase::ShortcutIDs deleted_ids;
320 deleted_ids.push_back(shortcut3.id); 319 deleted_ids.push_back(shortcut3.id);
321 deleted_ids.push_back(shortcut4.id); 320 deleted_ids.push_back(shortcut4.id);
322 EXPECT_TRUE(DeleteShortcutsWithIDs(deleted_ids)); 321 EXPECT_TRUE(DeleteShortcutsWithIDs(deleted_ids));
323 322
324 ASSERT_EQ(0U, shortcuts_map().size()); 323 ASSERT_EQ(0U, shortcuts_map().size());
325 } 324 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698