OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "sync/internal_api/public/sessions/sync_source_info.h" | 5 #include "sync/internal_api/public/sessions/sync_source_info.h" |
6 | 6 |
7 #include "base/test/values_test_util.h" | 7 #include "base/test/values_test_util.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "sync/internal_api/public/base/model_type.h" | 9 #include "sync/internal_api/public/base/model_type.h" |
10 #include "sync/internal_api/public/base/model_type_invalidation_map.h" | 10 #include "sync/internal_api/public/base/model_type_invalidation_map.h" |
11 #include "sync/protocol/sync.pb.h" | 11 #include "sync/protocol/sync.pb.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace syncer { | 14 namespace syncer { |
15 namespace sessions { | 15 namespace sessions { |
16 namespace { | 16 namespace { |
17 | 17 |
18 using base::ExpectDictDictionaryValue; | 18 using base::ExpectDictDictionaryValue; |
19 using base::ExpectDictStringValue; | 19 using base::ExpectDictStringValue; |
20 | 20 |
21 class SyncSourceInfoTest : public testing::Test {}; | 21 class SyncSourceInfoTest : public testing::Test {}; |
22 | 22 |
23 TEST_F(SyncSourceInfoTest, SyncSourceInfoToValue) { | 23 TEST_F(SyncSourceInfoTest, SyncSourceInfoToValue) { |
24 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source = | 24 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source = |
25 sync_pb::GetUpdatesCallerInfo::PERIODIC; | 25 sync_pb::GetUpdatesCallerInfo::PERIODIC; |
26 ModelTypeInvalidationMap types; | 26 ModelTypeInvalidationMap types; |
27 types[PREFERENCES].payload = "preferencespayload"; | 27 types[PREFERENCES].payload = "preferencespayload"; |
28 types[EXTENSIONS].payload = ""; | 28 types[EXTENSIONS].payload = ""; |
29 scoped_ptr<DictionaryValue> expected_types_value( | 29 scoped_ptr<base::DictionaryValue> expected_types_value( |
30 ModelTypeInvalidationMapToValue(types)); | 30 ModelTypeInvalidationMapToValue(types)); |
31 | 31 |
32 SyncSourceInfo source_info(updates_source, types); | 32 SyncSourceInfo source_info(updates_source, types); |
33 | 33 |
34 scoped_ptr<DictionaryValue> value(source_info.ToValue()); | 34 scoped_ptr<base::DictionaryValue> value(source_info.ToValue()); |
35 EXPECT_EQ(2u, value->size()); | 35 EXPECT_EQ(2u, value->size()); |
36 ExpectDictStringValue("PERIODIC", *value, "updatesSource"); | 36 ExpectDictStringValue("PERIODIC", *value, "updatesSource"); |
37 ExpectDictDictionaryValue(*expected_types_value, *value, "types"); | 37 ExpectDictDictionaryValue(*expected_types_value, *value, "types"); |
38 } | 38 } |
39 | 39 |
40 } // namespace syncer | 40 } // namespace syncer |
41 } // namespace sessions | 41 } // namespace sessions |
42 } // namespace | 42 } // namespace |
OLD | NEW |