Home | History | Annotate | Download | only in engine
      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 // A fake implementation of the SyncScheduler. If needed, we should add default
      6 // logic needed for tests (invoking callbacks, etc) here rather than in higher
      7 // level test classes.
      8 
      9 #ifndef SYNC_TEST_ENGINE_FAKE_SYNC_SCHEDULER_H_
     10 #define SYNC_TEST_ENGINE_FAKE_SYNC_SCHEDULER_H_
     11 
     12 #include "base/message_loop/message_loop.h"
     13 #include "sync/engine/sync_scheduler.h"
     14 
     15 namespace syncer {
     16 
     17 class FakeSyncScheduler : public SyncScheduler {
     18  public:
     19   FakeSyncScheduler();
     20   virtual ~FakeSyncScheduler();
     21 
     22   virtual void Start(Mode mode) OVERRIDE;
     23   virtual void Stop() OVERRIDE;
     24   virtual void ScheduleLocalNudge(
     25       const base::TimeDelta& desired_delay,
     26       ModelTypeSet types,
     27       const tracked_objects::Location& nudge_location) OVERRIDE;
     28   virtual void ScheduleLocalRefreshRequest(
     29       const base::TimeDelta& desired_delay,
     30       ModelTypeSet types,
     31       const tracked_objects::Location& nudge_location) OVERRIDE;
     32   virtual void ScheduleInvalidationNudge(
     33       const base::TimeDelta& desired_delay,
     34       const ObjectIdInvalidationMap& invalidation_map,
     35       const tracked_objects::Location& nudge_location) OVERRIDE;
     36   virtual void ScheduleConfiguration(
     37       const ConfigurationParams& params) OVERRIDE;
     38   virtual void SetNotificationsEnabled(bool notifications_enabled) OVERRIDE;
     39 
     40   virtual base::TimeDelta GetSessionsCommitDelay() const OVERRIDE;
     41   virtual void OnCredentialsUpdated() OVERRIDE;
     42   virtual void OnConnectionStatusChange() OVERRIDE;
     43 
     44   // SyncSession::Delegate implementation.
     45   virtual void OnThrottled(
     46       const base::TimeDelta& throttle_duration) OVERRIDE;
     47   virtual void OnTypesThrottled(
     48       ModelTypeSet types,
     49       const base::TimeDelta& throttle_duration) OVERRIDE;
     50   virtual bool IsCurrentlyThrottled() OVERRIDE;
     51   virtual void OnReceivedShortPollIntervalUpdate(
     52       const base::TimeDelta& new_interval) OVERRIDE;
     53   virtual void OnReceivedLongPollIntervalUpdate(
     54       const base::TimeDelta& new_interval) OVERRIDE;
     55   virtual void OnReceivedSessionsCommitDelay(
     56       const base::TimeDelta& new_delay) OVERRIDE;
     57   virtual void OnReceivedClientInvalidationHintBufferSize(int size) OVERRIDE;
     58   virtual void OnSyncProtocolError(
     59       const sessions::SyncSessionSnapshot& snapshot) OVERRIDE;
     60 };
     61 
     62 }  // namespace syncer
     63 
     64 #endif  // SYNC_TEST_ENGINE_FAKE_SYNC_SCHEDULER_H_
     65