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

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

Issue 120983002: Update some uses of UTF conversions in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace { 13 namespace {
14 14
15 // Creates a TemplateURL with default values except for the prepopulate ID, 15 // Creates a TemplateURL with default values except for the prepopulate ID,
16 // keyword and TemplateURLID. Only use this in tests if your tests do not 16 // keyword and TemplateURLID. Only use this in tests if your tests do not
17 // care about other fields. The caller is the owner of this TemplateURL. 17 // care about other fields. The caller is the owner of this TemplateURL.
18 TemplateURL* CreatePrepopulateTemplateURL(int prepopulate_id, 18 TemplateURL* CreatePrepopulateTemplateURL(int prepopulate_id,
19 const std::string& keyword, 19 const std::string& keyword,
20 TemplateURLID id) { 20 TemplateURLID id) {
21 TemplateURLData data; 21 TemplateURLData data;
22 data.prepopulate_id = prepopulate_id; 22 data.prepopulate_id = prepopulate_id;
23 data.SetKeyword(ASCIIToUTF16(keyword)); 23 data.SetKeyword(base::ASCIIToUTF16(keyword));
24 data.id = id; 24 data.id = id;
25 return new TemplateURL(NULL, data); 25 return new TemplateURL(NULL, data);
26 } 26 }
27 27
28 }; // namespace 28 }; // namespace
29 29
30 TEST(TemplateURLServiceUtilTest, RemoveDuplicatePrepopulateIDs) { 30 TEST(TemplateURLServiceUtilTest, RemoveDuplicatePrepopulateIDs) {
31 ScopedVector<TemplateURL> prepopulated_turls; 31 ScopedVector<TemplateURL> prepopulated_turls;
32 TemplateURLService::TemplateURLVector local_turls; 32 TemplateURLService::TemplateURLVector local_turls;
33 STLElementDeleter<TemplateURLService::TemplateURLVector> local_turls_deleter( 33 STLElementDeleter<TemplateURLService::TemplateURLVector> local_turls_deleter(
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 local_turls.push_back(CreatePrepopulateTemplateURL(3, "loser5", 14)); 66 local_turls.push_back(CreatePrepopulateTemplateURL(3, "loser5", 14));
67 local_turls.push_back(CreatePrepopulateTemplateURL(3, "loser6", 15)); 67 local_turls.push_back(CreatePrepopulateTemplateURL(3, "loser6", 15));
68 68
69 RemoveDuplicatePrepopulateIDs(NULL, prepopulated_turls, default_turl, 69 RemoveDuplicatePrepopulateIDs(NULL, prepopulated_turls, default_turl,
70 &local_turls, NULL); 70 &local_turls, NULL);
71 71
72 // Verify that the expected local TURLs survived the process. 72 // Verify that the expected local TURLs survived the process.
73 EXPECT_EQ(local_turls.size(), 73 EXPECT_EQ(local_turls.size(),
74 prepopulated_turls.size() + num_non_prepopulated_urls); 74 prepopulated_turls.size() + num_non_prepopulated_urls);
75 for (TemplateURLService::TemplateURLVector::const_iterator itr = 75 for (TemplateURLService::TemplateURLVector::const_iterator itr =
76 local_turls.begin(); itr != local_turls.end(); ++itr) 76 local_turls.begin(); itr != local_turls.end(); ++itr) {
77 EXPECT_TRUE(StartsWith((*itr)->keyword(), ASCIIToUTF16("winner"), true)); 77 EXPECT_TRUE(
78 StartsWith((*itr)->keyword(), base::ASCIIToUTF16("winner"), true));
79 }
78 } 80 }
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