OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #include "sync/engine/nudge_tracker.h" | |
6 | |
7 #include "sync/internal_api/public/base/model_type_invalidation_map.h" | |
8 #include "testing/gtest/include/gtest/gtest.h" | |
9 | |
10 namespace syncer { | |
11 | |
12 namespace { | |
13 | |
14 ModelTypeSet ParamsMeaningAllEnabledTypes() { | |
15 ModelTypeSet request_params(BOOKMARKS, AUTOFILL); | |
16 return request_params; | |
17 } | |
18 | |
19 ModelTypeSet ParamsMeaningJustOneEnabledType() { | |
20 return ModelTypeSet(AUTOFILL); | |
21 } | |
22 | |
23 } // namespace | |
24 | |
25 TEST(NudgeTrackerTest, CoalesceSources) { | |
tim (not reviewing)
2013/04/15 22:37:49
Would it be feasible to have a test that demonstra
rlarocque
2013/04/16 01:30:26
Good idea. Done.
| |
26 ModelTypeInvalidationMap one_type = | |
27 ModelTypeSetToInvalidationMap( | |
28 ParamsMeaningJustOneEnabledType(), | |
29 std::string()); | |
30 ModelTypeInvalidationMap all_types = | |
31 ModelTypeSetToInvalidationMap( | |
32 ParamsMeaningAllEnabledTypes(), | |
33 std::string()); | |
34 sessions::SyncSourceInfo source_one( | |
35 sync_pb::GetUpdatesCallerInfo::PERIODIC, one_type); | |
36 sessions::SyncSourceInfo source_two( | |
37 sync_pb::GetUpdatesCallerInfo::LOCAL, all_types); | |
38 | |
39 NudgeTracker tracker; | |
40 EXPECT_TRUE(tracker.IsEmpty()); | |
41 | |
42 tracker.CoalesceSources(source_one); | |
43 EXPECT_EQ(source_one.updates_source, tracker.source_info().updates_source); | |
44 | |
45 tracker.CoalesceSources(source_two); | |
46 EXPECT_EQ(source_two.updates_source, tracker.source_info().updates_source); | |
47 } | |
48 | |
49 } // namespace syncer | |
OLD | NEW |