| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/autocomplete/bookmark_provider.h" | 5 #include "chrome/browser/autocomplete/bookmark_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" | 17 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" |
| 18 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
| 19 #include "components/bookmarks/browser/bookmark_match.h" | 19 #include "components/bookmarks/browser/bookmark_match.h" |
| 20 #include "components/bookmarks/browser/bookmark_model.h" | 20 #include "components/bookmarks/browser/bookmark_model.h" |
| 21 #include "components/bookmarks/test/test_bookmark_client.h" | 21 #include "components/bookmarks/test/test_bookmark_client.h" |
| 22 #include "components/metrics/proto/omnibox_event.pb.h" | 22 #include "components/metrics/proto/omnibox_event.pb.h" |
| 23 #include "components/omnibox/autocomplete_provider.h" | 23 #include "components/omnibox/autocomplete_provider.h" |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 25 | 25 |
| 26 using bookmarks::BookmarkMatch; | 26 using bookmarks::BookmarkMatch; |
| 27 using bookmarks::BookmarkModel; | 27 using bookmarks::BookmarkModel; |
| 28 using bookmarks::BookmarkNode; |
| 28 | 29 |
| 29 // The bookmark corpus against which we will simulate searches. | 30 // The bookmark corpus against which we will simulate searches. |
| 30 struct BookmarksTestInfo { | 31 struct BookmarksTestInfo { |
| 31 std::string title; | 32 std::string title; |
| 32 std::string url; | 33 std::string url; |
| 33 } bookmark_provider_test_data[] = { | 34 } bookmark_provider_test_data[] = { |
| 34 { "abc def", "http://www.catsanddogs.com/a" }, | 35 { "abc def", "http://www.catsanddogs.com/a" }, |
| 35 { "abcde", "http://www.catsanddogs.com/b" }, | 36 { "abcde", "http://www.catsanddogs.com/b" }, |
| 36 { "abcdef", "http://www.catsanddogs.com/c" }, | 37 { "abcdef", "http://www.catsanddogs.com/c" }, |
| 37 { "carry carbon carefully", "http://www.catsanddogs.com/d" }, | 38 { "carry carbon carefully", "http://www.catsanddogs.com/d" }, |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 | 477 |
| 477 TEST_F(BookmarkProviderTest, DoesNotProvideMatchesOnFocus) { | 478 TEST_F(BookmarkProviderTest, DoesNotProvideMatchesOnFocus) { |
| 478 AutocompleteInput input(base::ASCIIToUTF16("foo"), | 479 AutocompleteInput input(base::ASCIIToUTF16("foo"), |
| 479 base::string16::npos, std::string(), GURL(), | 480 base::string16::npos, std::string(), GURL(), |
| 480 metrics::OmniboxEventProto::INVALID_SPEC, false, | 481 metrics::OmniboxEventProto::INVALID_SPEC, false, |
| 481 false, false, true, | 482 false, false, true, |
| 482 ChromeAutocompleteSchemeClassifier(profile_.get())); | 483 ChromeAutocompleteSchemeClassifier(profile_.get())); |
| 483 provider_->Start(input, false, true); | 484 provider_->Start(input, false, true); |
| 484 EXPECT_TRUE(provider_->matches().empty()); | 485 EXPECT_TRUE(provider_->matches().empty()); |
| 485 } | 486 } |
| OLD | NEW |