Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc

Issue 401433003: Revert of Sync: Refactoring of DEVICE_INFO syncable type - Part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_METHOD4( 79 MOCK_METHOD3(
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&,
84 bool)); 83 bool));
85 MOCK_METHOD0(OnSyncCycleCompleted, void()); 84 MOCK_METHOD0(OnSyncCycleCompleted, void());
86 MOCK_METHOD1(OnConnectionStatusChange, 85 MOCK_METHOD1(OnConnectionStatusChange,
87 void(syncer::ConnectionStatus status)); 86 void(syncer::ConnectionStatus status));
88 MOCK_METHOD0(OnClearServerDataSucceeded, void()); 87 MOCK_METHOD0(OnClearServerDataSucceeded, void());
89 MOCK_METHOD0(OnClearServerDataFailed, void()); 88 MOCK_METHOD0(OnClearServerDataFailed, void());
90 MOCK_METHOD2(OnPassphraseRequired, 89 MOCK_METHOD2(OnPassphraseRequired,
91 void(syncer::PassphraseRequiredReason, 90 void(syncer::PassphraseRequiredReason,
92 const sync_pb::EncryptedData&)); 91 const sync_pb::EncryptedData&));
93 MOCK_METHOD0(OnPassphraseAccepted, void()); 92 MOCK_METHOD0(OnPassphraseAccepted, void());
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // Pump messages posted by the sync thread (which may end up 200 // Pump messages posted by the sync thread (which may end up
202 // posting on the IO thread). 201 // posting on the IO thread).
203 base::RunLoop().RunUntilIdle(); 202 base::RunLoop().RunUntilIdle();
204 content::RunAllPendingInMessageLoop(BrowserThread::IO); 203 content::RunAllPendingInMessageLoop(BrowserThread::IO);
205 // Pump any messages posted by the IO thread. 204 // Pump any messages posted by the IO thread.
206 base::RunLoop().RunUntilIdle(); 205 base::RunLoop().RunUntilIdle();
207 } 206 }
208 207
209 // Synchronously initializes the backend. 208 // Synchronously initializes the backend.
210 void InitializeBackend(bool expect_success) { 209 void InitializeBackend(bool expect_success) {
211 EXPECT_CALL(mock_frontend_, OnBackendInitialized(_, _, _, expect_success)). 210 EXPECT_CALL(mock_frontend_, OnBackendInitialized(_, _, expect_success)).
212 WillOnce(InvokeWithoutArgs(QuitMessageLoop)); 211 WillOnce(InvokeWithoutArgs(QuitMessageLoop));
213 backend_->Initialize( 212 backend_->Initialize(
214 &mock_frontend_, 213 &mock_frontend_,
215 scoped_ptr<base::Thread>(), 214 scoped_ptr<base::Thread>(),
216 syncer::WeakHandle<syncer::JsEventHandler>(), 215 syncer::WeakHandle<syncer::JsEventHandler>(),
217 GURL(std::string()), 216 GURL(std::string()),
218 credentials_, 217 credentials_,
219 true, 218 true,
220 fake_manager_factory_.PassAs<syncer::SyncManagerFactory>(), 219 fake_manager_factory_.PassAs<syncer::SyncManagerFactory>(),
221 scoped_ptr<syncer::UnrecoverableErrorHandler>( 220 scoped_ptr<syncer::UnrecoverableErrorHandler>(
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 ASSERT_NE(-1, base::WriteFile(sync_file, nonsense, strlen(nonsense))); 728 ASSERT_NE(-1, base::WriteFile(sync_file, nonsense, strlen(nonsense)));
730 729
731 InitializeBackend(true); 730 InitializeBackend(true);
732 731
733 EXPECT_FALSE(base::PathExists(sync_file)); 732 EXPECT_FALSE(base::PathExists(sync_file));
734 } 733 }
735 734
736 } // namespace 735 } // namespace
737 736
738 } // namespace browser_sync 737 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host_impl.cc ('k') | chrome/browser/sync/glue/sync_backend_host_mock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698