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

Side by Side Diff: components/search_engines/template_url_service_unittest.cc

Issue 631253002: Refactor sending NOTIFICATION_HISTORY_URL_VISITED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests on Android Created 6 years, 2 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
« no previous file with comments | « components/history/core/browser/history_service_observer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 ASSERT_EQ(t_url, model()->GetTemplateURLForHost("google.fr")); 974 ASSERT_EQ(t_url, model()->GetTemplateURLForHost("google.fr"));
975 EXPECT_TRUE(model()->GetTemplateURLForHost("google.co.uk") == NULL); 975 EXPECT_TRUE(model()->GetTemplateURLForHost("google.co.uk") == NULL);
976 EXPECT_EQ("google.fr", t_url->url_ref().GetHost(search_terms_data())); 976 EXPECT_EQ("google.fr", t_url->url_ref().GetHost(search_terms_data()));
977 EXPECT_EQ(ASCIIToUTF16("google.fr"), t_url->keyword()); 977 EXPECT_EQ(ASCIIToUTF16("google.fr"), t_url->keyword());
978 } 978 }
979 979
980 // Make sure TemplateURLService generates a KEYWORD_GENERATED visit for 980 // Make sure TemplateURLService generates a KEYWORD_GENERATED visit for
981 // KEYWORD visits. 981 // KEYWORD visits.
982 TEST_F(TemplateURLServiceTest, GenerateVisitOnKeyword) { 982 TEST_F(TemplateURLServiceTest, GenerateVisitOnKeyword) {
983 test_util()->VerifyLoad(); 983 test_util()->VerifyLoad();
984 test_util()->profile()->CreateBookmarkModel(false);
984 ASSERT_TRUE(test_util()->profile()->CreateHistoryService(true, false)); 985 ASSERT_TRUE(test_util()->profile()->CreateHistoryService(true, false));
985 986
986 // Create a keyword. 987 // Create a keyword.
987 TemplateURL* t_url = AddKeywordWithDate( 988 TemplateURL* t_url = AddKeywordWithDate(
988 "keyword", "keyword", "http://foo.com/foo?query={searchTerms}", 989 "keyword", "keyword", "http://foo.com/foo?query={searchTerms}",
989 "http://sugg1", std::string(), "http://icon1", true, "UTF-8;UTF-16", 990 "http://sugg1", std::string(), "http://icon1", true, "UTF-8;UTF-16",
990 base::Time::Now(), base::Time::Now()); 991 base::Time::Now(), base::Time::Now());
991 992
992 // Add a visit that matches the url of the keyword. 993 // Add a visit that matches the url of the keyword.
993 HistoryService* history = 994 HistoryService* history =
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 scoped_ptr<TemplateURL::AssociatedExtensionInfo> extension_info( 1488 scoped_ptr<TemplateURL::AssociatedExtensionInfo> extension_info(
1488 new TemplateURL::AssociatedExtensionInfo( 1489 new TemplateURL::AssociatedExtensionInfo(
1489 TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION, "ext1")); 1490 TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION, "ext1"));
1490 extension_info->wants_to_be_default_engine = true; 1491 extension_info->wants_to_be_default_engine = true;
1491 model()->AddExtensionControlledTURL(ext_dse, extension_info.Pass()); 1492 model()->AddExtensionControlledTURL(ext_dse, extension_info.Pass());
1492 EXPECT_EQ(ext_dse, model()->GetTemplateURLForKeyword(ASCIIToUTF16("ext1"))); 1493 EXPECT_EQ(ext_dse, model()->GetTemplateURLForKeyword(ASCIIToUTF16("ext1")));
1493 EXPECT_TRUE(model()->is_default_search_managed()); 1494 EXPECT_TRUE(model()->is_default_search_managed());
1494 actual_managed_default = model()->GetDefaultSearchProvider(); 1495 actual_managed_default = model()->GetDefaultSearchProvider();
1495 ExpectSimilar(expected_managed_default.get(), actual_managed_default); 1496 ExpectSimilar(expected_managed_default.get(), actual_managed_default);
1496 } 1497 }
OLDNEW
« no previous file with comments | « components/history/core/browser/history_service_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698