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_session_snapshot.h" | 5 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/test/values_test_util.h" | 8 #include "base/test/values_test_util.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "sync/internal_api/public/sessions/sync_source_info.h" | |
11 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
12 | 11 |
13 namespace syncer { | 12 namespace syncer { |
14 namespace sessions { | 13 namespace sessions { |
15 namespace { | 14 namespace { |
16 | 15 |
17 using base::ExpectDictBooleanValue; | 16 using base::ExpectDictBooleanValue; |
18 using base::ExpectDictDictionaryValue; | 17 using base::ExpectDictDictionaryValue; |
19 using base::ExpectDictIntegerValue; | 18 using base::ExpectDictIntegerValue; |
20 using base::ExpectDictListValue; | 19 using base::ExpectDictListValue; |
(...skipping 16 matching lines...) Expand all Loading... |
37 download_progress_markers[BOOKMARKS] = "test"; | 36 download_progress_markers[BOOKMARKS] = "test"; |
38 download_progress_markers[APPS] = "apps"; | 37 download_progress_markers[APPS] = "apps"; |
39 scoped_ptr<base::DictionaryValue> expected_download_progress_markers_value( | 38 scoped_ptr<base::DictionaryValue> expected_download_progress_markers_value( |
40 ProgressMarkerMapToValue(download_progress_markers)); | 39 ProgressMarkerMapToValue(download_progress_markers)); |
41 | 40 |
42 const bool kIsSilenced = true; | 41 const bool kIsSilenced = true; |
43 const int kNumEncryptionConflicts = 1054; | 42 const int kNumEncryptionConflicts = 1054; |
44 const int kNumHierarchyConflicts = 1055; | 43 const int kNumHierarchyConflicts = 1055; |
45 const int kNumServerConflicts = 1057; | 44 const int kNumServerConflicts = 1057; |
46 | 45 |
47 SyncSourceInfo source; | |
48 scoped_ptr<base::DictionaryValue> expected_source_value(source.ToValue()); | |
49 | |
50 SyncSessionSnapshot snapshot(model_neutral, | 46 SyncSessionSnapshot snapshot(model_neutral, |
51 download_progress_markers, | 47 download_progress_markers, |
52 kIsSilenced, | 48 kIsSilenced, |
53 kNumEncryptionConflicts, | 49 kNumEncryptionConflicts, |
54 kNumHierarchyConflicts, | 50 kNumHierarchyConflicts, |
55 kNumServerConflicts, | 51 kNumServerConflicts, |
56 source, | |
57 false, | 52 false, |
58 0, | 53 0, |
59 base::Time::Now(), | 54 base::Time::Now(), |
60 std::vector<int>(MODEL_TYPE_COUNT,0), | 55 std::vector<int>(MODEL_TYPE_COUNT,0), |
61 std::vector<int>(MODEL_TYPE_COUNT, 0)); | 56 std::vector<int>(MODEL_TYPE_COUNT, 0)); |
62 scoped_ptr<base::DictionaryValue> value(snapshot.ToValue()); | 57 scoped_ptr<base::DictionaryValue> value(snapshot.ToValue()); |
63 EXPECT_EQ(17u, value->size()); | 58 EXPECT_EQ(17u, value->size()); |
64 ExpectDictIntegerValue(model_neutral.num_successful_commits, | 59 ExpectDictIntegerValue(model_neutral.num_successful_commits, |
65 *value, "numSuccessfulCommits"); | 60 *value, "numSuccessfulCommits"); |
66 ExpectDictIntegerValue(model_neutral.num_successful_bookmark_commits, | 61 ExpectDictIntegerValue(model_neutral.num_successful_bookmark_commits, |
(...skipping 12 matching lines...) Expand all Loading... |
79 *value, "numServerChangesRemaining"); | 74 *value, "numServerChangesRemaining"); |
80 ExpectDictDictionaryValue(*expected_download_progress_markers_value, | 75 ExpectDictDictionaryValue(*expected_download_progress_markers_value, |
81 *value, "downloadProgressMarkers"); | 76 *value, "downloadProgressMarkers"); |
82 ExpectDictBooleanValue(kIsSilenced, *value, "isSilenced"); | 77 ExpectDictBooleanValue(kIsSilenced, *value, "isSilenced"); |
83 ExpectDictIntegerValue(kNumEncryptionConflicts, *value, | 78 ExpectDictIntegerValue(kNumEncryptionConflicts, *value, |
84 "numEncryptionConflicts"); | 79 "numEncryptionConflicts"); |
85 ExpectDictIntegerValue(kNumHierarchyConflicts, *value, | 80 ExpectDictIntegerValue(kNumHierarchyConflicts, *value, |
86 "numHierarchyConflicts"); | 81 "numHierarchyConflicts"); |
87 ExpectDictIntegerValue(kNumServerConflicts, *value, | 82 ExpectDictIntegerValue(kNumServerConflicts, *value, |
88 "numServerConflicts"); | 83 "numServerConflicts"); |
89 ExpectDictDictionaryValue(*expected_source_value, *value, "source"); | |
90 ExpectDictBooleanValue(false, *value, "notificationsEnabled"); | 84 ExpectDictBooleanValue(false, *value, "notificationsEnabled"); |
91 } | 85 } |
92 | 86 |
93 } // namespace | 87 } // namespace |
94 } // namespace sessions | 88 } // namespace sessions |
95 } // namespace syncer | 89 } // namespace syncer |
OLD | NEW |