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