OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/scoped_ptr.h" | 6 #include "base/scoped_ptr.h" |
7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/autocomplete/autocomplete.h" | 10 #include "chrome/browser/autocomplete/autocomplete.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 { L"?foo", AutocompleteInput::FORCED_QUERY }, | 211 { L"?foo", AutocompleteInput::FORCED_QUERY }, |
212 { L"?foo bar", AutocompleteInput::FORCED_QUERY }, | 212 { L"?foo bar", AutocompleteInput::FORCED_QUERY }, |
213 { L"?http://foo.com/bar", AutocompleteInput::FORCED_QUERY }, | 213 { L"?http://foo.com/bar", AutocompleteInput::FORCED_QUERY }, |
214 { L"foo", AutocompleteInput::UNKNOWN }, | 214 { L"foo", AutocompleteInput::UNKNOWN }, |
215 { L"foo.c", AutocompleteInput::UNKNOWN }, | 215 { L"foo.c", AutocompleteInput::UNKNOWN }, |
216 { L"foo.com", AutocompleteInput::URL }, | 216 { L"foo.com", AutocompleteInput::URL }, |
217 { L"-.com", AutocompleteInput::UNKNOWN }, | 217 { L"-.com", AutocompleteInput::UNKNOWN }, |
218 { L"foo/bar", AutocompleteInput::URL }, | 218 { L"foo/bar", AutocompleteInput::URL }, |
219 { L"foo/bar baz", AutocompleteInput::UNKNOWN }, | 219 { L"foo/bar baz", AutocompleteInput::UNKNOWN }, |
220 { L"foo bar.com", AutocompleteInput::QUERY }, | 220 { L"foo bar.com", AutocompleteInput::QUERY }, |
221 { L"http://foo/bar baz", AutocompleteInput::URL }, | |
222 { L"foo bar", AutocompleteInput::QUERY }, | 221 { L"foo bar", AutocompleteInput::QUERY }, |
223 { L"foo+bar", AutocompleteInput::QUERY }, | 222 { L"foo+bar", AutocompleteInput::QUERY }, |
224 { L"foo+bar.com", AutocompleteInput::UNKNOWN }, | 223 { L"foo+bar.com", AutocompleteInput::UNKNOWN }, |
225 { L"\"foo:bar\"", AutocompleteInput::QUERY }, | 224 { L"\"foo:bar\"", AutocompleteInput::QUERY }, |
226 { L"link:foo.com", AutocompleteInput::UNKNOWN }, | 225 { L"link:foo.com", AutocompleteInput::UNKNOWN }, |
227 { L"www.foo.com:81", AutocompleteInput::URL }, | 226 { L"www.foo.com:81", AutocompleteInput::URL }, |
228 { L"localhost:8080", AutocompleteInput::URL }, | 227 { L"localhost:8080", AutocompleteInput::URL }, |
229 { L"foo.com:123456", AutocompleteInput::QUERY }, | 228 { L"foo.com:123456", AutocompleteInput::QUERY }, |
230 { L"foo.com:abc", AutocompleteInput::QUERY }, | 229 { L"foo.com:abc", AutocompleteInput::QUERY }, |
| 230 { L"1.2.3.4:abc", AutocompleteInput::QUERY }, |
231 { L"user@foo.com", AutocompleteInput::UNKNOWN }, | 231 { L"user@foo.com", AutocompleteInput::UNKNOWN }, |
232 { L"user:pass@foo.com", AutocompleteInput::UNKNOWN }, | 232 { L"user:pass@foo.com", AutocompleteInput::UNKNOWN }, |
233 { L"1.2", AutocompleteInput::UNKNOWN }, | 233 { L"1.2", AutocompleteInput::UNKNOWN }, |
234 { L"1.2/45", AutocompleteInput::UNKNOWN }, | 234 { L"1.2/45", AutocompleteInput::UNKNOWN }, |
| 235 { L"1.2:45", AutocompleteInput::UNKNOWN }, |
| 236 { L"user@1.2:45", AutocompleteInput::UNKNOWN }, |
| 237 { L"user:foo@1.2:45", AutocompleteInput::UNKNOWN }, |
235 { L"ps/2 games", AutocompleteInput::UNKNOWN }, | 238 { L"ps/2 games", AutocompleteInput::UNKNOWN }, |
236 { L"en.wikipedia.org/wiki/James Bond", AutocompleteInput::URL }, | 239 { L"en.wikipedia.org/wiki/James Bond", AutocompleteInput::URL }, |
237 // In Chrome itself, mailto: will get handled by ShellExecute, but in | 240 // In Chrome itself, mailto: will get handled by ShellExecute, but in |
238 // unittest mode, we don't have the data loaded in the external protocol | 241 // unittest mode, we don't have the data loaded in the external protocol |
239 // handler to know this. | 242 // handler to know this. |
240 // { L"mailto:abuse@foo.com", AutocompleteInput::URL }, | 243 // { L"mailto:abuse@foo.com", AutocompleteInput::URL }, |
241 { L"view-source:http://www.foo.com/", AutocompleteInput::URL }, | 244 { L"view-source:http://www.foo.com/", AutocompleteInput::URL }, |
242 { L"javascript:alert(\"Hey there!\");", AutocompleteInput::URL }, | 245 { L"javascript:alert(\"Hey there!\");", AutocompleteInput::URL }, |
243 #if defined(OS_WIN) | 246 #if defined(OS_WIN) |
244 { L"C:\\Program Files", AutocompleteInput::URL }, | 247 { L"C:\\Program Files", AutocompleteInput::URL }, |
245 { L"\\\\Server\\Folder\\File", AutocompleteInput::URL }, | 248 { L"\\\\Server\\Folder\\File", AutocompleteInput::URL }, |
246 #endif // defined(OS_WIN) | 249 #endif // defined(OS_WIN) |
247 { L"http:foo", AutocompleteInput::URL }, | 250 { L"http:foo", AutocompleteInput::URL }, |
248 { L"http://foo", AutocompleteInput::URL }, | 251 { L"http://foo", AutocompleteInput::URL }, |
249 { L"http://foo.c", AutocompleteInput::URL }, | 252 { L"http://foo.c", AutocompleteInput::URL }, |
250 { L"http://foo.com", AutocompleteInput::URL }, | 253 { L"http://foo.com", AutocompleteInput::URL }, |
251 { L"http://foo_bar.com", AutocompleteInput::URL }, | 254 { L"http://foo_bar.com", AutocompleteInput::URL }, |
| 255 { L"http://foo/bar baz", AutocompleteInput::URL }, |
252 { L"http://-.com", AutocompleteInput::UNKNOWN }, | 256 { L"http://-.com", AutocompleteInput::UNKNOWN }, |
253 { L"http://_foo_.com", AutocompleteInput::UNKNOWN }, | 257 { L"http://_foo_.com", AutocompleteInput::UNKNOWN }, |
254 { L"http://foo.com:abc", AutocompleteInput::QUERY }, | 258 { L"http://foo.com:abc", AutocompleteInput::QUERY }, |
255 { L"http://foo.com:123456", AutocompleteInput::QUERY }, | 259 { L"http://foo.com:123456", AutocompleteInput::QUERY }, |
| 260 { L"http://1.2.3.4:abc", AutocompleteInput::QUERY }, |
256 { L"http:user@foo.com", AutocompleteInput::URL }, | 261 { L"http:user@foo.com", AutocompleteInput::URL }, |
257 { L"http://user@foo.com", AutocompleteInput::URL }, | 262 { L"http://user@foo.com", AutocompleteInput::URL }, |
| 263 { L"http:user:pass@foo.com", AutocompleteInput::URL }, |
258 { L"http://user:pass@foo.com", AutocompleteInput::URL }, | 264 { L"http://user:pass@foo.com", AutocompleteInput::URL }, |
259 { L"http://1.2", AutocompleteInput::URL }, | 265 { L"http://1.2", AutocompleteInput::URL }, |
260 { L"http://1.2/45", AutocompleteInput::URL }, | 266 { L"http://1.2/45", AutocompleteInput::URL }, |
261 { L"http:ps/2 games", AutocompleteInput::URL }, | 267 { L"http:ps/2 games", AutocompleteInput::URL }, |
262 { L"http://ps/2 games", AutocompleteInput::URL }, | 268 { L"http://ps/2 games", AutocompleteInput::URL }, |
| 269 { L"https://foo.com", AutocompleteInput::URL }, |
263 { L"127.0.0.1", AutocompleteInput::URL }, | 270 { L"127.0.0.1", AutocompleteInput::URL }, |
264 { L"127.0.1", AutocompleteInput::UNKNOWN }, | 271 { L"127.0.1", AutocompleteInput::UNKNOWN }, |
265 { L"127.0.1/", AutocompleteInput::UNKNOWN }, | 272 { L"127.0.1/", AutocompleteInput::UNKNOWN }, |
266 { L"browser.tabs.closeButtons", AutocompleteInput::UNKNOWN }, | 273 { L"browser.tabs.closeButtons", AutocompleteInput::UNKNOWN }, |
267 { L"\u6d4b\u8bd5", AutocompleteInput::UNKNOWN }, | 274 { L"\u6d4b\u8bd5", AutocompleteInput::UNKNOWN }, |
268 { L"[2001:]", AutocompleteInput::QUERY }, // Not a valid IP | 275 { L"[2001:]", AutocompleteInput::QUERY }, // Not a valid IP |
269 { L"[2001:dB8::1]", AutocompleteInput::URL }, | 276 { L"[2001:dB8::1]", AutocompleteInput::URL }, |
270 { L"192.168.0.256", AutocompleteInput::QUERY }, // Invalid IPv4 literal. | 277 { L"192.168.0.256", AutocompleteInput::QUERY }, // Invalid IPv4 literal. |
271 { L"[foo.com]", AutocompleteInput::QUERY }, // Invalid IPv6 literal. | 278 { L"[foo.com]", AutocompleteInput::QUERY }, // Invalid IPv6 literal. |
272 }; | 279 }; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 EXPECT_EQ(input_cases[i].scheme.len, scheme.len) << "Input: " << | 375 EXPECT_EQ(input_cases[i].scheme.len, scheme.len) << "Input: " << |
369 input_cases[i].input; | 376 input_cases[i].input; |
370 EXPECT_EQ(input_cases[i].host.begin, host.begin) << "Input: " << | 377 EXPECT_EQ(input_cases[i].host.begin, host.begin) << "Input: " << |
371 input_cases[i].input; | 378 input_cases[i].input; |
372 EXPECT_EQ(input_cases[i].host.len, host.len) << "Input: " << | 379 EXPECT_EQ(input_cases[i].host.len, host.len) << "Input: " << |
373 input_cases[i].input; | 380 input_cases[i].input; |
374 } | 381 } |
375 } | 382 } |
376 | 383 |
377 } // namespace | 384 } // namespace |
OLD | NEW |