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/internal_api/public/sessions/sync_source_info.h" | |
6 | |
7 #include "base/test/values_test_util.h" | |
8 #include "base/values.h" | |
9 #include "sync/internal_api/public/base/model_type.h" | |
10 #include "sync/internal_api/public/base/model_type_invalidation_map.h" | |
11 #include "sync/protocol/sync.pb.h" | |
12 #include "testing/gtest/include/gtest/gtest.h" | |
13 | |
14 namespace syncer { | |
15 namespace sessions { | |
16 namespace { | |
17 | |
18 using base::ExpectDictDictionaryValue; | |
19 using base::ExpectDictStringValue; | |
20 | |
21 class SyncSourceInfoTest : public testing::Test {}; | |
22 | |
23 TEST_F(SyncSourceInfoTest, SyncSourceInfoToValue) { | |
24 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source = | |
25 sync_pb::GetUpdatesCallerInfo::PERIODIC; | |
26 ModelTypeInvalidationMap types; | |
27 types[PREFERENCES].payload = "preferencespayload"; | |
28 types[EXTENSIONS].payload = ""; | |
29 scoped_ptr<base::DictionaryValue> expected_types_value( | |
30 ModelTypeInvalidationMapToValue(types)); | |
31 | |
32 SyncSourceInfo source_info(updates_source, types); | |
33 | |
34 scoped_ptr<base::DictionaryValue> value(source_info.ToValue()); | |
35 EXPECT_EQ(2u, value->size()); | |
36 ExpectDictStringValue("PERIODIC", *value, "updatesSource"); | |
37 ExpectDictDictionaryValue(*expected_types_value, *value, "types"); | |
38 } | |
39 | |
40 } // namespace syncer | |
41 } // namespace sessions | |
42 } // namespace | |
OLD | NEW |