Index: chrome/browser/autocomplete/bookmark_provider_unittest.cc |
diff --git a/chrome/browser/autocomplete/bookmark_provider_unittest.cc b/chrome/browser/autocomplete/bookmark_provider_unittest.cc |
index ed6a160c2b5b081a8ca411851ccc73cce87be9de..241eea3f4bb60702644b4e8208e9efe389d5d100 100644 |
--- a/chrome/browser/autocomplete/bookmark_provider_unittest.cc |
+++ b/chrome/browser/autocomplete/bookmark_provider_unittest.cc |
@@ -33,8 +33,8 @@ struct BookmarksTestInfo { |
{ "abc def", "http://www.catsanddogs.com/a" }, |
{ "abcde", "http://www.catsanddogs.com/b" }, |
{ "abcdef", "http://www.catsanddogs.com/c" }, |
- { "a definition", "http://www.catsanddogs.com/d" }, |
- { "carry carbon carefully", "http://www.catsanddogs.com/e" }, |
+ { "carry carbon carefully", "http://www.catsanddogs.com/d" }, |
+ { "a definition", "http://www.catsanddogs.com/e" }, |
Mark P
2014/08/21 23:33:11
Swapped order of titles without changing URLs. (T
|
{ "ghi jkl", "http://www.catsanddogs.com/f" }, |
{ "jkl ghi", "http://www.catsanddogs.com/g" }, |
{ "frankly frankly frank", "http://www.catsanddogs.com/h" }, |
@@ -49,19 +49,17 @@ struct BookmarksTestInfo { |
{ "chrome://omnibox", "chrome://omnibox" }, |
// For testing ranking with different URLs. |
{"achlorhydric featherheads resuscitates mockingbirds", |
- "http://www.featherheads.com/a" }, |
+ "http://www.manylongwords.com/1a" }, |
{"achlorhydric mockingbirds resuscitates featherhead", |
- "http://www.featherheads.com/b" }, |
+ "http://www.manylongwords.com/2b" }, |
{"featherhead resuscitates achlorhydric mockingbirds", |
- "http://www.featherheads.com/c" }, |
+ "http://www.manylongwords.com/3c" }, |
{"mockingbirds resuscitates featherheads achlorhydric", |
- "http://www.featherheads.com/d" }, |
- // For testing URL boosting. |
- {"burning worms #1", "http://www.burned.com/" }, |
- {"burning worms #2", "http://www.worms.com/" }, |
- {"worming burns #10", "http://www.burned.com/" }, |
- {"worming burns #20", "http://www.worms.com/" }, |
- {"jive music", "http://www.worms.com/" }, |
+ "http://www.manylongwords.com/4d" }, |
+ // For testing URL boosting. (URLs referenced multiple times are boosted.) |
+ {"burning worms #1", "http://www.burns.com/" }, |
+ {"burning worms #2", "http://www.worms.com/" }, |
+ {"worming burns #10", "http://www.burns.com/" }, |
}; |
class BookmarkProviderTest : public testing::Test { |
@@ -81,7 +79,7 @@ class BookmarkProviderTest : public testing::Test { |
}; |
BookmarkProviderTest::BookmarkProviderTest() { |
- model_ = client_.CreateModel(false); |
+ model_ = client_.CreateModel(); |
} |
void BookmarkProviderTest::SetUp() { |
@@ -233,11 +231,12 @@ TEST_F(BookmarkProviderTest, Positions) { |
{{4, 7}, {0, 0}}}}, |
{"ghi jkl", 2, {{{0, 3}, {4, 7}, {0, 0}}, |
{{0, 3}, {4, 7}, {0, 0}}}}, |
- // NB: GetBookmarksWithTitlesMatching(...) uses exact match for "a". |
- {"a", 1, {{{0, 1}, {0, 0}}}}, |
+ // NB: GetBookmarksMatching(...) uses exact match for "a" in title or URL. |
+ {"a", 2, {{{0, 1}, {0, 0}}, |
+ {{0, 0}}}}, |
{"a d", 0, {{{0, 0}}}}, |
{"carry carbon", 1, {{{0, 5}, {6, 12}, {0, 0}}}}, |
- // NB: GetBookmarksWithTitlesMatching(...) sorts the match positions. |
+ // NB: GetBookmarksMatching(...) sorts the match positions. |
{"carbon carry", 1, {{{0, 5}, {6, 12}, {0, 0}}}}, |
{"arbon", 0, {{{0, 0}}}}, |
{"ar", 0, {{{0, 0}}}}, |
@@ -322,15 +321,18 @@ TEST_F(BookmarkProviderTest, Rankings) { |
3, {"mockingbirds resuscitates featherheads achlorhydric", |
"achlorhydric mockingbirds resuscitates featherhead", |
"featherhead resuscitates achlorhydric mockingbirds"}}, |
- // Ranking of exact-word matches with URL boost. |
- {"worms", 2, {"burning worms #2", // boosted |
- "burning worms #1", // not boosted |
+ // Ranking of exact-word matches with URL boosts. |
+ {"worms", 2, {"burning worms #1", // boosted |
+ "burning worms #2", // not boosted |
""}}, |
- // Ranking of prefix matches with URL boost. Note that a query of |
- // "worm burn" will have the same results. |
- {"burn worm", 3, {"burning worms #2", // boosted |
- "worming burns #20", // boosted |
- "burning worms #1"}}, // not boosted but shorter |
+ // Ranking of prefix matches with URL boost. |
+ {"burn worm", 3, {"burning worms #1", // boosted |
+ "worming burns #10", // boosted but longer title |
+ "burning worms #2"}}, // not boosted |
+ // A query of "worm burn" will have the same results. |
+ {"worm burn", 3, {"burning worms #1", // boosted |
+ "worming burns #10", // boosted but longer title |
+ "burning worms #2"}}, // not boosted |
}; |
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(query_data); ++i) { |
@@ -432,10 +434,6 @@ TEST_F(BookmarkProviderTest, StripHttpAndAdjustOffsets) { |
{ "versi", "chrome://version", "0:1,9:3,14:1" } |
}; |
- // Reload the bookmarks index with |index_urls| == true. |
- model_ = client_.CreateModel(true); |
- SetUp(); |
- |
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(query_data); ++i) { |
std::string description = "for query=" + query_data[i].query; |
AutocompleteInput input(base::ASCIIToUTF16(query_data[i].query), |