Index: components/ntp_snippets/category_rankers/fake_category_ranker.cc |
diff --git a/components/ntp_snippets/category_rankers/fake_category_ranker.cc b/components/ntp_snippets/category_rankers/fake_category_ranker.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c43610935a79b3b626cd9ebfcaee31f1327b1a66 |
--- /dev/null |
+++ b/components/ntp_snippets/category_rankers/fake_category_ranker.cc |
@@ -0,0 +1,37 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "components/ntp_snippets/category_rankers/fake_category_ranker.h" |
+ |
+#include <algorithm> |
+ |
+#include "base/stl_util.h" |
+ |
+namespace ntp_snippets { |
+ |
+FakeCategoryRanker::FakeCategoryRanker() = default; |
+ |
+FakeCategoryRanker::~FakeCategoryRanker() = default; |
+ |
+bool FakeCategoryRanker::Compare(Category left, Category right) const { |
+ DCHECK(base::ContainsValue(categories_, left)); |
+ DCHECK(base::ContainsValue(categories_, right)); |
+ |
+ return std::find(categories_.begin(), categories_.end(), left) < |
+ std::find(categories_.begin(), categories_.end(), right); |
+} |
+ |
+void FakeCategoryRanker::ClearHistory(base::Time begin, base::Time end) { |
+ // Ignored. |
+} |
+ |
+void FakeCategoryRanker::AppendCategoryIfNecessary(Category category) { |
+ // Ignored. |
+} |
+ |
+void FakeCategoryRanker::OnSuggestionOpened(Category category) { |
+ // Ignored. |
+} |
+ |
+} // namespace ntp_snippets |