1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
// Copyright (c) 2012 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 "sync/api/sync_merge_result.h"
#include "base/location.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace syncer {
namespace {
typedef testing::Test SyncMergeResultTest;
TEST_F(SyncMergeResultTest, Unset) {
SyncMergeResult merge_result(BOOKMARKS);
EXPECT_FALSE(merge_result.error().IsSet());
EXPECT_EQ(0, merge_result.num_items_before_association());
EXPECT_EQ(0, merge_result.num_items_after_association());
EXPECT_EQ(0, merge_result.num_items_added());
EXPECT_EQ(0, merge_result.num_items_deleted());
EXPECT_EQ(0, merge_result.num_items_modified());
}
TEST_F(SyncMergeResultTest, SetError) {
SyncError error(FROM_HERE, SyncError::DATATYPE_ERROR, "message", BOOKMARKS);
SyncMergeResult merge_result(BOOKMARKS);
merge_result.set_error(error);
EXPECT_TRUE(merge_result.error().IsSet());
EXPECT_EQ(BOOKMARKS, merge_result.model_type());
}
TEST_F(SyncMergeResultTest, SetNumItemsBeforeAssociation) {
SyncMergeResult merge_result(BOOKMARKS);
EXPECT_EQ(0, merge_result.num_items_before_association());
merge_result.set_num_items_before_association(10);
EXPECT_EQ(10, merge_result.num_items_before_association());
}
TEST_F(SyncMergeResultTest, SetNumItemsAfterAssociation) {
SyncMergeResult merge_result(BOOKMARKS);
EXPECT_EQ(0, merge_result.num_items_after_association());
merge_result.set_num_items_after_association(10);
EXPECT_EQ(10, merge_result.num_items_after_association());
}
TEST_F(SyncMergeResultTest, SetNumItemsAdded) {
SyncMergeResult merge_result(BOOKMARKS);
EXPECT_EQ(0, merge_result.num_items_added());
merge_result.set_num_items_added(10);
EXPECT_EQ(10, merge_result.num_items_added());
}
TEST_F(SyncMergeResultTest, SetNumItemsDeleted) {
SyncMergeResult merge_result(BOOKMARKS);
EXPECT_EQ(0, merge_result.num_items_deleted());
merge_result.set_num_items_deleted(10);
EXPECT_EQ(10, merge_result.num_items_deleted());
}
TEST_F(SyncMergeResultTest, SetNumItemsModified) {
SyncMergeResult merge_result(BOOKMARKS);
EXPECT_EQ(0, merge_result.num_items_modified());
merge_result.set_num_items_modified(10);
EXPECT_EQ(10, merge_result.num_items_modified());
}
} // namespace
} // namespace syncer
|