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

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

Issue 2568033005: [NTP::SectionOrder] Replace CategoryFactory with a category ranker. (Closed)
Patch Set: rebase. Created 4 years 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
(Empty)
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
5 #include "components/ntp_snippets/category.h"
6
7 #include "testing/gmock/include/gmock/gmock.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace ntp_snippets {
11
12 TEST(CategoryTest, FromKnownCategoryShouldReturnSameCategoryForSameInput) {
13 const KnownCategories known_category = KnownCategories::BOOKMARKS;
14 Category first = Category::FromKnownCategory(known_category);
15 Category second = Category::FromKnownCategory(known_category);
16 EXPECT_EQ(first, second);
17 }
18
19 TEST(CategoryFactoryTest,
20 FromRemoteCategoryShouldReturnSameCategoryForSameInput) {
21 const int remote_category_id = 123;
22 Category first = Category::FromRemoteCategory(remote_category_id);
23 Category second = Category::FromRemoteCategory(remote_category_id);
24 EXPECT_EQ(first, second);
25 }
26
27 TEST(CategoryFactoryTest, FromIDValueShouldReturnSameKnownCategory) {
28 Category known_category =
29 Category::FromKnownCategory(KnownCategories::BOOKMARKS);
30 Category known_category_by_id = Category::FromIDValue(known_category.id());
31 EXPECT_EQ(known_category, known_category_by_id);
32 }
33
34 TEST(CategoryFactoryTest, FromIDValueShouldReturnSameRemoteCategory) {
35 const int remote_category_id = 123;
36 Category remote_category = Category::FromRemoteCategory(remote_category_id);
37 Category remote_category_by_id = Category::FromIDValue(remote_category.id());
38 EXPECT_EQ(remote_category, remote_category_by_id);
39 }
40
41 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698