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

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

Issue 19616004: Add asserts to TestingProfile::CreateHistoryService to ensure files are deleted (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix release unit tests Created 7 years, 5 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 ASSERT_EQ(t_url, model()->GetTemplateURLForHost("google.fr")); 1141 ASSERT_EQ(t_url, model()->GetTemplateURLForHost("google.fr"));
1142 EXPECT_TRUE(model()->GetTemplateURLForHost("google.co.uk") == NULL); 1142 EXPECT_TRUE(model()->GetTemplateURLForHost("google.co.uk") == NULL);
1143 EXPECT_EQ("google.fr", t_url->url_ref().GetHost()); 1143 EXPECT_EQ("google.fr", t_url->url_ref().GetHost());
1144 EXPECT_EQ(ASCIIToUTF16("google.fr"), t_url->keyword()); 1144 EXPECT_EQ(ASCIIToUTF16("google.fr"), t_url->keyword());
1145 } 1145 }
1146 1146
1147 // Make sure TemplateURLService generates a KEYWORD_GENERATED visit for 1147 // Make sure TemplateURLService generates a KEYWORD_GENERATED visit for
1148 // KEYWORD visits. 1148 // KEYWORD visits.
1149 TEST_F(TemplateURLServiceTest, GenerateVisitOnKeyword) { 1149 TEST_F(TemplateURLServiceTest, GenerateVisitOnKeyword) {
1150 test_util_.VerifyLoad(); 1150 test_util_.VerifyLoad();
1151 test_util_.profile()->CreateHistoryService(true, false); 1151 ASSERT_TRUE(test_util_.profile()->CreateHistoryService(true, false));
1152 1152
1153 // Create a keyword. 1153 // Create a keyword.
1154 TemplateURL* t_url = AddKeywordWithDate( 1154 TemplateURL* t_url = AddKeywordWithDate(
1155 "keyword", "keyword", "http://foo.com/foo?query={searchTerms}", 1155 "keyword", "keyword", "http://foo.com/foo?query={searchTerms}",
1156 "http://sugg1", std::string(), "http://icon1", true, "UTF-8;UTF-16", 1156 "http://sugg1", std::string(), "http://icon1", true, "UTF-8;UTF-16",
1157 base::Time::Now(), base::Time::Now()); 1157 base::Time::Now(), base::Time::Now());
1158 1158
1159 // Add a visit that matches the url of the keyword. 1159 // Add a visit that matches the url of the keyword.
1160 HistoryService* history = 1160 HistoryService* history =
1161 HistoryServiceFactory::GetForProfile(test_util_.profile(), 1161 HistoryServiceFactory::GetForProfile(test_util_.profile(),
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
1609 EXPECT_EQ(8U, loaded_url->input_encodings().size()); 1609 EXPECT_EQ(8U, loaded_url->input_encodings().size());
1610 1610
1611 // Reload the model to verify it was actually saved to the database and the 1611 // Reload the model to verify it was actually saved to the database and the
1612 // duplicate encodings were removed. 1612 // duplicate encodings were removed.
1613 test_util_.ResetModel(true); 1613 test_util_.ResetModel(true);
1614 ASSERT_EQ(initial_count + 1, model()->GetTemplateURLs().size()); 1614 ASSERT_EQ(initial_count + 1, model()->GetTemplateURLs().size());
1615 loaded_url = model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword")); 1615 loaded_url = model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword"));
1616 ASSERT_FALSE(loaded_url == NULL); 1616 ASSERT_FALSE(loaded_url == NULL);
1617 EXPECT_EQ(4U, loaded_url->input_encodings().size()); 1617 EXPECT_EQ(4U, loaded_url->input_encodings().size());
1618 } 1618 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698