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

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

Issue 2187343002: Generating autocomplete results with and without word breaks in the Omnibox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: corrected formatting and improved comments. Also added unit test MatchWithAndWithoutCursorWordBreak Created 4 years, 4 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 816f298d0d1352fd84de3634709af799530b3ac7..ec9a904003ca5ff72b168e8c470e30c1652fd7f7 100644
--- a/components/omnibox/browser/history_quick_provider_unittest.cc
+++ b/components/omnibox/browser/history_quick_provider_unittest.cc
@@ -496,6 +496,35 @@ TEST_F(HistoryQuickProviderTest, SingleMatchWithCursor) {
base::string16());
}
+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
+ 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("twitter.com/fungoodtimes"),
+ base::string16());
+}
+
+// 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.
+// results' destination URLs match those provided. |expected_urls| does not
+// need to be in sorted order.
+void RunTest(const base::string16 text,
+ bool prevent_inline_autocomplete,
+ std::vector<std::string> expected_urls,
+ bool can_inline_top_result,
+ base::string16 expected_fill_into_edit,
+ base::string16 autocompletion);
+
+// As above, simply with a cursor position specified.
+void RunTestWithCursor(const base::string16 text,
+ const size_t cursor_position,
+ bool prevent_inline_autocomplete,
+ std::vector<std::string> expected_urls,
+ bool can_inline_top_result,
+ base::string16 expected_fill_into_edit,
+ base::string16 autocompletion);
+
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