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/string_split.h" | 10 #include "base/string_split.h" |
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 test_util_.profile()->CreateHistoryService(true, false); | 1054 test_util_.profile()->CreateHistoryService(true, false); |
1055 | 1055 |
1056 // Create a keyword. | 1056 // Create a keyword. |
1057 TemplateURL* t_url = AddKeywordWithDate("keyword", "keyword", | 1057 TemplateURL* t_url = AddKeywordWithDate("keyword", "keyword", |
1058 "http://foo.com/foo?query={searchTerms}", "http://sugg1", "http://icon1", | 1058 "http://foo.com/foo?query={searchTerms}", "http://sugg1", "http://icon1", |
1059 true, "UTF-8;UTF-16", base::Time::Now(), base::Time::Now()); | 1059 true, "UTF-8;UTF-16", base::Time::Now(), base::Time::Now()); |
1060 | 1060 |
1061 // Add a visit that matches the url of the keyword. | 1061 // Add a visit that matches the url of the keyword. |
1062 HistoryService* history = | 1062 HistoryService* history = |
1063 HistoryServiceFactory::GetForProfile(test_util_.profile(), | 1063 HistoryServiceFactory::GetForProfile(test_util_.profile(), |
1064 Profile::EXPLICIT_ACCESS); | 1064 Profile::EXPLICIT_ACCESS).get(); |
1065 history->AddPage( | 1065 history->AddPage( |
1066 GURL(t_url->url_ref().ReplaceSearchTerms( | 1066 GURL(t_url->url_ref().ReplaceSearchTerms( |
1067 TemplateURLRef::SearchTermsArgs(ASCIIToUTF16("blah")))), | 1067 TemplateURLRef::SearchTermsArgs(ASCIIToUTF16("blah")))), |
1068 base::Time::Now(), NULL, 0, GURL(), history::RedirectList(), | 1068 base::Time::Now(), NULL, 0, GURL(), history::RedirectList(), |
1069 content::PAGE_TRANSITION_KEYWORD, history::SOURCE_BROWSED, false); | 1069 content::PAGE_TRANSITION_KEYWORD, history::SOURCE_BROWSED, false); |
1070 | 1070 |
1071 // Wait for history to finish processing the request. | 1071 // Wait for history to finish processing the request. |
1072 test_util_.profile()->BlockUntilHistoryProcessesPendingRequests(); | 1072 test_util_.profile()->BlockUntilHistoryProcessesPendingRequests(); |
1073 | 1073 |
1074 // Query history for the generated url. | 1074 // Query history for the generated url. |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 EXPECT_EQ(8U, loaded_url->input_encodings().size()); | 1503 EXPECT_EQ(8U, loaded_url->input_encodings().size()); |
1504 | 1504 |
1505 // Reload the model to verify it was actually saved to the database and the | 1505 // Reload the model to verify it was actually saved to the database and the |
1506 // duplicate encodings were removed. | 1506 // duplicate encodings were removed. |
1507 test_util_.ResetModel(true); | 1507 test_util_.ResetModel(true); |
1508 ASSERT_EQ(initial_count + 1, model()->GetTemplateURLs().size()); | 1508 ASSERT_EQ(initial_count + 1, model()->GetTemplateURLs().size()); |
1509 loaded_url = model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword")); | 1509 loaded_url = model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword")); |
1510 ASSERT_FALSE(loaded_url == NULL); | 1510 ASSERT_FALSE(loaded_url == NULL); |
1511 EXPECT_EQ(4U, loaded_url->input_encodings().size()); | 1511 EXPECT_EQ(4U, loaded_url->input_encodings().size()); |
1512 } | 1512 } |
OLD | NEW |