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

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

Issue 12090006: Omnibox: Create Keyword Verbatim Result in Search Provider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more extension cleanup Created 7 years, 11 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/autocomplete/keyword_provider_unittest.cc
diff --git a/chrome/browser/autocomplete/keyword_provider_unittest.cc b/chrome/browser/autocomplete/keyword_provider_unittest.cc
index ef192d7fbe800d5dcb250b873b27c5446569c623..a58559aa7242ace71fcf5f9cf0a8adc1719ee079 100644
--- a/chrome/browser/autocomplete/keyword_provider_unittest.cc
+++ b/chrome/browser/autocomplete/keyword_provider_unittest.cc
@@ -88,10 +88,13 @@ TEST_F(KeywordProviderTest, Edit) {
// Check that tokenization only collapses whitespace between first tokens,
// no-query-input cases have a space appended, and action is not escaped.
- {ASCIIToUTF16("z foo"), 1, {ASCIIToUTF16("z foo")}},
{ASCIIToUTF16("z"), 1, {ASCIIToUTF16("z ")}},
{ASCIIToUTF16("z \t"), 1, {ASCIIToUTF16("z ")}},
- {ASCIIToUTF16("z a b c++"), 1, {ASCIIToUTF16("z a b c++")}},
+
+ // Check that exact, substituting keywords with a verbatim search term
+ // don't generate a result. (These are handled by SearchProvider.)
+ {ASCIIToUTF16("z foo"), 0, {}},
+ {ASCIIToUTF16("z a b c++"), 0, {}},
// Matches should be limited to three, and sorted in quality order, not
// alphabetical.
@@ -104,8 +107,8 @@ TEST_F(KeywordProviderTest, Edit) {
ASCIIToUTF16("ab "),
ASCIIToUTF16("aaaa ")}},
// Exact matches should prevent returning inexact matches.
- {ASCIIToUTF16("aaaa foo"), 1, {ASCIIToUTF16("aaaa foo")}},
- {ASCIIToUTF16("www.aaaa foo"), 1, {ASCIIToUTF16("aaaa foo")}},
+ {ASCIIToUTF16("aaaa foo"), 0, {}},
+ {ASCIIToUTF16("www.aaaa foo"), 0, {}},
// Clean up keyword input properly. "http" and "https" are the only
// allowed schemes.
@@ -133,8 +136,9 @@ TEST_F(KeywordProviderTest, URL) {
// Check that tokenization only collapses whitespace between first tokens
// and query input, but not rest of URL, is escaped.
- {ASCIIToUTF16("z a b c++"), 1, {GURL("a+++b+++c%2B%2B=z")}},
- {ASCIIToUTF16("www.www www"), 1, {GURL(" +%2B?=wwwfoo ")}},
+// {ASCIIToUTF16("z a b c++"), 1, {GURL("a+++b+++c%2B%2B=z")}},
+ {ASCIIToUTF16("w bar +baz"), 2, {GURL(" +%2B?=bar+%2Bbazfoo "),
+ GURL("bar+%2Bbaz=z")}},
// Substitution should work with various locations of the "%s".
{ASCIIToUTF16("aaa 1a2b"), 2, {GURL("http://aaaa/?aaaa=1&b=1a2b&c"),
@@ -158,21 +162,21 @@ TEST_F(KeywordProviderTest, Contents) {
{ASCIIToUTF16("z \t"), 1,
{ASCIIToUTF16("Search z for <enter query>")}},
- // Check that tokenization only collapses whitespace between first tokens
- // and contents are not escaped or unescaped.
- {ASCIIToUTF16("z a b c++"), 1,
- {ASCIIToUTF16("Search z for a b c++")}},
- {ASCIIToUTF16("www.www www"), 1, {ASCIIToUTF16("Search www for www")}},
+ // Exact keyword matches with remaining text should return nothing.
Bart N. 2013/01/29 18:50:42 Can you add a unit test for non empty remaining te
Bart N. 2013/01/29 21:48:35 This may help: http://build.chromium.org/f/chromiu
Mark P 2013/01/30 19:46:21 Acknowledged.
Mark P 2013/01/30 19:46:21 Good question. I re-enabled a test in chrome/brow
+ {ASCIIToUTF16("www.www www"), 0, {}},
+ {ASCIIToUTF16("z a b c++"), 0, {}},
// Substitution should work with various locations of the "%s".
{ASCIIToUTF16("aaa"), 2,
{ASCIIToUTF16("Search aaaa for <enter query>"),
ASCIIToUTF16("Search aaaaa for <enter query>")}},
- {ASCIIToUTF16("a 1 2 3"), 3, {ASCIIToUTF16("Search aa for 1 2 3"),
- ASCIIToUTF16("Search ab for 1 2 3"),
- ASCIIToUTF16("Search aaaa for 1 2 3")}},
{ASCIIToUTF16("www.w w"), 2, {ASCIIToUTF16("Search www for w"),
ASCIIToUTF16("Search weasel for w")}},
+ // Also, check that tokenization only collapses whitespace between first
+ // tokens and contents are not escaped or unescaped.
+ {ASCIIToUTF16("a 1 2+ 3"), 3, {ASCIIToUTF16("Search aa for 1 2+ 3"),
+ ASCIIToUTF16("Search ab for 1 2+ 3"),
+ ASCIIToUTF16("Search aaaa for 1 2+ 3")}},
};
RunTest<string16>(contents_cases, arraysize(contents_cases),

Powered by Google App Engine
This is Rietveld 408576698