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 "components/omnibox/bookmark_provider.h" | 5 #include "components/omnibox/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 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 }; | 70 }; |
71 | 71 |
72 class BookmarkProviderTest : public testing::Test { | 72 class BookmarkProviderTest : public testing::Test { |
73 public: | 73 public: |
74 BookmarkProviderTest(); | 74 BookmarkProviderTest(); |
75 | 75 |
76 protected: | 76 protected: |
77 void SetUp() override; | 77 void SetUp() override; |
78 | 78 |
79 content::TestBrowserThreadBundle thread_bundle_; | 79 content::TestBrowserThreadBundle thread_bundle_; |
80 bookmarks::TestBookmarkClient bookmark_client_; | |
81 scoped_ptr<TestingProfile> profile_; | 80 scoped_ptr<TestingProfile> profile_; |
82 scoped_ptr<ChromeAutocompleteProviderClient> provider_client_; | 81 scoped_ptr<ChromeAutocompleteProviderClient> provider_client_; |
83 scoped_ptr<BookmarkModel> model_; | 82 scoped_ptr<BookmarkModel> model_; |
84 scoped_refptr<BookmarkProvider> provider_; | 83 scoped_refptr<BookmarkProvider> provider_; |
85 | 84 |
86 private: | 85 private: |
87 DISALLOW_COPY_AND_ASSIGN(BookmarkProviderTest); | 86 DISALLOW_COPY_AND_ASSIGN(BookmarkProviderTest); |
88 }; | 87 }; |
89 | 88 |
90 BookmarkProviderTest::BookmarkProviderTest() { | 89 BookmarkProviderTest::BookmarkProviderTest() { |
91 model_ = bookmark_client_.CreateModel(); | 90 model_ = bookmarks::TestBookmarkClient::CreateModel(); |
92 } | 91 } |
93 | 92 |
94 void BookmarkProviderTest::SetUp() { | 93 void BookmarkProviderTest::SetUp() { |
95 profile_.reset(new TestingProfile()); | 94 profile_.reset(new TestingProfile()); |
96 DCHECK(profile_.get()); | 95 DCHECK(profile_.get()); |
97 provider_client_.reset(new ChromeAutocompleteProviderClient(profile_.get())); | 96 provider_client_.reset(new ChromeAutocompleteProviderClient(profile_.get())); |
98 provider_ = new BookmarkProvider(provider_client_.get()); | 97 provider_ = new BookmarkProvider(provider_client_.get()); |
99 DCHECK(provider_.get()); | 98 DCHECK(provider_.get()); |
100 provider_->set_bookmark_model_for_testing(model_.get()); | 99 provider_->set_bookmark_model_for_testing(model_.get()); |
101 | 100 |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 } | 480 } |
482 | 481 |
483 TEST_F(BookmarkProviderTest, DoesNotProvideMatchesOnFocus) { | 482 TEST_F(BookmarkProviderTest, DoesNotProvideMatchesOnFocus) { |
484 AutocompleteInput input( | 483 AutocompleteInput input( |
485 base::ASCIIToUTF16("foo"), base::string16::npos, std::string(), GURL(), | 484 base::ASCIIToUTF16("foo"), base::string16::npos, std::string(), GURL(), |
486 metrics::OmniboxEventProto::INVALID_SPEC, false, false, false, true, true, | 485 metrics::OmniboxEventProto::INVALID_SPEC, false, false, false, true, true, |
487 ChromeAutocompleteSchemeClassifier(profile_.get())); | 486 ChromeAutocompleteSchemeClassifier(profile_.get())); |
488 provider_->Start(input, false); | 487 provider_->Start(input, false); |
489 EXPECT_TRUE(provider_->matches().empty()); | 488 EXPECT_TRUE(provider_->matches().empty()); |
490 } | 489 } |
OLD | NEW |