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

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

Issue 2846673006: Omnibox: Make InMemoryURLIndex respect hidden URLRows (Closed)
Patch Set: change approach Created 3 years, 8 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/in_memory_url_index_unittest.cc
diff --git a/components/omnibox/browser/in_memory_url_index_unittest.cc b/components/omnibox/browser/in_memory_url_index_unittest.cc
index 36320e9f4be919aad4127857153b9921ef33c7bf..c82bbba96cf79d0bbe16185d15ada8b20e94151d 100644
--- a/components/omnibox/browser/in_memory_url_index_unittest.cc
+++ b/components/omnibox/browser/in_memory_url_index_unittest.cc
@@ -482,6 +482,20 @@ TEST_F(LimitedInMemoryURLIndexTest, Initialization) {
EXPECT_EQ(17U, private_data.word_map_.size());
}
+TEST_F(InMemoryURLIndexTest, HiddenURLRowsAreIgnored) {
Mark P 2017/05/03 19:04:49 Please confirm that this test fails before your fi
tommycli 2017/05/03 19:24:59 Done. I can confirm this test fails before the fix
+ history::URLID new_row_id = 87654321; // Arbitrarily chosen large new row id.
+ history::URLRow new_row =
+ history::URLRow(GURL("http://hidden.com"), new_row_id++);
Mark P 2017/05/03 19:04:49 nit: add trailing slash to make proper URL :-)
tommycli 2017/05/03 19:24:59 Done.
+ new_row.set_last_visit(base::Time::Now());
+ new_row.set_hidden(true);
+
+ EXPECT_FALSE(UpdateURL(new_row));
+ EXPECT_EQ(0U, url_index_
+ ->HistoryItemsForTerms(ASCIIToUTF16("hidden"),
+ base::string16::npos, kMaxMatches)
+ .size());
+}
+
TEST_F(InMemoryURLIndexTest, Retrieval) {
// See if a very specific term gives a single result.
ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(

Powered by Google App Engine
This is Rietveld 408576698