summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete/autocomplete_unittest.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-16 19:49:22 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-16 19:49:22 +0000
commit96be43e90d30140bc5266cb8f667fbf03a8a7d0e (patch)
tree3c4fd679967fc2ee1cf9c51028a15b4eee2751d9 /chrome/browser/autocomplete/autocomplete_unittest.cc
parent878d73010d3e415857730205d0892ad6ecf1a26d (diff)
downloadchromium_src-96be43e90d30140bc5266cb8f667fbf03a8a7d0e.zip
chromium_src-96be43e90d30140bc5266cb8f667fbf03a8a7d0e.tar.gz
chromium_src-96be43e90d30140bc5266cb8f667fbf03a8a7d0e.tar.bz2
Classify more types of input as queries.
This adds an oracle that can determine if a hostname is RFC 1738 compliant; if we get a hostname that's not an IP address and not compliant here, we almost certainly have a query. This also rejects "ports" that don't consist of a number between 0 and 65535 (e.g. port "abc" or port "123456"). BUG=18817 TEST=The string "foo: bar" (with quotes) should default to search, not navigate, in the address bar. Review URL: http://codereview.chromium.org/271116 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29317 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_unittest.cc')
-rw-r--r--chrome/browser/autocomplete/autocomplete_unittest.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_unittest.cc b/chrome/browser/autocomplete/autocomplete_unittest.cc
index 40e6ecf..4ab6ea4 100644
--- a/chrome/browser/autocomplete/autocomplete_unittest.cc
+++ b/chrome/browser/autocomplete/autocomplete_unittest.cc
@@ -211,13 +211,17 @@ TEST(AutocompleteTest, InputType) {
{ L"?http://foo.com/bar", AutocompleteInput::FORCED_QUERY },
{ L"foo", AutocompleteInput::UNKNOWN },
{ L"foo.com", AutocompleteInput::URL },
+ { L"-.com", AutocompleteInput::QUERY },
{ L"foo/bar", AutocompleteInput::URL },
{ L"foo/bar baz", AutocompleteInput::UNKNOWN },
{ L"http://foo/bar baz", AutocompleteInput::URL },
{ L"foo bar", AutocompleteInput::QUERY },
+ { L"\"foo:bar\"", AutocompleteInput::QUERY },
{ L"link:foo.com", AutocompleteInput::UNKNOWN },
{ L"www.foo.com:81", AutocompleteInput::URL },
{ L"localhost:8080", AutocompleteInput::URL },
+ { L"foo.com:123456", AutocompleteInput::QUERY },
+ { L"foo.com:abc", AutocompleteInput::QUERY },
{ L"en.wikipedia.org/wiki/James Bond", AutocompleteInput::URL },
// In Chrome itself, mailto: will get handled by ShellExecute, but in
// unittest mode, we don't have the data loaded in the external protocol