OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/path_service.h" | 5 #include "base/path_service.h" |
6 #include "base/thread.h" | 6 #include "base/thread.h" |
7 #include "chrome/browser/webdata/web_database.h" | 7 #include "chrome/browser/webdata/web_database.h" |
8 #include "chrome/test/testing_profile.h" | 8 #include "chrome/test/testing_profile.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 | 648 |
649 bool success; | 649 bool success; |
650 history::URLRow row; | 650 history::URLRow row; |
651 history::VisitVector visits; | 651 history::VisitVector visits; |
652 }; | 652 }; |
653 | 653 |
654 // Make sure TemplateURLModel generates a KEYWORD_GENERATED visit for | 654 // Make sure TemplateURLModel generates a KEYWORD_GENERATED visit for |
655 // KEYWORD visits. | 655 // KEYWORD visits. |
656 TEST_F(TemplateURLModelTest, GenerateVisitOnKeyword) { | 656 TEST_F(TemplateURLModelTest, GenerateVisitOnKeyword) { |
657 VerifyLoad(); | 657 VerifyLoad(); |
658 profile_->CreateHistoryService(true); | 658 profile_->CreateHistoryService(true, false); |
659 | 659 |
660 // Create a keyword. | 660 // Create a keyword. |
661 TemplateURL* t_url = AddKeywordWithDate( | 661 TemplateURL* t_url = AddKeywordWithDate( |
662 L"keyword", false, L"http://foo.com/foo?query={searchTerms}", | 662 L"keyword", false, L"http://foo.com/foo?query={searchTerms}", |
663 L"keyword", true, base::Time::Now()); | 663 L"keyword", true, base::Time::Now()); |
664 | 664 |
665 // Add a visit that matches the url of the keyword. | 665 // Add a visit that matches the url of the keyword. |
666 HistoryService* history = | 666 HistoryService* history = |
667 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); | 667 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); |
668 history->AddPage( | 668 history->AddPage( |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 model_->Add(t_url3); | 731 model_->Add(t_url3); |
732 ASSERT_EQ(t_url3, model_->GetTemplateURLForKeyword(L"unittest")); | 732 ASSERT_EQ(t_url3, model_->GetTemplateURLForKeyword(L"unittest")); |
733 model_->SetDefaultSearchProvider(t_url3); | 733 model_->SetDefaultSearchProvider(t_url3); |
734 ASSERT_EQ(t_url3, model_->GetDefaultSearchProvider()); | 734 ASSERT_EQ(t_url3, model_->GetDefaultSearchProvider()); |
735 model_->MergeEnginesFromPrepopulateData(); | 735 model_->MergeEnginesFromPrepopulateData(); |
736 ASSERT_EQ(t_url3, model_->GetTemplateURLForKeyword(L"unittest")); | 736 ASSERT_EQ(t_url3, model_->GetTemplateURLForKeyword(L"unittest")); |
737 ASSERT_EQ(t_url3, model_->GetDefaultSearchProvider()); | 737 ASSERT_EQ(t_url3, model_->GetDefaultSearchProvider()); |
738 // Don't remove |t_url3|; we'd need to make it non-default first, and why | 738 // Don't remove |t_url3|; we'd need to make it non-default first, and why |
739 // bother when the model shutdown will clean it up for us. | 739 // bother when the model shutdown will clean it up for us. |
740 } | 740 } |
OLD | NEW |