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

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

Issue 9968016: Move the URL string from TemplateURLRef onto the owning TemplateURL. This will make it easier to m… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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/file_util.h" 5 #include "base/file_util.h"
6 #include "base/memory/scoped_vector.h" 6 #include "base/memory/scoped_vector.h"
7 #include "base/scoped_temp_dir.h" 7 #include "base/scoped_temp_dir.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/search_engines/search_terms_data.h" 9 #include "chrome/browser/search_engines/search_terms_data.h"
10 #include "chrome/browser/search_engines/template_url.h" 10 #include "chrome/browser/search_engines/template_url.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 EXPECT_EQ(1, version); 113 EXPECT_EQ(1, version);
114 114
115 ScopedVector<TemplateURL> t_urls; 115 ScopedVector<TemplateURL> t_urls;
116 size_t default_index; 116 size_t default_index;
117 TemplateURLPrepopulateData::GetPrepopulatedEngines(prefs, &t_urls.get(), 117 TemplateURLPrepopulateData::GetPrepopulatedEngines(prefs, &t_urls.get(),
118 &default_index); 118 &default_index);
119 119
120 ASSERT_EQ(1u, t_urls.size()); 120 ASSERT_EQ(1u, t_urls.size());
121 EXPECT_EQ(ASCIIToUTF16("foo"), t_urls[0]->short_name()); 121 EXPECT_EQ(ASCIIToUTF16("foo"), t_urls[0]->short_name());
122 EXPECT_EQ(ASCIIToUTF16("fook"), t_urls[0]->keyword()); 122 EXPECT_EQ(ASCIIToUTF16("fook"), t_urls[0]->keyword());
123 EXPECT_EQ("foo.com", t_urls[0]->url()->GetHost()); 123 EXPECT_EQ("foo.com", t_urls[0]->url_ref().GetHost());
124 EXPECT_EQ("foi.com", t_urls[0]->favicon_url().host()); 124 EXPECT_EQ("foi.com", t_urls[0]->favicon_url().host());
125 EXPECT_EQ(1u, t_urls[0]->input_encodings().size()); 125 EXPECT_EQ(1u, t_urls[0]->input_encodings().size());
126 EXPECT_EQ(1001, t_urls[0]->prepopulate_id()); 126 EXPECT_EQ(1001, t_urls[0]->prepopulate_id());
127 } 127 }
128 128
129 TEST(TemplateURLPrepopulateDataTest, GetEngineName) { 129 TEST(TemplateURLPrepopulateDataTest, GetEngineName) {
130 EXPECT_EQ(ASCIIToUTF16("Atlas"), 130 EXPECT_EQ(ASCIIToUTF16("Atlas"),
131 TemplateURLPrepopulateData::GetEngineName("http://search.atlas.cz/")); 131 TemplateURLPrepopulateData::GetEngineName("http://search.atlas.cz/"));
132 EXPECT_EQ(ASCIIToUTF16("Google"), 132 EXPECT_EQ(ASCIIToUTF16("Google"),
133 TemplateURLPrepopulateData::GetEngineName("http://www.google.com/")); 133 TemplateURLPrepopulateData::GetEngineName("http://www.google.com/"));
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 EXPECT_EQ(SEARCH_ENGINE_YAHOO, 181 EXPECT_EQ(SEARCH_ENGINE_YAHOO,
182 TemplateURLPrepopulateData::GetEngineType(kYahooURLs[i])); 182 TemplateURLPrepopulateData::GetEngineType(kYahooURLs[i]));
183 } 183 }
184 // Search URL for which no prepopulated search provider exists. 184 // Search URL for which no prepopulated search provider exists.
185 std::string kExampleSearchURL = "http://example.net/search?q={searchTerms}"; 185 std::string kExampleSearchURL = "http://example.net/search?q={searchTerms}";
186 EXPECT_EQ(SEARCH_ENGINE_OTHER, 186 EXPECT_EQ(SEARCH_ENGINE_OTHER,
187 TemplateURLPrepopulateData::GetEngineType(kExampleSearchURL)); 187 TemplateURLPrepopulateData::GetEngineType(kExampleSearchURL));
188 EXPECT_EQ(SEARCH_ENGINE_OTHER, 188 EXPECT_EQ(SEARCH_ENGINE_OTHER,
189 TemplateURLPrepopulateData::GetEngineType("invalid:search:url")); 189 TemplateURLPrepopulateData::GetEngineType("invalid:search:url"));
190 } 190 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url_parser_unittest.cc ('k') | chrome/browser/search_engines/template_url_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698