OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/sync/glue/sync_backend_host_impl.h" | 5 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 69 } |
70 | 70 |
71 void QuitMessageLoop() { | 71 void QuitMessageLoop() { |
72 base::MessageLoop::current()->Quit(); | 72 base::MessageLoop::current()->Quit(); |
73 } | 73 } |
74 | 74 |
75 class MockSyncFrontend : public SyncFrontend { | 75 class MockSyncFrontend : public SyncFrontend { |
76 public: | 76 public: |
77 virtual ~MockSyncFrontend() {} | 77 virtual ~MockSyncFrontend() {} |
78 | 78 |
79 MOCK_METHOD3( | 79 MOCK_METHOD4( |
80 OnBackendInitialized, | 80 OnBackendInitialized, |
81 void(const syncer::WeakHandle<syncer::JsBackend>&, | 81 void(const syncer::WeakHandle<syncer::JsBackend>&, |
82 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&, | 82 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&, |
| 83 const std::string&, |
83 bool)); | 84 bool)); |
84 MOCK_METHOD0(OnSyncCycleCompleted, void()); | 85 MOCK_METHOD0(OnSyncCycleCompleted, void()); |
85 MOCK_METHOD1(OnConnectionStatusChange, | 86 MOCK_METHOD1(OnConnectionStatusChange, |
86 void(syncer::ConnectionStatus status)); | 87 void(syncer::ConnectionStatus status)); |
87 MOCK_METHOD0(OnClearServerDataSucceeded, void()); | 88 MOCK_METHOD0(OnClearServerDataSucceeded, void()); |
88 MOCK_METHOD0(OnClearServerDataFailed, void()); | 89 MOCK_METHOD0(OnClearServerDataFailed, void()); |
89 MOCK_METHOD2(OnPassphraseRequired, | 90 MOCK_METHOD2(OnPassphraseRequired, |
90 void(syncer::PassphraseRequiredReason, | 91 void(syncer::PassphraseRequiredReason, |
91 const sync_pb::EncryptedData&)); | 92 const sync_pb::EncryptedData&)); |
92 MOCK_METHOD0(OnPassphraseAccepted, void()); | 93 MOCK_METHOD0(OnPassphraseAccepted, void()); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // Pump messages posted by the sync thread (which may end up | 201 // Pump messages posted by the sync thread (which may end up |
201 // posting on the IO thread). | 202 // posting on the IO thread). |
202 base::RunLoop().RunUntilIdle(); | 203 base::RunLoop().RunUntilIdle(); |
203 content::RunAllPendingInMessageLoop(BrowserThread::IO); | 204 content::RunAllPendingInMessageLoop(BrowserThread::IO); |
204 // Pump any messages posted by the IO thread. | 205 // Pump any messages posted by the IO thread. |
205 base::RunLoop().RunUntilIdle(); | 206 base::RunLoop().RunUntilIdle(); |
206 } | 207 } |
207 | 208 |
208 // Synchronously initializes the backend. | 209 // Synchronously initializes the backend. |
209 void InitializeBackend(bool expect_success) { | 210 void InitializeBackend(bool expect_success) { |
210 EXPECT_CALL(mock_frontend_, OnBackendInitialized(_, _, expect_success)). | 211 EXPECT_CALL(mock_frontend_, OnBackendInitialized(_, _, _, expect_success)). |
211 WillOnce(InvokeWithoutArgs(QuitMessageLoop)); | 212 WillOnce(InvokeWithoutArgs(QuitMessageLoop)); |
212 backend_->Initialize( | 213 backend_->Initialize( |
213 &mock_frontend_, | 214 &mock_frontend_, |
214 scoped_ptr<base::Thread>(), | 215 scoped_ptr<base::Thread>(), |
215 syncer::WeakHandle<syncer::JsEventHandler>(), | 216 syncer::WeakHandle<syncer::JsEventHandler>(), |
216 GURL(std::string()), | 217 GURL(std::string()), |
217 credentials_, | 218 credentials_, |
218 true, | 219 true, |
219 fake_manager_factory_.PassAs<syncer::SyncManagerFactory>(), | 220 fake_manager_factory_.PassAs<syncer::SyncManagerFactory>(), |
220 scoped_ptr<syncer::UnrecoverableErrorHandler>( | 221 scoped_ptr<syncer::UnrecoverableErrorHandler>( |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 Difference(syncer::ModelTypeSet::All(), | 778 Difference(syncer::ModelTypeSet::All(), |
778 enabled_types_), | 779 enabled_types_), |
779 syncer::ModelTypeSet()); | 780 syncer::ModelTypeSet()); |
780 EXPECT_FALSE(fake_manager_->GetTypesWithEmptyProgressMarkerToken( | 781 EXPECT_FALSE(fake_manager_->GetTypesWithEmptyProgressMarkerToken( |
781 error_types).Empty()); | 782 error_types).Empty()); |
782 } | 783 } |
783 | 784 |
784 } // namespace | 785 } // namespace |
785 | 786 |
786 } // namespace browser_sync | 787 } // namespace browser_sync |
OLD | NEW |