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/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 ASSERT_TRUE(test_util()->profile()->CreateHistoryService(true, false)); | 975 ASSERT_TRUE(test_util()->profile()->CreateHistoryService(true, false)); |
976 test_util()->ResetModel(true); | 976 test_util()->ResetModel(true); |
977 | 977 |
978 // Create a keyword. | 978 // Create a keyword. |
979 TemplateURL* t_url = AddKeywordWithDate( | 979 TemplateURL* t_url = AddKeywordWithDate( |
980 "keyword", "keyword", "http://foo.com/foo?query={searchTerms}", | 980 "keyword", "keyword", "http://foo.com/foo?query={searchTerms}", |
981 "http://sugg1", std::string(), "http://icon1", true, "UTF-8;UTF-16", | 981 "http://sugg1", std::string(), "http://icon1", true, "UTF-8;UTF-16", |
982 base::Time::Now(), base::Time::Now()); | 982 base::Time::Now(), base::Time::Now()); |
983 | 983 |
984 // Add a visit that matches the url of the keyword. | 984 // Add a visit that matches the url of the keyword. |
985 HistoryService* history = | 985 HistoryService* history = HistoryServiceFactory::GetForProfile( |
986 HistoryServiceFactory::GetForProfile(test_util()->profile(), | 986 test_util()->profile(), ServiceAccessType::EXPLICIT_ACCESS); |
987 Profile::EXPLICIT_ACCESS); | |
988 history->AddPage( | 987 history->AddPage( |
989 GURL(t_url->url_ref().ReplaceSearchTerms( | 988 GURL(t_url->url_ref().ReplaceSearchTerms( |
990 TemplateURLRef::SearchTermsArgs(ASCIIToUTF16("blah")), | 989 TemplateURLRef::SearchTermsArgs(ASCIIToUTF16("blah")), |
991 search_terms_data())), | 990 search_terms_data())), |
992 base::Time::Now(), NULL, 0, GURL(), history::RedirectList(), | 991 base::Time::Now(), NULL, 0, GURL(), history::RedirectList(), |
993 ui::PAGE_TRANSITION_KEYWORD, history::SOURCE_BROWSED, false); | 992 ui::PAGE_TRANSITION_KEYWORD, history::SOURCE_BROWSED, false); |
994 | 993 |
995 // Wait for history to finish processing the request. | 994 // Wait for history to finish processing the request. |
996 test_util()->profile()->BlockUntilHistoryProcessesPendingRequests(); | 995 test_util()->profile()->BlockUntilHistoryProcessesPendingRequests(); |
997 | 996 |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1479 scoped_ptr<TemplateURL::AssociatedExtensionInfo> extension_info( | 1478 scoped_ptr<TemplateURL::AssociatedExtensionInfo> extension_info( |
1480 new TemplateURL::AssociatedExtensionInfo( | 1479 new TemplateURL::AssociatedExtensionInfo( |
1481 TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION, "ext1")); | 1480 TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION, "ext1")); |
1482 extension_info->wants_to_be_default_engine = true; | 1481 extension_info->wants_to_be_default_engine = true; |
1483 model()->AddExtensionControlledTURL(ext_dse, extension_info.Pass()); | 1482 model()->AddExtensionControlledTURL(ext_dse, extension_info.Pass()); |
1484 EXPECT_EQ(ext_dse, model()->GetTemplateURLForKeyword(ASCIIToUTF16("ext1"))); | 1483 EXPECT_EQ(ext_dse, model()->GetTemplateURLForKeyword(ASCIIToUTF16("ext1"))); |
1485 EXPECT_TRUE(model()->is_default_search_managed()); | 1484 EXPECT_TRUE(model()->is_default_search_managed()); |
1486 actual_managed_default = model()->GetDefaultSearchProvider(); | 1485 actual_managed_default = model()->GetDefaultSearchProvider(); |
1487 ExpectSimilar(expected_managed_default.get(), actual_managed_default); | 1486 ExpectSimilar(expected_managed_default.get(), actual_managed_default); |
1488 } | 1487 } |
OLD | NEW |