Home | History | Annotate | Download | only in glue
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_SYNC_GLUE_FAKE_GENERIC_CHANGE_PROCESSOR_H_
      6 #define CHROME_BROWSER_SYNC_GLUE_FAKE_GENERIC_CHANGE_PROCESSOR_H_
      7 
      8 #include "chrome/browser/sync/glue/generic_change_processor.h"
      9 
     10 #include "sync/api/sync_error.h"
     11 
     12 namespace browser_sync {
     13 
     14 // A fake GenericChangeProcessor that can return arbitrary values.
     15 class FakeGenericChangeProcessor : public GenericChangeProcessor {
     16  public:
     17   FakeGenericChangeProcessor();
     18   virtual ~FakeGenericChangeProcessor();
     19 
     20   // Setters for GenericChangeProcessor implementation results.
     21   void set_process_sync_changes_error(const syncer::SyncError& error);
     22   void set_get_sync_data_for_type_error(const syncer::SyncError& error);
     23   void set_sync_model_has_user_created_nodes(bool has_nodes);
     24   void set_sync_model_has_user_created_nodes_success(bool success);
     25   void set_crypto_ready_if_necessary(bool crypto_ready);
     26 
     27   // GenericChangeProcessor implementations.
     28   virtual syncer::SyncError ProcessSyncChanges(
     29       const tracked_objects::Location& from_here,
     30       const syncer::SyncChangeList& change_list) OVERRIDE;
     31   virtual syncer::SyncError GetSyncDataForType(
     32       syncer::ModelType type,
     33       syncer::SyncDataList* current_sync_data) OVERRIDE;
     34   virtual int GetSyncCountForType(syncer::ModelType type) OVERRIDE;
     35   virtual bool SyncModelHasUserCreatedNodes(syncer::ModelType type,
     36                                             bool* has_nodes) OVERRIDE;
     37   virtual bool CryptoReadyIfNecessary(syncer::ModelType type) OVERRIDE;
     38 
     39  private:
     40   syncer::SyncError process_sync_changes_error_;
     41   syncer::SyncError get_sync_data_for_type_error_;
     42   bool sync_model_has_user_created_nodes_;
     43   bool sync_model_has_user_created_nodes_success_;
     44   bool crypto_ready_if_necessary_;
     45   syncer::ModelType type_;
     46 };
     47 
     48 }  // namespace browser_sync
     49 
     50 #endif  // CHROME_BROWSER_SYNC_GLUE_FAKE_GENERIC_CHANGE_PROCESSOR_H_
     51