Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: sync/sessions/session_state_unittest.cc

Issue 10696087: [Sync] Move ModelType and related classes to 'syncer' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort headers, update copyrights Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/sessions/ordered_commit_set_unittest.cc ('k') | sync/sessions/status_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/sessions/session_state.h" 5 #include "sync/sessions/session_state.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 12 matching lines...) Expand all
23 using base::ExpectDictDictionaryValue; 23 using base::ExpectDictDictionaryValue;
24 using base::ExpectDictIntegerValue; 24 using base::ExpectDictIntegerValue;
25 using base::ExpectDictListValue; 25 using base::ExpectDictListValue;
26 using base::ExpectDictStringValue; 26 using base::ExpectDictStringValue;
27 27
28 class SessionStateTest : public testing::Test {}; 28 class SessionStateTest : public testing::Test {};
29 29
30 TEST_F(SessionStateTest, SyncSourceInfoToValue) { 30 TEST_F(SessionStateTest, SyncSourceInfoToValue) {
31 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source = 31 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source =
32 sync_pb::GetUpdatesCallerInfo::PERIODIC; 32 sync_pb::GetUpdatesCallerInfo::PERIODIC;
33 syncable::ModelTypePayloadMap types; 33 syncer::ModelTypePayloadMap types;
34 types[syncable::PREFERENCES] = "preferencespayload"; 34 types[syncer::PREFERENCES] = "preferencespayload";
35 types[syncable::EXTENSIONS] = ""; 35 types[syncer::EXTENSIONS] = "";
36 scoped_ptr<DictionaryValue> expected_types_value( 36 scoped_ptr<DictionaryValue> expected_types_value(
37 syncable::ModelTypePayloadMapToValue(types)); 37 syncer::ModelTypePayloadMapToValue(types));
38 38
39 SyncSourceInfo source_info(updates_source, types); 39 SyncSourceInfo source_info(updates_source, types);
40 40
41 scoped_ptr<DictionaryValue> value(source_info.ToValue()); 41 scoped_ptr<DictionaryValue> value(source_info.ToValue());
42 EXPECT_EQ(2u, value->size()); 42 EXPECT_EQ(2u, value->size());
43 ExpectDictStringValue("PERIODIC", *value, "updatesSource"); 43 ExpectDictStringValue("PERIODIC", *value, "updatesSource");
44 ExpectDictDictionaryValue(*expected_types_value, *value, "types"); 44 ExpectDictDictionaryValue(*expected_types_value, *value, "types");
45 } 45 }
46 46
47 TEST_F(SessionStateTest, SyncSessionSnapshotToValue) { 47 TEST_F(SessionStateTest, SyncSessionSnapshotToValue) {
48 ModelNeutralState model_neutral; 48 ModelNeutralState model_neutral;
49 model_neutral.num_server_changes_remaining = 105; 49 model_neutral.num_server_changes_remaining = 105;
50 model_neutral.num_successful_commits = 5; 50 model_neutral.num_successful_commits = 5;
51 model_neutral.num_successful_bookmark_commits = 10; 51 model_neutral.num_successful_bookmark_commits = 10;
52 model_neutral.num_updates_downloaded_total = 100; 52 model_neutral.num_updates_downloaded_total = 100;
53 model_neutral.num_tombstone_updates_downloaded_total = 200; 53 model_neutral.num_tombstone_updates_downloaded_total = 200;
54 model_neutral.num_reflected_updates_downloaded_total = 50; 54 model_neutral.num_reflected_updates_downloaded_total = 50;
55 model_neutral.num_local_overwrites = 15; 55 model_neutral.num_local_overwrites = 15;
56 model_neutral.num_server_overwrites = 18; 56 model_neutral.num_server_overwrites = 18;
57 57
58 const bool kIsShareUsable = true; 58 const bool kIsShareUsable = true;
59 59
60 const syncable::ModelTypeSet initial_sync_ended( 60 const syncer::ModelTypeSet initial_sync_ended(
61 syncable::BOOKMARKS, syncable::PREFERENCES); 61 syncer::BOOKMARKS, syncer::PREFERENCES);
62 scoped_ptr<ListValue> expected_initial_sync_ended_value( 62 scoped_ptr<ListValue> expected_initial_sync_ended_value(
63 syncable::ModelTypeSetToValue(initial_sync_ended)); 63 syncer::ModelTypeSetToValue(initial_sync_ended));
64 64
65 syncable::ModelTypePayloadMap download_progress_markers; 65 syncer::ModelTypePayloadMap download_progress_markers;
66 download_progress_markers[syncable::BOOKMARKS] = "test"; 66 download_progress_markers[syncer::BOOKMARKS] = "test";
67 download_progress_markers[syncable::APPS] = "apps"; 67 download_progress_markers[syncer::APPS] = "apps";
68 scoped_ptr<DictionaryValue> expected_download_progress_markers_value( 68 scoped_ptr<DictionaryValue> expected_download_progress_markers_value(
69 syncable::ModelTypePayloadMapToValue(download_progress_markers)); 69 syncer::ModelTypePayloadMapToValue(download_progress_markers));
70 70
71 const bool kHasMoreToSync = false; 71 const bool kHasMoreToSync = false;
72 const bool kIsSilenced = true; 72 const bool kIsSilenced = true;
73 const int kNumEncryptionConflicts = 1054; 73 const int kNumEncryptionConflicts = 1054;
74 const int kNumHierarchyConflicts = 1055; 74 const int kNumHierarchyConflicts = 1055;
75 const int kNumSimpleConflicts = 1056; 75 const int kNumSimpleConflicts = 1056;
76 const int kNumServerConflicts = 1057; 76 const int kNumServerConflicts = 1057;
77 77
78 SyncSourceInfo source; 78 SyncSourceInfo source;
79 scoped_ptr<DictionaryValue> expected_source_value(source.ToValue()); 79 scoped_ptr<DictionaryValue> expected_source_value(source.ToValue());
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 "numSimpleConflicts"); 126 "numSimpleConflicts");
127 ExpectDictIntegerValue(kNumServerConflicts, *value, 127 ExpectDictIntegerValue(kNumServerConflicts, *value,
128 "numServerConflicts"); 128 "numServerConflicts");
129 ExpectDictDictionaryValue(*expected_source_value, *value, "source"); 129 ExpectDictDictionaryValue(*expected_source_value, *value, "source");
130 ExpectDictBooleanValue(false, *value, "notificationsEnabled"); 130 ExpectDictBooleanValue(false, *value, "notificationsEnabled");
131 } 131 }
132 132
133 } // namespace 133 } // namespace
134 } // namespace sessions 134 } // namespace sessions
135 } // namespace syncer 135 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/sessions/ordered_commit_set_unittest.cc ('k') | sync/sessions/status_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698