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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
489 std::vector<std::string> expected_urls; | 489 std::vector<std::string> expected_urls; |
490 expected_urls.push_back("http://slashdot.org/favorite_page.html"); | 490 expected_urls.push_back("http://slashdot.org/favorite_page.html"); |
491 // With cursor after "slash", we should retrieve the desired result but it | 491 // With cursor after "slash", we should retrieve the desired result but it |
492 // should not be allowed to be the default match. | 492 // should not be allowed to be the default match. |
493 RunTestWithCursor(ASCIIToUTF16("slashfavorite_page.html"), 5, false, | 493 RunTestWithCursor(ASCIIToUTF16("slashfavorite_page.html"), 5, false, |
494 expected_urls, false, | 494 expected_urls, false, |
495 ASCIIToUTF16("slashdot.org/favorite_page.html"), | 495 ASCIIToUTF16("slashdot.org/favorite_page.html"), |
496 base::string16()); | 496 base::string16()); |
497 } | 497 } |
498 | 498 |
499 TEST_F(HistoryQuickProviderTest, MatchWithAndWithoutCursorWordBreak) { | |
Mark P
2016/08/22 18:24:11
I'm surprised this test passes as-is, as it doesn'
Lavar Askew
2016/08/23 20:38:19
Can't I just start up the latest release instance
| |
500 std::vector<std::string> expected_urls; | |
501 expected_urls.push_back("https://twitter.com/fungoodtimes"); | |
502 // With cursor after "good", we should retrieve the desired result but it | |
503 // should not be allowed to be the default match. | |
504 RunTestWithCursor(ASCIIToUTF16("fungoodtimes"), 7, false, expected_urls, | |
505 false, ASCIIToUTF16("twitter.com/fungoodtimes"), | |
506 base::string16()); | |
507 } | |
508 | |
509 // Runs an autocomplete query on |text| and checks to see that the returned | |
Mark P
2016/08/22 18:24:11
This function declaration and the one below should
Lavar Askew
2016/08/23 20:38:19
Deleted those lines....Done.
| |
510 // results' destination URLs match those provided. |expected_urls| does not | |
511 // need to be in sorted order. | |
512 void RunTest(const base::string16 text, | |
513 bool prevent_inline_autocomplete, | |
514 std::vector<std::string> expected_urls, | |
515 bool can_inline_top_result, | |
516 base::string16 expected_fill_into_edit, | |
517 base::string16 autocompletion); | |
518 | |
519 // As above, simply with a cursor position specified. | |
520 void RunTestWithCursor(const base::string16 text, | |
521 const size_t cursor_position, | |
522 bool prevent_inline_autocomplete, | |
523 std::vector<std::string> expected_urls, | |
524 bool can_inline_top_result, | |
525 base::string16 expected_fill_into_edit, | |
526 base::string16 autocompletion); | |
527 | |
499 TEST_F(HistoryQuickProviderTest, WordBoundariesWithPunctuationMatch) { | 528 TEST_F(HistoryQuickProviderTest, WordBoundariesWithPunctuationMatch) { |
500 std::vector<std::string> expected_urls; | 529 std::vector<std::string> expected_urls; |
501 expected_urls.push_back("http://popularsitewithpathonly.com/moo"); | 530 expected_urls.push_back("http://popularsitewithpathonly.com/moo"); |
502 RunTest(ASCIIToUTF16("/moo"), false, expected_urls, false, | 531 RunTest(ASCIIToUTF16("/moo"), false, expected_urls, false, |
503 ASCIIToUTF16("popularsitewithpathonly.com/moo"), base::string16()); | 532 ASCIIToUTF16("popularsitewithpathonly.com/moo"), base::string16()); |
504 } | 533 } |
505 | 534 |
506 TEST_F(HistoryQuickProviderTest, MultiTermTitleMatch) { | 535 TEST_F(HistoryQuickProviderTest, MultiTermTitleMatch) { |
507 std::vector<std::string> expected_urls; | 536 std::vector<std::string> expected_urls; |
508 expected_urls.push_back( | 537 expected_urls.push_back( |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
887 | 916 |
888 TEST_F(HQPOrderingTest, TEAMatch) { | 917 TEST_F(HQPOrderingTest, TEAMatch) { |
889 std::vector<std::string> expected_urls; | 918 std::vector<std::string> expected_urls; |
890 expected_urls.push_back("http://www.teamliquid.net/"); | 919 expected_urls.push_back("http://www.teamliquid.net/"); |
891 expected_urls.push_back("http://www.teamliquid.net/tlpd"); | 920 expected_urls.push_back("http://www.teamliquid.net/tlpd"); |
892 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); | 921 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); |
893 RunTest(ASCIIToUTF16("tea"), false, expected_urls, true, | 922 RunTest(ASCIIToUTF16("tea"), false, expected_urls, true, |
894 ASCIIToUTF16("www.teamliquid.net"), | 923 ASCIIToUTF16("www.teamliquid.net"), |
895 ASCIIToUTF16("mliquid.net")); | 924 ASCIIToUTF16("mliquid.net")); |
896 } | 925 } |
OLD | NEW |