| 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 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1098 ASSERT_EQ(t_url, model()->GetTemplateURLForHost("google.fr")); | 1098 ASSERT_EQ(t_url, model()->GetTemplateURLForHost("google.fr")); |
| 1099 EXPECT_TRUE(model()->GetTemplateURLForHost("google.co.uk") == NULL); | 1099 EXPECT_TRUE(model()->GetTemplateURLForHost("google.co.uk") == NULL); |
| 1100 EXPECT_EQ("google.fr", t_url->url_ref().GetHost()); | 1100 EXPECT_EQ("google.fr", t_url->url_ref().GetHost()); |
| 1101 EXPECT_EQ(ASCIIToUTF16("google.fr"), t_url->keyword()); | 1101 EXPECT_EQ(ASCIIToUTF16("google.fr"), t_url->keyword()); |
| 1102 } | 1102 } |
| 1103 | 1103 |
| 1104 // Make sure TemplateURLService generates a KEYWORD_GENERATED visit for | 1104 // Make sure TemplateURLService generates a KEYWORD_GENERATED visit for |
| 1105 // KEYWORD visits. | 1105 // KEYWORD visits. |
| 1106 TEST_F(TemplateURLServiceTest, GenerateVisitOnKeyword) { | 1106 TEST_F(TemplateURLServiceTest, GenerateVisitOnKeyword) { |
| 1107 test_util_.VerifyLoad(); | 1107 test_util_.VerifyLoad(); |
| 1108 test_util_.profile()->CreateHistoryService(true, false); | 1108 ASSERT_TRUE(test_util_.profile()->CreateHistoryService(true, false)); |
| 1109 | 1109 |
| 1110 // Create a keyword. | 1110 // Create a keyword. |
| 1111 TemplateURL* t_url = AddKeywordWithDate( | 1111 TemplateURL* t_url = AddKeywordWithDate( |
| 1112 "keyword", "keyword", "http://foo.com/foo?query={searchTerms}", | 1112 "keyword", "keyword", "http://foo.com/foo?query={searchTerms}", |
| 1113 "http://sugg1", std::string(), "http://icon1", true, "UTF-8;UTF-16", | 1113 "http://sugg1", std::string(), "http://icon1", true, "UTF-8;UTF-16", |
| 1114 base::Time::Now(), base::Time::Now()); | 1114 base::Time::Now(), base::Time::Now()); |
| 1115 | 1115 |
| 1116 // Add a visit that matches the url of the keyword. | 1116 // Add a visit that matches the url of the keyword. |
| 1117 HistoryService* history = | 1117 HistoryService* history = |
| 1118 HistoryServiceFactory::GetForProfile(test_util_.profile(), | 1118 HistoryServiceFactory::GetForProfile(test_util_.profile(), |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 EXPECT_EQ(8U, loaded_url->input_encodings().size()); | 1566 EXPECT_EQ(8U, loaded_url->input_encodings().size()); |
| 1567 | 1567 |
| 1568 // Reload the model to verify it was actually saved to the database and the | 1568 // Reload the model to verify it was actually saved to the database and the |
| 1569 // duplicate encodings were removed. | 1569 // duplicate encodings were removed. |
| 1570 test_util_.ResetModel(true); | 1570 test_util_.ResetModel(true); |
| 1571 ASSERT_EQ(initial_count + 1, model()->GetTemplateURLs().size()); | 1571 ASSERT_EQ(initial_count + 1, model()->GetTemplateURLs().size()); |
| 1572 loaded_url = model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword")); | 1572 loaded_url = model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword")); |
| 1573 ASSERT_FALSE(loaded_url == NULL); | 1573 ASSERT_FALSE(loaded_url == NULL); |
| 1574 EXPECT_EQ(4U, loaded_url->input_encodings().size()); | 1574 EXPECT_EQ(4U, loaded_url->input_encodings().size()); |
| 1575 } | 1575 } |
| OLD | NEW |