| 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/message_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "sync/internal_api/public/base/model_type.h" | 11 #include "sync/internal_api/public/base/model_type.h" |
| 12 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" | 12 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" |
| 13 #include "sync/internal_api/public/util/sync_string_conversions.h" | 13 #include "sync/internal_api/public/util/sync_string_conversions.h" |
| 14 #include "sync/internal_api/public/util/weak_handle.h" | 14 #include "sync/internal_api/public/util/weak_handle.h" |
| 15 #include "sync/js/js_event_details.h" | 15 #include "sync/js/js_event_details.h" |
| 16 #include "sync/js/js_test_util.h" | 16 #include "sync/js/js_test_util.h" |
| 17 #include "sync/protocol/sync_protocol_error.h" | 17 #include "sync/protocol/sync_protocol_error.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 19 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 33 private: | 33 private: |
| 34 // This must be destroyed after the member variables below in order | 34 // This must be destroyed after the member variables below in order |
| 35 // for WeakHandles to be destroyed properly. | 35 // for WeakHandles to be destroyed properly. |
| 36 base::MessageLoop message_loop_; | 36 base::MessageLoop message_loop_; |
| 37 | 37 |
| 38 protected: | 38 protected: |
| 39 StrictMock<MockJsEventHandler> mock_js_event_handler_; | 39 StrictMock<MockJsEventHandler> mock_js_event_handler_; |
| 40 JsSyncManagerObserver js_sync_manager_observer_; | 40 JsSyncManagerObserver js_sync_manager_observer_; |
| 41 | 41 |
| 42 void PumpLoop() { | 42 void PumpLoop() { |
| 43 message_loop_.RunUntilIdle(); | 43 base::RunLoop().RunUntilIdle(); |
| 44 } | 44 } |
| 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 syncer::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 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 EXPECT_CALL(mock_js_event_handler_, | 113 EXPECT_CALL(mock_js_event_handler_, |
| 114 HandleJsEvent("onConnectionStatusChange", | 114 HandleJsEvent("onConnectionStatusChange", |
| 115 HasDetailsAsDictionary(expected_details))); | 115 HasDetailsAsDictionary(expected_details))); |
| 116 | 116 |
| 117 js_sync_manager_observer_.OnConnectionStatusChange(kStatus); | 117 js_sync_manager_observer_.OnConnectionStatusChange(kStatus); |
| 118 PumpLoop(); | 118 PumpLoop(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace | 121 } // namespace |
| 122 } // namespace syncer | 122 } // namespace syncer |
| OLD | NEW |