| 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 "components/sync/core_impl/js_sync_manager_observer.h" | 5 #include "components/sync/core_impl/js_sync_manager_observer.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 protected: | 40 protected: |
| 41 StrictMock<MockJsEventHandler> mock_js_event_handler_; | 41 StrictMock<MockJsEventHandler> mock_js_event_handler_; |
| 42 JsSyncManagerObserver js_sync_manager_observer_; | 42 JsSyncManagerObserver js_sync_manager_observer_; |
| 43 | 43 |
| 44 void PumpLoop() { base::RunLoop().RunUntilIdle(); } | 44 void PumpLoop() { base::RunLoop().RunUntilIdle(); } |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 TEST_F(JsSyncManagerObserverTest, OnInitializationComplete) { | 47 TEST_F(JsSyncManagerObserverTest, OnInitializationComplete) { |
| 48 base::DictionaryValue expected_details; | 48 base::DictionaryValue expected_details; |
| 49 syncer::ModelTypeSet restored_types; | 49 ModelTypeSet restored_types; |
| 50 restored_types.Put(BOOKMARKS); | 50 restored_types.Put(BOOKMARKS); |
| 51 restored_types.Put(NIGORI); | 51 restored_types.Put(NIGORI); |
| 52 expected_details.Set("restoredTypes", ModelTypeSetToValue(restored_types)); | 52 expected_details.Set("restoredTypes", ModelTypeSetToValue(restored_types)); |
| 53 | 53 |
| 54 EXPECT_CALL(mock_js_event_handler_, | 54 EXPECT_CALL(mock_js_event_handler_, |
| 55 HandleJsEvent("onInitializationComplete", | 55 HandleJsEvent("onInitializationComplete", |
| 56 HasDetailsAsDictionary(expected_details))); | 56 HasDetailsAsDictionary(expected_details))); |
| 57 | 57 |
| 58 js_sync_manager_observer_.OnInitializationComplete( | 58 js_sync_manager_observer_.OnInitializationComplete( |
| 59 WeakHandle<JsBackend>(), WeakHandle<DataTypeDebugInfoListener>(), true, | 59 WeakHandle<JsBackend>(), WeakHandle<DataTypeDebugInfoListener>(), true, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 EXPECT_CALL(mock_js_event_handler_, | 102 EXPECT_CALL(mock_js_event_handler_, |
| 103 HandleJsEvent("onConnectionStatusChange", | 103 HandleJsEvent("onConnectionStatusChange", |
| 104 HasDetailsAsDictionary(expected_details))); | 104 HasDetailsAsDictionary(expected_details))); |
| 105 | 105 |
| 106 js_sync_manager_observer_.OnConnectionStatusChange(kStatus); | 106 js_sync_manager_observer_.OnConnectionStatusChange(kStatus); |
| 107 PumpLoop(); | 107 PumpLoop(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace | 110 } // namespace |
| 111 } // namespace syncer | 111 } // namespace syncer |
| OLD | NEW |