Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3958)

Unified Diff: components/omnibox/browser/history_quick_provider_unittest.cc

Issue 2364553004: Updated and refactored URLIndexPrivateData::HistoryItemsForTerms to handle searching the history fo… (Closed)
Patch Set: Fixed bug to properly increment post_filter_item_count_. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/omnibox/browser/history_quick_provider_unittest.cc
diff --git a/components/omnibox/browser/history_quick_provider_unittest.cc b/components/omnibox/browser/history_quick_provider_unittest.cc
index 662718aaf60f4c8c15a14c9b2db46ef31a1b0435..0a556fd5c6cb5d644e061cc8132c4b76c4cdfe84 100644
--- a/components/omnibox/browser/history_quick_provider_unittest.cc
+++ b/components/omnibox/browser/history_quick_provider_unittest.cc
@@ -57,52 +57,53 @@ struct TestURLInfo {
int typed_count;
int days_from_now;
} quick_test_db[] = {
- {"http://www.google.com/", "Google", 3, 3, 0},
- {"http://slashdot.org/favorite_page.html", "Favorite page", 200, 100, 0},
- {"http://kerneltrap.org/not_very_popular.html", "Less popular", 4, 0, 0},
- {"http://freshmeat.net/unpopular.html", "Unpopular", 1, 1, 0},
- {"http://news.google.com/?ned=us&topic=n", "Google News - U.S.", 2, 2, 0},
- {"http://news.google.com/", "Google News", 1, 1, 0},
- {"http://foo.com/", "Dir", 200, 100, 0},
- {"http://foo.com/dir/", "Dir", 2, 1, 10},
- {"http://foo.com/dir/another/", "Dir", 10, 5, 0},
- {"http://foo.com/dir/another/again/", "Dir", 5, 1, 0},
- {"http://foo.com/dir/another/again/myfile.html", "File", 3, 1, 0},
- {"http://visitedest.com/y/a", "VA", 10, 1, 20},
- {"http://visitedest.com/y/b", "VB", 9, 1, 20},
- {"http://visitedest.com/x/c", "VC", 8, 1, 20},
- {"http://visitedest.com/x/d", "VD", 7, 1, 20},
- {"http://visitedest.com/y/e", "VE", 6, 1, 20},
- {"http://typeredest.com/y/a", "TA", 5, 5, 0},
- {"http://typeredest.com/y/b", "TB", 5, 4, 0},
- {"http://typeredest.com/x/c", "TC", 5, 3, 0},
- {"http://typeredest.com/x/d", "TD", 5, 2, 0},
- {"http://typeredest.com/y/e", "TE", 5, 1, 0},
- {"http://daysagoest.com/y/a", "DA", 1, 1, 0},
- {"http://daysagoest.com/y/b", "DB", 1, 1, 1},
- {"http://daysagoest.com/x/c", "DC", 1, 1, 2},
- {"http://daysagoest.com/x/d", "DD", 1, 1, 3},
- {"http://daysagoest.com/y/e", "DE", 1, 1, 4},
- {"http://abcdefghixyzjklmnopqrstuvw.com/a", "", 3, 1, 0},
- {"http://spaces.com/path%20with%20spaces/foo.html", "Spaces", 2, 2, 0},
- {"http://abcdefghijklxyzmnopqrstuvw.com/a", "", 3, 1, 0},
- {"http://abcdefxyzghijklmnopqrstuvw.com/a", "", 3, 1, 0},
- {"http://abcxyzdefghijklmnopqrstuvw.com/a", "", 3, 1, 0},
- {"http://xyzabcdefghijklmnopqrstuvw.com/a", "", 3, 1, 0},
- {"http://cda.com/Dogs%20Cats%20Gorillas%20Sea%20Slugs%20and%20Mice",
- "Dogs & Cats & Mice & Other Animals", 1, 1, 0},
- {"https://monkeytrap.org/", "", 3, 1, 0},
- {"http://popularsitewithpathonly.com/moo",
- "popularsitewithpathonly.com/moo", 50, 50, 0},
- {"http://popularsitewithroot.com/", "popularsitewithroot.com", 50, 50, 0},
- {"http://testsearch.com/?q=thequery", "Test Search Engine", 10, 10, 0},
- {"http://testsearch.com/", "Test Search Engine", 9, 9, 0},
- {"http://anotherengine.com/?q=thequery", "Another Search Engine", 8, 8, 0},
- // The encoded stuff between /wiki/ and the # is 第二次世界大戦
- {"http://ja.wikipedia.org/wiki/%E7%AC%AC%E4%BA%8C%E6%AC%A1%E4%B8%96%E7%95"
- "%8C%E5%A4%A7%E6%88%A6#.E3.83.B4.E3.82.A7.E3.83.AB.E3.82.B5.E3.82.A4.E3."
- "83.A6.E4.BD.93.E5.88.B6", "Title Unimportant", 2, 2, 0}
-};
+ {"http://www.google.com/", "Google", 3, 3, 0},
+ {"http://slashdot.org/favorite_page.html", "Favorite page", 200, 100, 0},
+ {"http://kerneltrap.org/not_very_popular.html", "Less popular", 4, 0, 0},
+ {"http://freshmeat.net/unpopular.html", "Unpopular", 1, 1, 0},
+ {"http://news.google.com/?ned=us&topic=n", "Google News - U.S.", 2, 2, 0},
+ {"http://news.google.com/", "Google News", 1, 1, 0},
+ {"http://foo.com/", "Dir", 200, 100, 0},
+ {"http://foo.com/dir/", "Dir", 2, 1, 10},
+ {"http://foo.com/dir/another/", "Dir", 10, 5, 0},
+ {"http://foo.com/dir/another/again/", "Dir", 5, 1, 0},
+ {"http://foo.com/dir/another/again/myfile.html", "File", 3, 1, 0},
+ {"http://visitedest.com/y/a", "VA", 10, 1, 20},
+ {"http://visitedest.com/y/b", "VB", 9, 1, 20},
+ {"http://visitedest.com/x/c", "VC", 8, 1, 20},
+ {"http://visitedest.com/x/d", "VD", 7, 1, 20},
+ {"http://visitedest.com/y/e", "VE", 6, 1, 20},
+ {"http://typeredest.com/y/a", "TA", 5, 5, 0},
+ {"http://typeredest.com/y/b", "TB", 5, 4, 0},
+ {"http://typeredest.com/x/c", "TC", 5, 3, 0},
+ {"http://typeredest.com/x/d", "TD", 5, 2, 0},
+ {"http://typeredest.com/y/e", "TE", 5, 1, 0},
+ {"http://daysagoest.com/y/a", "DA", 1, 1, 0},
+ {"http://daysagoest.com/y/b", "DB", 1, 1, 1},
+ {"http://daysagoest.com/x/c", "DC", 1, 1, 2},
+ {"http://daysagoest.com/x/d", "DD", 1, 1, 3},
+ {"http://daysagoest.com/y/e", "DE", 1, 1, 4},
+ {"http://abcdefghixyzjklmnopqrstuvw.com/a", "", 3, 1, 0},
+ {"http://spaces.com/path%20with%20spaces/foo.html", "Spaces", 2, 2, 0},
+ {"http://abcdefghijklxyzmnopqrstuvw.com/a", "", 3, 1, 0},
+ {"http://abcdefxyzghijklmnopqrstuvw.com/a", "", 3, 1, 0},
+ {"http://abcxyzdefghijklmnopqrstuvw.com/a", "", 3, 1, 0},
+ {"http://xyzabcdefghijklmnopqrstuvw.com/a", "", 3, 1, 0},
+ {"http://cda.com/Dogs%20Cats%20Gorillas%20Sea%20Slugs%20and%20Mice",
+ "Dogs & Cats & Mice & Other Animals", 1, 1, 0},
+ {"https://monkeytrap.org/", "", 3, 1, 0},
+ {"http://popularsitewithpathonly.com/moo",
+ "popularsitewithpathonly.com/moo", 50, 50, 0},
+ {"http://popularsitewithroot.com/", "popularsitewithroot.com", 50, 50, 0},
+ {"http://testsearch.com/?q=thequery", "Test Search Engine", 10, 10, 0},
+ {"http://testsearch.com/", "Test Search Engine", 9, 9, 0},
+ {"http://anotherengine.com/?q=thequery", "Another Search Engine", 8, 8, 0},
+ // The encoded stuff between /wiki/ and the # is 第二次世界大戦
+ {"http://ja.wikipedia.org/wiki/%E7%AC%AC%E4%BA%8C%E6%AC%A1%E4%B8%96%E7%95"
+ "%8C%E5%A4%A7%E6%88%A6#.E3.83.B4.E3.82.A7.E3.83.AB.E3.82.B5.E3.82.A4.E3."
+ "83.A6.E4.BD.93.E5.88.B6",
+ "Title Unimportant", 2, 2, 0},
+ {"https://twitter.com/fungoodtimes", "relatable!", 1, 1, 0}};
// Waits for OnURLsDeletedNotification and when run quits the supplied run loop.
class WaitForURLsDeletedObserver : public history::HistoryServiceObserver {
@@ -496,6 +497,16 @@ TEST_F(HistoryQuickProviderTest, SingleMatchWithCursor) {
base::string16());
}
+TEST_F(HistoryQuickProviderTest, MatchWithAndWithoutCursorWordBreak) {
+ std::vector<std::string> expected_urls;
+ expected_urls.push_back("https://twitter.com/fungoodtimes");
+ // With cursor after "good", we should retrieve the desired result but it
+ // should not be allowed to be the default match.
+ RunTestWithCursor(ASCIIToUTF16("fungoodtimes"), 7, false, expected_urls,
+ false, ASCIIToUTF16("https://twitter.com/fungoodtimes"),
+ base::string16());
+}
+
TEST_F(HistoryQuickProviderTest, WordBoundariesWithPunctuationMatch) {
std::vector<std::string> expected_urls;
expected_urls.push_back("http://popularsitewithpathonly.com/moo");

Powered by Google App Engine
This is Rietveld 408576698