OLD | NEW |
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/category_rankers/click_based_category_ranker.h
" | 5 #include "components/ntp_snippets/category_rankers/click_based_category_ranker.h
" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 ranker()->OnSuggestionOpened(category); | 77 ranker()->OnSuggestionOpened(category); |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 void NotifyOnCategoryDismissed(Category category) { | 81 void NotifyOnCategoryDismissed(Category category) { |
82 ranker()->OnCategoryDismissed(category); | 82 ranker()->OnCategoryDismissed(category); |
83 } | 83 } |
84 | 84 |
85 void SetDismissedCategoryPenaltyVariationParam(int value) { | 85 void SetDismissedCategoryPenaltyVariationParam(int value) { |
86 variation_params_manager_.SetVariationParamsWithFeatureAssociations( | 86 variation_params_manager_.SetVariationParamsWithFeatureAssociations( |
87 ntp_snippets::kStudyName, | 87 kCategoryRanker.name, |
88 {{"click_based_category_ranker-dismissed_category_penalty", | 88 {{"click_based_category_ranker-dismissed_category_penalty", |
89 base::IntToString(value)}}, | 89 base::IntToString(value)}}, |
90 {kCategoryRanker.name}); | 90 {kCategoryRanker.name}); |
91 } | 91 } |
92 | 92 |
93 void SetPromotedCategoryVariationParam(int value) { | 93 void SetPromotedCategoryVariationParam(int value) { |
94 variation_params_manager_.SetVariationParamsWithFeatureAssociations( | 94 variation_params_manager_.SetVariationParamsWithFeatureAssociations( |
95 ntp_snippets::kStudyName, | 95 kCategoryRanker.name, |
96 {{"click_based_category_ranker-promoted_category", | 96 {{"click_based_category_ranker-promoted_category", |
97 base::IntToString(value)}}, | 97 base::IntToString(value)}}, |
98 {kCategoryRanker.name}); | 98 {kCategoryRanker.name}); |
99 } | 99 } |
100 | 100 |
101 ClickBasedCategoryRanker* ranker() { return ranker_.get(); } | 101 ClickBasedCategoryRanker* ranker() { return ranker_.get(); } |
102 | 102 |
103 private: | 103 private: |
104 std::unique_ptr<TestingPrefServiceSimple> pref_service_; | 104 std::unique_ptr<TestingPrefServiceSimple> pref_service_; |
105 int unused_remote_category_id_; | 105 int unused_remote_category_id_; |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 SetPromotedCategoryVariationParam(second.id()); | 740 SetPromotedCategoryVariationParam(second.id()); |
741 ResetRanker(base::MakeUnique<base::DefaultClock>()); | 741 ResetRanker(base::MakeUnique<base::DefaultClock>()); |
742 | 742 |
743 ASSERT_FALSE(CompareCategories(first, second)); | 743 ASSERT_FALSE(CompareCategories(first, second)); |
744 | 744 |
745 EXPECT_THAT(histogram_tester.GetAllSamples(kHistogramMovedUpCategoryNewIndex), | 745 EXPECT_THAT(histogram_tester.GetAllSamples(kHistogramMovedUpCategoryNewIndex), |
746 IsEmpty()); | 746 IsEmpty()); |
747 } | 747 } |
748 | 748 |
749 } // namespace ntp_snippets | 749 } // namespace ntp_snippets |
OLD | NEW |