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

Side by Side Diff: sync/internal_api/js_sync_manager_observer_unittest.cc

Issue 10197004: [Sync] Convert SyncSessionSnapshot to a copy-able class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 8 years, 8 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/internal_api/js_sync_manager_observer.cc ('k') | sync/internal_api/sync_manager.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/internal_api/js_sync_manager_observer.h" 5 #include "sync/internal_api/js_sync_manager_observer.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 js_sync_manager_observer_.OnInitializationComplete(WeakHandle<JsBackend>(), 65 js_sync_manager_observer_.OnInitializationComplete(WeakHandle<JsBackend>(),
66 true); 66 true);
67 js_sync_manager_observer_.OnStopSyncingPermanently(); 67 js_sync_manager_observer_.OnStopSyncingPermanently();
68 js_sync_manager_observer_.OnClearServerDataSucceeded(); 68 js_sync_manager_observer_.OnClearServerDataSucceeded();
69 js_sync_manager_observer_.OnClearServerDataFailed(); 69 js_sync_manager_observer_.OnClearServerDataFailed();
70 js_sync_manager_observer_.OnEncryptionComplete(); 70 js_sync_manager_observer_.OnEncryptionComplete();
71 PumpLoop(); 71 PumpLoop();
72 } 72 }
73 73
74 TEST_F(JsSyncManagerObserverTest, OnSyncCycleCompleted) { 74 TEST_F(JsSyncManagerObserverTest, OnSyncCycleCompleted) {
75 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; 75 syncable::ModelTypePayloadMap download_progress_markers;
76 sessions::SyncSessionSnapshot snapshot(sessions::SyncerStatus(), 76 sessions::SyncSessionSnapshot snapshot(sessions::SyncerStatus(),
77 sessions::ErrorCounters(), 77 sessions::ErrorCounters(),
78 100, 78 100,
79 false, 79 false,
80 syncable::ModelTypeSet(), 80 syncable::ModelTypeSet(),
81 download_progress_markers, 81 download_progress_markers,
82 false, 82 false,
83 true, 83 true,
84 100, 84 100,
85 8, 85 8,
86 5, 86 5,
87 2, 87 2,
88 7, 88 7,
89 false, 89 false,
90 sessions::SyncSourceInfo(), 90 sessions::SyncSourceInfo(),
91 false, 91 false,
92 0, 92 0,
93 base::Time::Now(), 93 base::Time::Now(),
94 false); 94 false);
95 DictionaryValue expected_details; 95 DictionaryValue expected_details;
96 expected_details.Set("snapshot", snapshot.ToValue()); 96 expected_details.Set("snapshot", snapshot.ToValue());
97 97
98 EXPECT_CALL(mock_js_event_handler_, 98 EXPECT_CALL(mock_js_event_handler_,
99 HandleJsEvent("onSyncCycleCompleted", 99 HandleJsEvent("onSyncCycleCompleted",
100 HasDetailsAsDictionary(expected_details))); 100 HasDetailsAsDictionary(expected_details)));
101 101
102 js_sync_manager_observer_.OnSyncCycleCompleted(&snapshot); 102 js_sync_manager_observer_.OnSyncCycleCompleted(snapshot);
103 PumpLoop(); 103 PumpLoop();
104 } 104 }
105 105
106 TEST_F(JsSyncManagerObserverTest, OnActionableError) { 106 TEST_F(JsSyncManagerObserverTest, OnActionableError) {
107 browser_sync::SyncProtocolError sync_error; 107 browser_sync::SyncProtocolError sync_error;
108 sync_error.action = browser_sync::CLEAR_USER_DATA_AND_RESYNC; 108 sync_error.action = browser_sync::CLEAR_USER_DATA_AND_RESYNC;
109 sync_error.error_type = browser_sync::TRANSIENT_ERROR; 109 sync_error.error_type = browser_sync::TRANSIENT_ERROR;
110 DictionaryValue expected_details; 110 DictionaryValue expected_details;
111 expected_details.Set("syncError", sync_error.ToValue()); 111 expected_details.Set("syncError", sync_error.ToValue());
112 112
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 HandleJsEvent("onEncryptedTypesChanged", 212 HandleJsEvent("onEncryptedTypesChanged",
213 HasDetailsAsDictionary(expected_details))); 213 HasDetailsAsDictionary(expected_details)));
214 214
215 js_sync_manager_observer_.OnEncryptedTypesChanged( 215 js_sync_manager_observer_.OnEncryptedTypesChanged(
216 encrypted_types, encrypt_everything); 216 encrypted_types, encrypt_everything);
217 PumpLoop(); 217 PumpLoop();
218 } 218 }
219 219
220 } // namespace 220 } // namespace
221 } // namespace browser_sync 221 } // namespace browser_sync
OLDNEW
« no previous file with comments | « sync/internal_api/js_sync_manager_observer.cc ('k') | sync/internal_api/sync_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698