| 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 "chrome/browser/autocomplete/history_quick_provider.h" | 5 #include "chrome/browser/autocomplete/history_quick_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 "gaming news", 26, 25, 3}, | 747 "gaming news", 26, 25, 3}, |
| 748 {"http://metaleater.com/", "metaleater", 4, 3, 8}, | 748 {"http://metaleater.com/", "metaleater", 4, 3, 8}, |
| 749 {"http://half.com/", "half.com: textbooks , books , music , movies , games , " | 749 {"http://half.com/", "half.com: textbooks , books , music , movies , games , " |
| 750 "video games", 4, 4, 6}, | 750 "video games", 4, 4, 6}, |
| 751 {"http://teamliquid.net/", "team liquid - starcraft 2 and brood war pro " | 751 {"http://teamliquid.net/", "team liquid - starcraft 2 and brood war pro " |
| 752 "gaming news", 8, 5, 9}, | 752 "gaming news", 8, 5, 9}, |
| 753 }; | 753 }; |
| 754 | 754 |
| 755 class HQPOrderingTest : public HistoryQuickProviderTest { | 755 class HQPOrderingTest : public HistoryQuickProviderTest { |
| 756 protected: | 756 protected: |
| 757 virtual void GetTestData(size_t* data_count, | 757 void GetTestData(size_t* data_count, TestURLInfo** test_data) override; |
| 758 TestURLInfo** test_data) override; | |
| 759 }; | 758 }; |
| 760 | 759 |
| 761 void HQPOrderingTest::GetTestData(size_t* data_count, TestURLInfo** test_data) { | 760 void HQPOrderingTest::GetTestData(size_t* data_count, TestURLInfo** test_data) { |
| 762 DCHECK(data_count); | 761 DCHECK(data_count); |
| 763 DCHECK(test_data); | 762 DCHECK(test_data); |
| 764 *data_count = arraysize(ordering_test_db); | 763 *data_count = arraysize(ordering_test_db); |
| 765 *test_data = &ordering_test_db[0]; | 764 *test_data = &ordering_test_db[0]; |
| 766 } | 765 } |
| 767 | 766 |
| 768 TEST_F(HQPOrderingTest, TEMatch) { | 767 TEST_F(HQPOrderingTest, TEMatch) { |
| 769 std::vector<std::string> expected_urls; | 768 std::vector<std::string> expected_urls; |
| 770 expected_urls.push_back("http://techmeme.com/"); | 769 expected_urls.push_back("http://techmeme.com/"); |
| 771 expected_urls.push_back("http://www.teamliquid.net/"); | 770 expected_urls.push_back("http://www.teamliquid.net/"); |
| 772 expected_urls.push_back("http://www.teamliquid.net/tlpd"); | 771 expected_urls.push_back("http://www.teamliquid.net/tlpd"); |
| 773 RunTest(ASCIIToUTF16("te"), false, expected_urls, true, | 772 RunTest(ASCIIToUTF16("te"), false, expected_urls, true, |
| 774 ASCIIToUTF16("techmeme.com"), | 773 ASCIIToUTF16("techmeme.com"), |
| 775 ASCIIToUTF16("chmeme.com")); | 774 ASCIIToUTF16("chmeme.com")); |
| 776 } | 775 } |
| 777 | 776 |
| 778 TEST_F(HQPOrderingTest, TEAMatch) { | 777 TEST_F(HQPOrderingTest, TEAMatch) { |
| 779 std::vector<std::string> expected_urls; | 778 std::vector<std::string> expected_urls; |
| 780 expected_urls.push_back("http://www.teamliquid.net/"); | 779 expected_urls.push_back("http://www.teamliquid.net/"); |
| 781 expected_urls.push_back("http://www.teamliquid.net/tlpd"); | 780 expected_urls.push_back("http://www.teamliquid.net/tlpd"); |
| 782 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); | 781 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); |
| 783 RunTest(ASCIIToUTF16("tea"), false, expected_urls, true, | 782 RunTest(ASCIIToUTF16("tea"), false, expected_urls, true, |
| 784 ASCIIToUTF16("www.teamliquid.net"), | 783 ASCIIToUTF16("www.teamliquid.net"), |
| 785 ASCIIToUTF16("mliquid.net")); | 784 ASCIIToUTF16("mliquid.net")); |
| 786 } | 785 } |
| OLD | NEW |