OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <memory> | 5 #include <memory> |
6 | 6 |
7 #import <CoreSpotlight/CoreSpotlight.h> | 7 #import <CoreSpotlight/CoreSpotlight.h> |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 | 9 |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 protected: | 66 protected: |
67 SpotlightManagerTest() { | 67 SpotlightManagerTest() { |
68 model_ = bookmarks::TestBookmarkClient::CreateModel(); | 68 model_ = bookmarks::TestBookmarkClient::CreateModel(); |
69 large_icon_service_.reset(new favicon::LargeIconService( | 69 large_icon_service_.reset(new favicon::LargeIconService( |
70 &mock_favicon_service_, base::ThreadTaskRunnerHandle::Get(), | 70 &mock_favicon_service_, base::ThreadTaskRunnerHandle::Get(), |
71 /*image_fetcher=*/nullptr)); | 71 /*image_fetcher=*/nullptr)); |
72 bookmarksSpotlightManager_ = [[BookmarksSpotlightManager alloc] | 72 bookmarksSpotlightManager_ = [[BookmarksSpotlightManager alloc] |
73 initWithLargeIconService:large_icon_service_.get() | 73 initWithLargeIconService:large_icon_service_.get() |
74 bookmarkModel:model_.get()]; | 74 bookmarkModel:model_.get()]; |
75 | 75 |
76 EXPECT_CALL(mock_favicon_service_, | 76 EXPECT_CALL(mock_favicon_service_, GetLargestRawFaviconForPageURL(_, _, _)) |
77 GetLargestRawFaviconForPageURL(_, _, _, _, _)) | 77 .WillRepeatedly(PostReply<3>(CreateTestBitmap(24, 24))); |
78 .WillRepeatedly(PostReply<5>(CreateTestBitmap(24, 24))); | |
79 } | 78 } |
80 | 79 |
81 base::MessageLoop loop_; | 80 base::MessageLoop loop_; |
82 testing::StrictMock<favicon::MockFaviconService> mock_favicon_service_; | 81 testing::StrictMock<favicon::MockFaviconService> mock_favicon_service_; |
83 std::unique_ptr<favicon::LargeIconService> large_icon_service_; | 82 std::unique_ptr<favicon::LargeIconService> large_icon_service_; |
84 base::CancelableTaskTracker cancelable_task_tracker_; | 83 base::CancelableTaskTracker cancelable_task_tracker_; |
85 std::unique_ptr<bookmarks::BookmarkModel> model_; | 84 std::unique_ptr<bookmarks::BookmarkModel> model_; |
86 BookmarksSpotlightManager* bookmarksSpotlightManager_; | 85 BookmarksSpotlightManager* bookmarksSpotlightManager_; |
87 }; | 86 }; |
88 | 87 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 NSSet* spotlightManagerKeywords = | 166 NSSet* spotlightManagerKeywords = |
168 [NSSet setWithArray:[[item attributeSet] keywords]]; | 167 [NSSet setWithArray:[[item attributeSet] keywords]]; |
169 EXPECT_TRUE([spotlightManagerKeywords count] > 0); | 168 EXPECT_TRUE([spotlightManagerKeywords count] > 0); |
170 // Check static/hardcoded keywords exist | 169 // Check static/hardcoded keywords exist |
171 NSSet* hardCodedKeywordsSet = | 170 NSSet* hardCodedKeywordsSet = |
172 [NSSet setWithArray:ios::GetChromeBrowserProvider() | 171 [NSSet setWithArray:ios::GetChromeBrowserProvider() |
173 ->GetSpotlightProvider() | 172 ->GetSpotlightProvider() |
174 ->GetAdditionalKeywords()]; | 173 ->GetAdditionalKeywords()]; |
175 EXPECT_TRUE([hardCodedKeywordsSet isSubsetOfSet:spotlightManagerKeywords]); | 174 EXPECT_TRUE([hardCodedKeywordsSet isSubsetOfSet:spotlightManagerKeywords]); |
176 } | 175 } |
OLD | NEW |