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

Unified Diff: chrome/browser/autocomplete/shortcuts_provider_unittest.cc

Issue 229733004: Omnibox: Make Bookmarks Set Inline_Autocompletion (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Peter's comments Created 6 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
« no previous file with comments | « chrome/browser/autocomplete/shortcuts_provider.cc ('k') | chrome/browser/autocomplete/url_prefix.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/shortcuts_provider_unittest.cc
diff --git a/chrome/browser/autocomplete/shortcuts_provider_unittest.cc b/chrome/browser/autocomplete/shortcuts_provider_unittest.cc
index 30305d7f5cc0c5ac3cb528dd2492a566bc0a1fe9..511c95fccb627dba730c37970206805b7b0607c7 100644
--- a/chrome/browser/autocomplete/shortcuts_provider_unittest.cc
+++ b/chrome/browser/autocomplete/shortcuts_provider_unittest.cc
@@ -186,6 +186,16 @@ struct TestShortcutInfo {
"0,1", "Foo - Typo in Input Corrected in fill_into_edit", "0,1",
content::PAGE_TRANSITION_TYPED, AutocompleteMatchType::HISTORY_URL, "",
1, 100 },
+ { "BD85DBA2-8C29-49F9-84AE-48E1E90880FB", "trailing1 ",
+ "http://trailing1.com", "http://trailing1.com/",
+ "Trailing1 - Space in Shortcut", "0,1",
+ "Trailing1 - Space in Shortcut", "0,1", content::PAGE_TRANSITION_TYPED,
+ AutocompleteMatchType::HISTORY_URL, "", 1, 100 },
+ { "BD85DBA2-8C29-49F9-84AE-48E1E90880FC", "about:trailing2 ",
+ "chrome://trailing2blah", "chrome://trailing2blah/",
+ "Trailing2 - Space in Shortcut", "0,1",
+ "Trailing2 - Space in Shortcut", "0,1", content::PAGE_TRANSITION_TYPED,
+ AutocompleteMatchType::HISTORY_URL, "", 1, 100 },
};
} // namespace
@@ -511,6 +521,36 @@ TEST_F(ShortcutsProviderTest, TrickySingleMatch) {
expected_urls.push_back(
ExpectedURLAndAllowedToBeDefault(expected_url, true));
RunTest(text, true, expected_urls, expected_url, base::string16());
+
+ // A foursome of tests to verify that trailing spaces prevent the shortcut
+ // from being allowed to be the default match. For each of two tests, we
+ // first verify that the match is allowed to be default without the trailing
+ // space but is not allowed to be default with the trailing space. In both
+ // of these with-trailing-space cases, we actually get an
+ // inline_autocompletion, though it's never used because the match is
+ // prohibited from being default.
+ text = ASCIIToUTF16("trailing1");
+ expected_url = "http://trailing1.com/";
+ expected_urls.clear();
+ expected_urls.push_back(
+ ExpectedURLAndAllowedToBeDefault(expected_url, true));
+ RunTest(text, false, expected_urls, expected_url, ASCIIToUTF16(".com"));
+ text = ASCIIToUTF16("trailing1 ");
+ expected_urls.clear();
+ expected_urls.push_back(
+ ExpectedURLAndAllowedToBeDefault(expected_url, false));
+ RunTest(text, false, expected_urls, expected_url, ASCIIToUTF16(".com"));
+ text = ASCIIToUTF16("about:trailing2");
+ expected_url = "chrome://trailing2blah/";
+ expected_urls.clear();
+ expected_urls.push_back(
+ ExpectedURLAndAllowedToBeDefault(expected_url, true));
+ RunTest(text, false, expected_urls, expected_url, ASCIIToUTF16("blah"));
+ text = ASCIIToUTF16("about:trailing2 ");
+ expected_urls.clear();
+ expected_urls.push_back(
+ ExpectedURLAndAllowedToBeDefault(expected_url, false));
+ RunTest(text, false, expected_urls, expected_url, ASCIIToUTF16("blah"));
}
TEST_F(ShortcutsProviderTest, MultiMatch) {
« no previous file with comments | « chrome/browser/autocomplete/shortcuts_provider.cc ('k') | chrome/browser/autocomplete/url_prefix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698