[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / sync / api / sync_merge_result_unittest.cc
blobb3f692764cf13e838614eff37f92e1961c27afbd
1 // Copyright (c) 2012 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 "sync/api/sync_merge_result.h"
7 #include "base/location.h"
8 #include "testing/gtest/include/gtest/gtest.h"
10 namespace syncer {
12 namespace {
14 typedef testing::Test SyncMergeResultTest;
16 TEST_F(SyncMergeResultTest, Unset) {
17 SyncMergeResult merge_result(BOOKMARKS);
18 EXPECT_FALSE(merge_result.error().IsSet());
19 EXPECT_EQ(0, merge_result.num_items_before_association());
20 EXPECT_EQ(0, merge_result.num_items_after_association());
21 EXPECT_EQ(0, merge_result.num_items_added());
22 EXPECT_EQ(0, merge_result.num_items_deleted());
23 EXPECT_EQ(0, merge_result.num_items_modified());
26 TEST_F(SyncMergeResultTest, SetError) {
27 SyncError error(FROM_HERE, SyncError::DATATYPE_ERROR, "message", BOOKMARKS);
28 SyncMergeResult merge_result(BOOKMARKS);
30 merge_result.set_error(error);
31 EXPECT_TRUE(merge_result.error().IsSet());
32 EXPECT_EQ(BOOKMARKS, merge_result.model_type());
35 TEST_F(SyncMergeResultTest, SetNumItemsBeforeAssociation) {
36 SyncMergeResult merge_result(BOOKMARKS);
37 EXPECT_EQ(0, merge_result.num_items_before_association());
39 merge_result.set_num_items_before_association(10);
40 EXPECT_EQ(10, merge_result.num_items_before_association());
43 TEST_F(SyncMergeResultTest, SetNumItemsAfterAssociation) {
44 SyncMergeResult merge_result(BOOKMARKS);
45 EXPECT_EQ(0, merge_result.num_items_after_association());
47 merge_result.set_num_items_after_association(10);
48 EXPECT_EQ(10, merge_result.num_items_after_association());
51 TEST_F(SyncMergeResultTest, SetNumItemsAdded) {
52 SyncMergeResult merge_result(BOOKMARKS);
53 EXPECT_EQ(0, merge_result.num_items_added());
55 merge_result.set_num_items_added(10);
56 EXPECT_EQ(10, merge_result.num_items_added());
59 TEST_F(SyncMergeResultTest, SetNumItemsDeleted) {
60 SyncMergeResult merge_result(BOOKMARKS);
61 EXPECT_EQ(0, merge_result.num_items_deleted());
63 merge_result.set_num_items_deleted(10);
64 EXPECT_EQ(10, merge_result.num_items_deleted());
67 TEST_F(SyncMergeResultTest, SetNumItemsModified) {
68 SyncMergeResult merge_result(BOOKMARKS);
69 EXPECT_EQ(0, merge_result.num_items_modified());
71 merge_result.set_num_items_modified(10);
72 EXPECT_EQ(10, merge_result.num_items_modified());
75 } // namespace
77 } // namespace syncer