fake_category_ranker.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_NTP_SNIPPETS_CATEGORY_RANKERS_FAKE_CATEGORY_RANKER_H_
  5. #define COMPONENTS_NTP_SNIPPETS_CATEGORY_RANKERS_FAKE_CATEGORY_RANKER_H_
  6. #include <vector>
  7. #include "base/time/time.h"
  8. #include "components/ntp_snippets/category.h"
  9. #include "components/ntp_snippets/category_rankers/category_ranker.h"
  10. #include "testing/gmock/include/gmock/gmock.h"
  11. namespace ntp_snippets {
  12. class FakeCategoryRanker : public CategoryRanker {
  13. public:
  14. FakeCategoryRanker();
  15. ~FakeCategoryRanker() override;
  16. void SetOrder(const std::vector<Category>& new_order) {
  17. categories_ = new_order;
  18. }
  19. // CategoryRanker implementation.
  20. bool Compare(Category left, Category right) const override;
  21. void ClearHistory(base::Time begin, base::Time end) override;
  22. void AppendCategoryIfNecessary(Category category) override;
  23. void InsertCategoryBeforeIfNecessary(Category category_to_insert,
  24. Category anchor) override;
  25. void InsertCategoryAfterIfNecessary(Category category_to_insert,
  26. Category anchor) override;
  27. std::vector<CategoryRanker::DebugDataItem> GetDebugData() override;
  28. void OnSuggestionOpened(Category category) override;
  29. void OnCategoryDismissed(Category category) override;
  30. private:
  31. std::vector<Category> categories_;
  32. };
  33. } // namespace ntp_snippets
  34. #endif // COMPONENTS_NTP_SNIPPETS_CATEGORY_RANKERS_FAKE_CATEGORY_RANKER_H_