Chromium Code Reviews| Index: chrome/browser/sync/api/syncable_service_fake.h |
| diff --git a/chrome/browser/sync/api/syncable_service_fake.h b/chrome/browser/sync/api/syncable_service_fake.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3fb11e98201f893162a8548147cf13eda53e9cf6 |
| --- /dev/null |
| +++ b/chrome/browser/sync/api/syncable_service_fake.h |
| @@ -0,0 +1,50 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_SYNC_API_SYNCABLE_SERVICE_FAKE_H_ |
| +#define CHROME_BROWSER_SYNC_API_SYNCABLE_SERVICE_FAKE_H_ |
| +#pragma once |
| + |
| +#include "chrome/browser/sync/api/syncable_service.h" |
| + |
| +// A fake SyncableService that can return arbitrary values and maintains the |
| +// syncing status. |
| +class SyncableServiceFake : public SyncableService { |
|
akalin
2012/03/03 01:15:15
i always thought it should be FakeFoo and not FooF
Nicolas Zea
2012/03/05 21:59:30
Yeah, it does seem like that's more common. Done (
|
| + public: |
| + SyncableServiceFake(); |
| + virtual ~SyncableServiceFake(); |
| + |
| + // Reset the SyncableService results. |
| + void Reset(); |
|
akalin
2012/03/03 01:15:15
Hmm do we really need this function?
Nicolas Zea
2012/03/05 21:59:30
Had it there in case it would be useful for multip
|
| + |
| + // Setters for SyncableService implementation results. |
| + // Whether to return an error for MergeDataAndStartSyncing. |
| + void set_associate_success(bool success); |
|
akalin
2012/03/03 01:15:15
what about make these something like:
SetMergeDat
Nicolas Zea
2012/03/05 21:59:30
Done.
|
| + // Whether to return an error for ProcessSyncChanges. |
| + void set_process_success(bool success); |
| + |
| + // Whether we're syncing or not. Set on a successful MergeDataAndStartSyncing, |
| + // reset on StopSyncing. False by default. |
| + bool syncing() const; |
| + |
| + // SyncableService implementation. |
| + virtual SyncError MergeDataAndStartSyncing( |
| + syncable::ModelType type, |
| + const SyncDataList& initial_sync_data, |
| + SyncChangeProcessor* sync_processor) OVERRIDE; |
| + virtual void StopSyncing(syncable::ModelType type) OVERRIDE; |
| + virtual SyncDataList GetAllSyncData(syncable::ModelType type) const OVERRIDE; |
| + virtual SyncError ProcessSyncChanges( |
| + const tracked_objects::Location& from_here, |
| + const SyncChangeList& change_list) OVERRIDE; |
| + |
| + private: |
| + scoped_ptr<SyncChangeProcessor> sync_processor_; |
| + bool associate_success_; |
| + bool process_success_; |
| + bool syncing_; |
| + syncable::ModelType type_; |
| +}; |
| + |
| +#endif // CHROME_BROWSER_SYNC_API_SYNCABLE_SERVICE_FAKE_H_ |