| 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 false); | 87 false); |
| 90 DictionaryValue expected_details; | 88 DictionaryValue expected_details; |
| 91 expected_details.Set("snapshot", snapshot.ToValue()); | 89 expected_details.Set("snapshot", snapshot.ToValue()); |
| 92 | 90 |
| 93 EXPECT_CALL(mock_js_event_handler_, | 91 EXPECT_CALL(mock_js_event_handler_, |
| 94 HandleJsEvent("onSyncCycleCompleted", | 92 HandleJsEvent("onSyncCycleCompleted", |
| 95 HasDetailsAsDictionary(expected_details))); | 93 HasDetailsAsDictionary(expected_details))); |
| 96 | 94 |
| 97 js_sync_manager_observer_.OnSyncCycleCompleted(snapshot); | 95 js_sync_manager_observer_.OnSyncCycleCompleted(snapshot); |
| 98 PumpLoop(); | 96 PumpLoop(); |
| 99 } | 97 } |
| 100 | 98 |
| 101 TEST_F(JsSyncManagerObserverTest, OnActionableError) { | 99 TEST_F(JsSyncManagerObserverTest, OnActionableError) { |
| 102 SyncProtocolError sync_error; | 100 SyncProtocolError sync_error; |
| 103 sync_error.action = CLEAR_USER_DATA_AND_RESYNC; | 101 sync_error.action = CLEAR_USER_DATA_AND_RESYNC; |
| 104 sync_error.error_type = TRANSIENT_ERROR; | 102 sync_error.error_type = TRANSIENT_ERROR; |
| 105 DictionaryValue expected_details; | 103 DictionaryValue expected_details; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 EXPECT_CALL(mock_js_event_handler_, | 135 EXPECT_CALL(mock_js_event_handler_, |
| 138 HandleJsEvent("onUpdatedToken", | 136 HandleJsEvent("onUpdatedToken", |
| 139 HasDetailsAsDictionary(redacted_token_details))); | 137 HasDetailsAsDictionary(redacted_token_details))); |
| 140 | 138 |
| 141 js_sync_manager_observer_.OnUpdatedToken("sensitive_token"); | 139 js_sync_manager_observer_.OnUpdatedToken("sensitive_token"); |
| 142 PumpLoop(); | 140 PumpLoop(); |
| 143 } | 141 } |
| 144 | 142 |
| 145 } // namespace | 143 } // namespace |
| 146 } // namespace syncer | 144 } // namespace syncer |
| OLD | NEW |