OLD | NEW |
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/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 ASSERT_EQ(t_url, model()->GetTemplateURLForHost("google.fr")); | 1187 ASSERT_EQ(t_url, model()->GetTemplateURLForHost("google.fr")); |
1188 EXPECT_TRUE(model()->GetTemplateURLForHost("google.co.uk") == NULL); | 1188 EXPECT_TRUE(model()->GetTemplateURLForHost("google.co.uk") == NULL); |
1189 EXPECT_EQ("google.fr", t_url->url_ref().GetHost()); | 1189 EXPECT_EQ("google.fr", t_url->url_ref().GetHost()); |
1190 EXPECT_EQ(ASCIIToUTF16("google.fr"), t_url->keyword()); | 1190 EXPECT_EQ(ASCIIToUTF16("google.fr"), t_url->keyword()); |
1191 } | 1191 } |
1192 | 1192 |
1193 // Make sure TemplateURLService generates a KEYWORD_GENERATED visit for | 1193 // Make sure TemplateURLService generates a KEYWORD_GENERATED visit for |
1194 // KEYWORD visits. | 1194 // KEYWORD visits. |
1195 TEST_F(TemplateURLServiceTest, GenerateVisitOnKeyword) { | 1195 TEST_F(TemplateURLServiceTest, GenerateVisitOnKeyword) { |
1196 test_util_.VerifyLoad(); | 1196 test_util_.VerifyLoad(); |
1197 ASSERT_TRUE(test_util_.profile()->CreateHistoryService(true, false)); | 1197 test_util_.profile()->CreateHistoryService(true, false); |
1198 | 1198 |
1199 // Create a keyword. | 1199 // Create a keyword. |
1200 TemplateURL* t_url = AddKeywordWithDate( | 1200 TemplateURL* t_url = AddKeywordWithDate( |
1201 "keyword", "keyword", "http://foo.com/foo?query={searchTerms}", | 1201 "keyword", "keyword", "http://foo.com/foo?query={searchTerms}", |
1202 "http://sugg1", std::string(), "http://icon1", true, "UTF-8;UTF-16", | 1202 "http://sugg1", std::string(), "http://icon1", true, "UTF-8;UTF-16", |
1203 base::Time::Now(), base::Time::Now()); | 1203 base::Time::Now(), base::Time::Now()); |
1204 | 1204 |
1205 // Add a visit that matches the url of the keyword. | 1205 // Add a visit that matches the url of the keyword. |
1206 HistoryService* history = | 1206 HistoryService* history = |
1207 HistoryServiceFactory::GetForProfile(test_util_.profile(), | 1207 HistoryServiceFactory::GetForProfile(test_util_.profile(), |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1655 EXPECT_EQ(8U, loaded_url->input_encodings().size()); | 1655 EXPECT_EQ(8U, loaded_url->input_encodings().size()); |
1656 | 1656 |
1657 // Reload the model to verify it was actually saved to the database and the | 1657 // Reload the model to verify it was actually saved to the database and the |
1658 // duplicate encodings were removed. | 1658 // duplicate encodings were removed. |
1659 test_util_.ResetModel(true); | 1659 test_util_.ResetModel(true); |
1660 ASSERT_EQ(initial_count + 1, model()->GetTemplateURLs().size()); | 1660 ASSERT_EQ(initial_count + 1, model()->GetTemplateURLs().size()); |
1661 loaded_url = model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword")); | 1661 loaded_url = model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword")); |
1662 ASSERT_FALSE(loaded_url == NULL); | 1662 ASSERT_FALSE(loaded_url == NULL); |
1663 EXPECT_EQ(4U, loaded_url->input_encodings().size()); | 1663 EXPECT_EQ(4U, loaded_url->input_encodings().size()); |
1664 } | 1664 } |
OLD | NEW |