Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / components / dom_distiller / core / article_entry_unittest.cc
bloba857cafef502179b9773716eecf26a547572309d
1 // Copyright 2013 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.
5 #include "components/dom_distiller/core/article_entry.h"
7 #include "sync/protocol/sync.pb.h"
8 #include "testing/gtest/include/gtest/gtest.h"
10 using sync_pb::EntitySpecifics;
11 using sync_pb::ArticlePage;
12 using sync_pb::ArticleSpecifics;
13 using testing::AssertionResult;
14 using testing::AssertionSuccess;
15 using testing::AssertionFailure;
17 namespace dom_distiller {
19 TEST(DomDistillerArticleEntryTest, TestIsEntryValid) {
20 ArticleEntry entry;
21 EXPECT_FALSE(IsEntryValid(entry));
22 entry.set_entry_id("entry0");
23 EXPECT_TRUE(IsEntryValid(entry));
24 ArticleEntryPage* page0 = entry.add_pages();
25 EXPECT_FALSE(IsEntryValid(entry));
26 page0->set_url("example.com/1");
27 EXPECT_TRUE(IsEntryValid(entry));
30 TEST(DomDistillerArticleEntryTest, TestAreEntriesEqual) {
31 ArticleEntry left;
32 ArticleEntry right;
33 left.set_entry_id("entry0");
34 right.set_entry_id("entry1");
35 EXPECT_FALSE(AreEntriesEqual(left, right));
36 right = left;
37 EXPECT_TRUE(AreEntriesEqual(left, right));
39 left.set_title("a title");
40 EXPECT_FALSE(AreEntriesEqual(left, right));
41 right.set_title("a different title");
42 EXPECT_FALSE(AreEntriesEqual(left, right));
43 right.set_title("a title");
44 EXPECT_TRUE(AreEntriesEqual(left, right));
46 ArticleEntryPage left_page;
47 left_page.set_url("example.com/1");
48 *left.add_pages() = left_page;
50 EXPECT_FALSE(AreEntriesEqual(left, right));
52 ArticleEntryPage right_page;
53 right_page.set_url("foo.example.com/1");
54 *right.add_pages() = right_page;
55 EXPECT_FALSE(AreEntriesEqual(left, right));
57 right = left;
58 EXPECT_TRUE(AreEntriesEqual(left, right));
60 *right.add_pages() = right_page;
61 EXPECT_FALSE(AreEntriesEqual(left, right));
64 } // namespace dom_distiller