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

Side by Side Diff: chrome/browser/search_engines/template_url_service_util_unittest.cc

Issue 338363004: Remove Profile* from TemplateURL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 6 years, 6 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 | Annotate | Revision Log
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 "base/memory/scoped_vector.h" 5 #include "base/memory/scoped_vector.h"
6 #include "base/strings/string_util.h" 6 #include "base/strings/string_util.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/search_engines/template_url.h" 8 #include "chrome/browser/search_engines/template_url.h"
9 #include "chrome/browser/search_engines/template_url_service.h" 9 #include "chrome/browser/search_engines/template_url_service.h"
10 #include "chrome/browser/search_engines/util.h" 10 #include "chrome/browser/search_engines/util.h"
(...skipping 13 matching lines...) Expand all
24 return data.Pass(); 24 return data.Pass();
25 } 25 }
26 26
27 // Creates a TemplateURL with default values except for the prepopulate ID, 27 // Creates a TemplateURL with default values except for the prepopulate ID,
28 // keyword and TemplateURLID. Only use this in tests if your tests do not 28 // keyword and TemplateURLID. Only use this in tests if your tests do not
29 // care about other fields. 29 // care about other fields.
30 scoped_ptr<TemplateURL> CreatePrepopulateTemplateURL(int prepopulate_id, 30 scoped_ptr<TemplateURL> CreatePrepopulateTemplateURL(int prepopulate_id,
31 const std::string& keyword, 31 const std::string& keyword,
32 TemplateURLID id) { 32 TemplateURLID id) {
33 return make_scoped_ptr(new TemplateURL( 33 return make_scoped_ptr(new TemplateURL(
34 NULL, *CreatePrepopulateTemplateURLData(prepopulate_id, keyword, id))); 34 *CreatePrepopulateTemplateURLData(prepopulate_id, keyword, id)));
35 } 35 }
36 36
37 }; // namespace 37 }; // namespace
38 38
39 TEST(TemplateURLServiceUtilTest, RemoveDuplicatePrepopulateIDs) { 39 TEST(TemplateURLServiceUtilTest, RemoveDuplicatePrepopulateIDs) {
40 ScopedVector<TemplateURLData> prepopulated_turls; 40 ScopedVector<TemplateURLData> prepopulated_turls;
41 TemplateURLService::TemplateURLVector local_turls; 41 TemplateURLService::TemplateURLVector local_turls;
42 STLElementDeleter<TemplateURLService::TemplateURLVector> local_turls_deleter( 42 STLElementDeleter<TemplateURLService::TemplateURLVector> local_turls_deleter(
43 &local_turls); 43 &local_turls);
44 44
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 // Verify that the expected local TURLs survived the process. 93 // Verify that the expected local TURLs survived the process.
94 EXPECT_EQ(local_turls.size(), 94 EXPECT_EQ(local_turls.size(),
95 prepopulated_turls.size() + num_non_prepopulated_urls); 95 prepopulated_turls.size() + num_non_prepopulated_urls);
96 for (TemplateURLService::TemplateURLVector::const_iterator itr = 96 for (TemplateURLService::TemplateURLVector::const_iterator itr =
97 local_turls.begin(); itr != local_turls.end(); ++itr) { 97 local_turls.begin(); itr != local_turls.end(); ++itr) {
98 EXPECT_TRUE( 98 EXPECT_TRUE(
99 StartsWith((*itr)->keyword(), base::ASCIIToUTF16("winner"), true)); 99 StartsWith((*itr)->keyword(), base::ASCIIToUTF16("winner"), true));
100 } 100 }
101 } 101 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url_service_unittest.cc ('k') | chrome/browser/search_engines/template_url_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698