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

Unified Diff: chrome/browser/search_engines/search_host_to_urls_map_unittest.cc

Issue 10021008: Reland r131019: Move most TemplateURL data members to a new struct, TemplateURLData. This allows us… (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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search_engines/search_host_to_urls_map_unittest.cc
===================================================================
--- chrome/browser/search_engines/search_host_to_urls_map_unittest.cc (revision 131175)
+++ chrome/browser/search_engines/search_host_to_urls_map_unittest.cc (working copy)
@@ -29,11 +29,11 @@
void SearchHostToURLsMapTest::SetUp() {
// Add some entries to the search host map.
host_ = "www.unittest.com";
- t_urls_[0].reset(new TemplateURL());
- t_urls_[0]->SetURL("http://" + host_ + "/path1");
- t_urls_[1].reset(new TemplateURL());
- t_urls_[1]->SetURL("http://" + host_ + "/path2");
-
+ TemplateURLData data;
+ data.SetURL("http://" + host_ + "/path1");
+ t_urls_[0].reset(new TemplateURL(data));
+ data.SetURL("http://" + host_ + "/path2");
+ t_urls_[1].reset(new TemplateURL(data));
std::vector<const TemplateURL*> template_urls;
template_urls.push_back(t_urls_[0].get());
template_urls.push_back(t_urls_[1].get());
@@ -45,8 +45,9 @@
TEST_F(SearchHostToURLsMapTest, Add) {
std::string new_host = "example.com";
- TemplateURL new_t_url;
- new_t_url.SetURL("http://" + new_host + "/");
+ TemplateURLData data;
+ data.SetURL("http://" + new_host + "/");
+ TemplateURL new_t_url(data);
UIThreadSearchTermsData search_terms_data;
provider_map_->Add(&new_t_url, search_terms_data);
@@ -70,18 +71,6 @@
ASSERT_EQ(1, url_count);
}
-TEST_F(SearchHostToURLsMapTest, Update) {
- std::string new_host = "example.com";
- TemplateURL new_values;
- new_values.SetURL("http://" + new_host + "/");
-
- UIThreadSearchTermsData search_terms_data;
- provider_map_->Update(t_urls_[0].get(), new_values, search_terms_data);
-
- ASSERT_EQ(t_urls_[0].get(), provider_map_->GetTemplateURLForHost(new_host));
- ASSERT_EQ(t_urls_[1].get(), provider_map_->GetTemplateURLForHost(host_));
-}
-
TEST_F(SearchHostToURLsMapTest, UpdateGoogleBaseURLs) {
UIThreadSearchTermsData search_terms_data;
std::string google_base_url = "google.com";
@@ -89,8 +78,9 @@
new std::string("http://" + google_base_url +"/"));
// Add in a url with the templated Google base url.
- TemplateURL new_t_url;
- new_t_url.SetURL("{google:baseURL}?q={searchTerms}");
+ TemplateURLData data;
+ data.SetURL("{google:baseURL}?q={searchTerms}");
+ TemplateURL new_t_url(data);
provider_map_->Add(&new_t_url, search_terms_data);
ASSERT_EQ(&new_t_url, provider_map_->GetTemplateURLForHost(google_base_url));

Powered by Google App Engine
This is Rietveld 408576698