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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_unittest.cc

Issue 7811006: Add full support for filesystem URLs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed code review feedback. Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/bind.h" 5 #include "base/bind.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 { ASCIIToUTF16("https://foo.com"), AutocompleteInput::URL }, 366 { ASCIIToUTF16("https://foo.com"), AutocompleteInput::URL },
367 { ASCIIToUTF16("127.0.0.1"), AutocompleteInput::URL }, 367 { ASCIIToUTF16("127.0.0.1"), AutocompleteInput::URL },
368 { ASCIIToUTF16("127.0.1"), AutocompleteInput::UNKNOWN }, 368 { ASCIIToUTF16("127.0.1"), AutocompleteInput::UNKNOWN },
369 { ASCIIToUTF16("127.0.1/"), AutocompleteInput::URL }, 369 { ASCIIToUTF16("127.0.1/"), AutocompleteInput::URL },
370 { ASCIIToUTF16("browser.tabs.closeButtons"), AutocompleteInput::UNKNOWN }, 370 { ASCIIToUTF16("browser.tabs.closeButtons"), AutocompleteInput::UNKNOWN },
371 { WideToUTF16(L"\u6d4b\u8bd5"), AutocompleteInput::UNKNOWN }, 371 { WideToUTF16(L"\u6d4b\u8bd5"), AutocompleteInput::UNKNOWN },
372 { ASCIIToUTF16("[2001:]"), AutocompleteInput::QUERY }, 372 { ASCIIToUTF16("[2001:]"), AutocompleteInput::QUERY },
373 { ASCIIToUTF16("[2001:dB8::1]"), AutocompleteInput::URL }, 373 { ASCIIToUTF16("[2001:dB8::1]"), AutocompleteInput::URL },
374 { ASCIIToUTF16("192.168.0.256"), AutocompleteInput::QUERY }, 374 { ASCIIToUTF16("192.168.0.256"), AutocompleteInput::QUERY },
375 { ASCIIToUTF16("[foo.com]"), AutocompleteInput::QUERY }, 375 { ASCIIToUTF16("[foo.com]"), AutocompleteInput::QUERY },
376 { ASCIIToUTF16("filesystem:http://a.com/t/bar"), AutocompleteInput::URL },
377 { ASCIIToUTF16("filesystem:http:foo"), AutocompleteInput::URL },
378 { ASCIIToUTF16("filesystem:file://"), AutocompleteInput::URL },
379 { ASCIIToUTF16("filesystem:http"), AutocompleteInput::URL },
380 { ASCIIToUTF16("filesystem:"), AutocompleteInput::URL },
381 { ASCIIToUTF16("ftp:"), AutocompleteInput::URL },
376 }; 382 };
377 383
378 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input_cases); ++i) { 384 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input_cases); ++i) {
379 SCOPED_TRACE(input_cases[i].input); 385 SCOPED_TRACE(input_cases[i].input);
386 SCOPED_TRACE(i);
ericu 2012/02/16 01:42:56 This was debugging code I accidentally uploaded.
380 AutocompleteInput input(input_cases[i].input, string16(), true, false, 387 AutocompleteInput input(input_cases[i].input, string16(), true, false,
381 true, AutocompleteInput::ALL_MATCHES); 388 true, AutocompleteInput::ALL_MATCHES);
382 EXPECT_EQ(input_cases[i].type, input.type()); 389 EXPECT_EQ(input_cases[i].type, input.type());
383 } 390 }
384 } 391 }
385 392
386 TEST_F(AutocompleteTest, InputTypeWithDesiredTLD) { 393 TEST_F(AutocompleteTest, InputTypeWithDesiredTLD) {
387 struct test_data { 394 struct test_data {
388 const string16 input; 395 const string16 input;
389 const AutocompleteInput::Type type; 396 const AutocompleteInput::Type type;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 AutocompleteInput input(input_cases[i].input, string16(), true, false, 486 AutocompleteInput input(input_cases[i].input, string16(), true, false,
480 true, AutocompleteInput::ALL_MATCHES); 487 true, AutocompleteInput::ALL_MATCHES);
481 EXPECT_EQ(input_cases[i].scheme.begin, scheme.begin); 488 EXPECT_EQ(input_cases[i].scheme.begin, scheme.begin);
482 EXPECT_EQ(input_cases[i].scheme.len, scheme.len); 489 EXPECT_EQ(input_cases[i].scheme.len, scheme.len);
483 EXPECT_EQ(input_cases[i].host.begin, host.begin); 490 EXPECT_EQ(input_cases[i].host.begin, host.begin);
484 EXPECT_EQ(input_cases[i].host.len, host.len); 491 EXPECT_EQ(input_cases[i].host.len, host.len);
485 } 492 }
486 } 493 }
487 494
488 } // namespace 495 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698