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

Side by Side Diff: components/ntp_snippets/content_suggestions_service_unittest.cc

Issue 2207493002: Add CategoryInfo for meta information of content suggestions Categories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ntp_snippets/content_suggestions_service.h" 5 #include "components/ntp_snippets/content_suggestions_service.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/utf_string_conversions.h"
15 #include "components/ntp_snippets/category_info.h"
14 #include "components/ntp_snippets/category_status.h" 16 #include "components/ntp_snippets/category_status.h"
15 #include "components/ntp_snippets/content_suggestion.h" 17 #include "components/ntp_snippets/content_suggestion.h"
16 #include "components/ntp_snippets/content_suggestions_provider.h" 18 #include "components/ntp_snippets/content_suggestions_provider.h"
17 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
19 #include "ui/gfx/image/image.h" 21 #include "ui/gfx/image/image.h"
20 22
21 using testing::Eq; 23 using testing::Eq;
22 using testing::IsNull; 24 using testing::IsNull;
23 using testing::NotNull; 25 using testing::NotNull;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 63 }
62 64
63 std::vector<Category> GetProvidedCategories() override { 65 std::vector<Category> GetProvidedCategories() override {
64 return provided_categories_; 66 return provided_categories_;
65 } 67 }
66 68
67 CategoryStatus GetCategoryStatus(Category category) { 69 CategoryStatus GetCategoryStatus(Category category) {
68 return statuses_[category.id()]; 70 return statuses_[category.id()];
69 } 71 }
70 72
73 CategoryInfo GetCategoryInfo(Category category) {
74 return CategoryInfo(base::ASCIIToUTF16("Section title"));
75 }
76
71 void FireSuggestionsChanged(Category category, std::vector<int> numbers) { 77 void FireSuggestionsChanged(Category category, std::vector<int> numbers) {
72 observer()->OnNewSuggestions(this, category, CreateSuggestions(numbers)); 78 observer()->OnNewSuggestions(this, category, CreateSuggestions(numbers));
73 } 79 }
74 80
75 void FireCategoryStatusChanged(Category category, CategoryStatus new_status) { 81 void FireCategoryStatusChanged(Category category, CategoryStatus new_status) {
76 statuses_[category.id()] = new_status; 82 statuses_[category.id()] = new_status;
77 observer()->OnCategoryStatusChanged(this, category, new_status); 83 observer()->OnCategoryStatusChanged(this, category, new_status);
78 } 84 }
79 85
80 MOCK_METHOD0(ClearCachedSuggestionsForDebugging, void()); 86 MOCK_METHOD0(ClearCachedSuggestionsForDebugging, void());
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 Mock::VerifyAndClearExpectations(&observer); 347 Mock::VerifyAndClearExpectations(&observer);
342 348
343 // Shutdown the service 349 // Shutdown the service
344 EXPECT_CALL(observer, ContentSuggestionsServiceShutdown()); 350 EXPECT_CALL(observer, ContentSuggestionsServiceShutdown());
345 service()->Shutdown(); 351 service()->Shutdown();
346 service()->RemoveObserver(&observer); 352 service()->RemoveObserver(&observer);
347 // The service will receive two Shutdown() calls. 353 // The service will receive two Shutdown() calls.
348 } 354 }
349 355
350 } // namespace ntp_snippets 356 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698