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

Unified Diff: chrome/browser/history/text_database_unittest.cc

Issue 9316129: Don't strip punctuation inside quotes in history search queries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add unit tests to verify fix. Created 8 years, 10 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: chrome/browser/history/text_database_unittest.cc
diff --git a/chrome/browser/history/text_database_unittest.cc b/chrome/browser/history/text_database_unittest.cc
index 15f9a260791b8b02dedc73b1e5403bb89d0a550e..8910961475a1e592ee53bef809b57a493d686830 100644
--- a/chrome/browser/history/text_database_unittest.cc
+++ b/chrome/browser/history/text_database_unittest.cc
@@ -229,6 +229,31 @@ TEST_F(TextDatabaseTest, Query) {
"COUNTTAG", false));
EXPECT_TRUE(StartsWithASCII(UTF16ToUTF8(results[2].snippet.text()),
"COUNTTAG", false));
+
+ // Try a quoted query.
+ results.clear();
+ db->GetTextMatches("\"News for nerds\"", options, &results, &unique_urls,
+ &first_time_searched);
+ EXPECT_EQ(1U, results.size());
+
+ // Try a quoted query that contains punctuation.
+ results.clear();
+ db->GetTextMatches("\"Slashdot: News\"", options, &results, &unique_urls,
+ &first_time_searched);
+ EXPECT_EQ(1U, results.size());
+
+ // Ensure that punctuation inside quotes is not being ignored.
+ results.clear();
+ db->GetTextMatches("\"Slashdot News\"", options, &results, &unique_urls,
+ &first_time_searched);
+ EXPECT_EQ(0U, results.size());
+
+ // Try a quoted query that should *only* match the URL.
+ results.clear();
+ db->GetTextMatches("\"www.google.com\"", options, &results, &unique_urls,
+ &first_time_searched);
+ EXPECT_EQ(1U, results.size());
+ EXPECT_EQ(0U, results[0].title_match_positions.size());
}
TEST_F(TextDatabaseTest, TimeRange) {
« chrome/browser/history/query_parser.cc ('K') | « chrome/browser/history/query_parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698