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/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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 WeakHandle<JsBackend>(), true, restored_types); | 70 WeakHandle<JsBackend>(), true, restored_types); |
71 PumpLoop(); | 71 PumpLoop(); |
72 } | 72 } |
73 | 73 |
74 TEST_F(JsSyncManagerObserverTest, OnSyncCycleCompleted) { | 74 TEST_F(JsSyncManagerObserverTest, OnSyncCycleCompleted) { |
75 sessions::SyncSessionSnapshot snapshot(sessions::ModelNeutralState(), | 75 sessions::SyncSessionSnapshot snapshot(sessions::ModelNeutralState(), |
76 false, | 76 false, |
77 ModelTypeSet(), | 77 ModelTypeSet(), |
78 ProgressMarkerMap(), | 78 ProgressMarkerMap(), |
79 false, | 79 false, |
80 true, | |
81 8, | |
82 5, | 80 5, |
83 2, | 81 2, |
84 7, | 82 7, |
85 sessions::SyncSourceInfo(), | 83 sessions::SyncSourceInfo(), |
86 false, | 84 false, |
87 0, | 85 0, |
88 base::Time::Now()); | 86 base::Time::Now()); |
89 DictionaryValue expected_details; | 87 DictionaryValue expected_details; |
90 expected_details.Set("snapshot", snapshot.ToValue()); | 88 expected_details.Set("snapshot", snapshot.ToValue()); |
91 | 89 |
92 EXPECT_CALL(mock_js_event_handler_, | 90 EXPECT_CALL(mock_js_event_handler_, |
93 HandleJsEvent("onSyncCycleCompleted", | 91 HandleJsEvent("onSyncCycleCompleted", |
94 HasDetailsAsDictionary(expected_details))); | 92 HasDetailsAsDictionary(expected_details))); |
95 | 93 |
96 js_sync_manager_observer_.OnSyncCycleCompleted(snapshot); | 94 js_sync_manager_observer_.OnSyncCycleCompleted(snapshot); |
97 PumpLoop(); | 95 PumpLoop(); |
98 } | 96 } |
99 | 97 |
100 TEST_F(JsSyncManagerObserverTest, OnActionableError) { | 98 TEST_F(JsSyncManagerObserverTest, OnActionableError) { |
101 SyncProtocolError sync_error; | 99 SyncProtocolError sync_error; |
102 sync_error.action = CLEAR_USER_DATA_AND_RESYNC; | 100 sync_error.action = CLEAR_USER_DATA_AND_RESYNC; |
103 sync_error.error_type = TRANSIENT_ERROR; | 101 sync_error.error_type = TRANSIENT_ERROR; |
104 DictionaryValue expected_details; | 102 DictionaryValue expected_details; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 EXPECT_CALL(mock_js_event_handler_, | 134 EXPECT_CALL(mock_js_event_handler_, |
137 HandleJsEvent("onUpdatedToken", | 135 HandleJsEvent("onUpdatedToken", |
138 HasDetailsAsDictionary(redacted_token_details))); | 136 HasDetailsAsDictionary(redacted_token_details))); |
139 | 137 |
140 js_sync_manager_observer_.OnUpdatedToken("sensitive_token"); | 138 js_sync_manager_observer_.OnUpdatedToken("sensitive_token"); |
141 PumpLoop(); | 139 PumpLoop(); |
142 } | 140 } |
143 | 141 |
144 } // namespace | 142 } // namespace |
145 } // namespace syncer | 143 } // namespace syncer |
OLD | NEW |