Chromium Code Reviews| 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 "components/omnibox/browser/history_quick_provider.h" | 5 #include "components/omnibox/browser/history_quick_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <functional> | 10 #include <functional> |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 {"http://visitedest.com/y/a", "VA", 10, 1, 20}, | 245 {"http://visitedest.com/y/a", "VA", 10, 1, 20}, |
| 246 {"http://visitedest.com/y/b", "VB", 9, 1, 20}, | 246 {"http://visitedest.com/y/b", "VB", 9, 1, 20}, |
| 247 {"http://visitedest.com/x/c", "VC", 8, 1, 20}, | 247 {"http://visitedest.com/x/c", "VC", 8, 1, 20}, |
| 248 {"http://visitedest.com/x/d", "VD", 7, 1, 20}, | 248 {"http://visitedest.com/x/d", "VD", 7, 1, 20}, |
| 249 {"http://visitedest.com/y/e", "VE", 6, 1, 20}, | 249 {"http://visitedest.com/y/e", "VE", 6, 1, 20}, |
| 250 {"http://typeredest.com/y/a", "TA", 5, 5, 0}, | 250 {"http://typeredest.com/y/a", "TA", 5, 5, 0}, |
| 251 {"http://typeredest.com/y/b", "TB", 5, 4, 0}, | 251 {"http://typeredest.com/y/b", "TB", 5, 4, 0}, |
| 252 {"http://typeredest.com/x/c", "TC", 5, 3, 0}, | 252 {"http://typeredest.com/x/c", "TC", 5, 3, 0}, |
| 253 {"http://typeredest.com/x/d", "TD", 5, 2, 0}, | 253 {"http://typeredest.com/x/d", "TD", 5, 2, 0}, |
| 254 {"http://typeredest.com/y/e", "TE", 5, 1, 0}, | 254 {"http://typeredest.com/y/e", "TE", 5, 1, 0}, |
| 255 {"http://nevertyped.com/", "NA", 20, 0, 0}, | |
| 255 {"http://daysagoest.com/y/a", "DA", 1, 1, 0}, | 256 {"http://daysagoest.com/y/a", "DA", 1, 1, 0}, |
| 256 {"http://daysagoest.com/y/b", "DB", 1, 1, 1}, | 257 {"http://daysagoest.com/y/b", "DB", 1, 1, 1}, |
| 257 {"http://daysagoest.com/x/c", "DC", 1, 1, 2}, | 258 {"http://daysagoest.com/x/c", "DC", 1, 1, 2}, |
| 258 {"http://daysagoest.com/x/d", "DD", 1, 1, 3}, | 259 {"http://daysagoest.com/x/d", "DD", 1, 1, 3}, |
| 259 {"http://daysagoest.com/y/e", "DE", 1, 1, 4}, | 260 {"http://daysagoest.com/y/e", "DE", 1, 1, 4}, |
| 260 {"http://abcdefghixyzjklmnopqrstuvw.com/a", "", 3, 1, 0}, | 261 {"http://abcdefghixyzjklmnopqrstuvw.com/a", "", 3, 1, 0}, |
| 261 {"http://spaces.com/path%20with%20spaces/foo.html", "Spaces", 2, 2, 0}, | 262 {"http://spaces.com/path%20with%20spaces/foo.html", "Spaces", 2, 2, 0}, |
| 262 {"http://abcdefghijklxyzmnopqrstuvw.com/a", "", 3, 1, 0}, | 263 {"http://abcdefghijklxyzmnopqrstuvw.com/a", "", 3, 1, 0}, |
| 263 {"http://abcdefxyzghijklmnopqrstuvw.com/a", "", 3, 1, 0}, | 264 {"http://abcdefxyzghijklmnopqrstuvw.com/a", "", 3, 1, 0}, |
| 264 {"http://abcxyzdefghijklmnopqrstuvw.com/a", "", 3, 1, 0}, | 265 {"http://abcxyzdefghijklmnopqrstuvw.com/a", "", 3, 1, 0}, |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 521 TEST_F(HistoryQuickProviderTest, TypedCountMatches) { | 522 TEST_F(HistoryQuickProviderTest, TypedCountMatches) { |
| 522 std::vector<std::string> expected_urls; | 523 std::vector<std::string> expected_urls; |
| 523 expected_urls.push_back("http://typeredest.com/y/a"); | 524 expected_urls.push_back("http://typeredest.com/y/a"); |
| 524 expected_urls.push_back("http://typeredest.com/y/b"); | 525 expected_urls.push_back("http://typeredest.com/y/b"); |
| 525 expected_urls.push_back("http://typeredest.com/x/c"); | 526 expected_urls.push_back("http://typeredest.com/x/c"); |
| 526 RunTest(ASCIIToUTF16("typeredest"), false, expected_urls, true, | 527 RunTest(ASCIIToUTF16("typeredest"), false, expected_urls, true, |
| 527 ASCIIToUTF16("typeredest.com/y/a"), | 528 ASCIIToUTF16("typeredest.com/y/a"), |
| 528 ASCIIToUTF16(".com/y/a")); | 529 ASCIIToUTF16(".com/y/a")); |
| 529 } | 530 } |
| 530 | 531 |
| 532 TEST_F(HistoryQuickProviderTest, NeverTypedMatchesCantBeDefault) { | |
| 533 std::vector<std::string> expected_urls; | |
| 534 expected_urls.push_back("http://nevertyped.com/"); | |
|
Peter Kasting
2017/04/28 06:02:13
Nit: Just init at the definition with = {...} inst
tommycli
2017/04/28 15:44:11
Done.
| |
| 535 RunTest(ASCIIToUTF16("neverty"), false, expected_urls, false, | |
| 536 ASCIIToUTF16("nevertyped.com"), ASCIIToUTF16("ped.com/")); | |
| 537 } | |
| 538 | |
| 531 TEST_F(HistoryQuickProviderTest, DaysAgoMatches) { | 539 TEST_F(HistoryQuickProviderTest, DaysAgoMatches) { |
| 532 std::vector<std::string> expected_urls; | 540 std::vector<std::string> expected_urls; |
| 533 expected_urls.push_back("http://daysagoest.com/y/a"); | 541 expected_urls.push_back("http://daysagoest.com/y/a"); |
| 534 expected_urls.push_back("http://daysagoest.com/y/b"); | 542 expected_urls.push_back("http://daysagoest.com/y/b"); |
| 535 expected_urls.push_back("http://daysagoest.com/x/c"); | 543 expected_urls.push_back("http://daysagoest.com/x/c"); |
| 536 RunTest(ASCIIToUTF16("daysagoest"), false, expected_urls, true, | 544 RunTest(ASCIIToUTF16("daysagoest"), false, expected_urls, true, |
| 537 ASCIIToUTF16("daysagoest.com/y/a"), | 545 ASCIIToUTF16("daysagoest.com/y/a"), |
| 538 ASCIIToUTF16(".com/y/a")); | 546 ASCIIToUTF16(".com/y/a")); |
| 539 } | 547 } |
| 540 | 548 |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 821 | 829 |
| 822 TEST_F(HQPOrderingTest, TEAMatch) { | 830 TEST_F(HQPOrderingTest, TEAMatch) { |
| 823 std::vector<std::string> expected_urls; | 831 std::vector<std::string> expected_urls; |
| 824 expected_urls.push_back("http://www.teamliquid.net/"); | 832 expected_urls.push_back("http://www.teamliquid.net/"); |
| 825 expected_urls.push_back("http://www.teamliquid.net/tlpd"); | 833 expected_urls.push_back("http://www.teamliquid.net/tlpd"); |
| 826 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); | 834 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); |
| 827 RunTest(ASCIIToUTF16("tea"), false, expected_urls, true, | 835 RunTest(ASCIIToUTF16("tea"), false, expected_urls, true, |
| 828 ASCIIToUTF16("www.teamliquid.net"), | 836 ASCIIToUTF16("www.teamliquid.net"), |
| 829 ASCIIToUTF16("mliquid.net")); | 837 ASCIIToUTF16("mliquid.net")); |
| 830 } | 838 } |
| OLD | NEW |