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.
5 // Utils to simulate various outcomes of a sync session.
6 #ifndef SYNC_SESSIONS_TEST_UTIL_H_
7 #define SYNC_SESSIONS_TEST_UTIL_H_
9 #include "sync/engine/syncer.h"
10 #include "sync/sessions/sync_session.h"
11 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h"
18 void SimulateHasMoreToSync(sessions::SyncSession
* session
,
19 SyncerStep begin
, SyncerStep end
);
20 void SimulateGetEncryptionKeyFailed(sessions::SyncSession
* session
,
21 SyncerStep begin
, SyncerStep end
);
22 void SimulateDownloadUpdatesFailed(sessions::SyncSession
* session
,
23 SyncerStep begin
, SyncerStep end
);
24 void SimulateCommitFailed(sessions::SyncSession
* session
,
25 SyncerStep begin
, SyncerStep end
);
26 void SimulateConnectionFailure(sessions::SyncSession
* session
,
27 SyncerStep begin
, SyncerStep end
);
28 void SimulateSuccess(sessions::SyncSession
* session
,
29 SyncerStep begin
, SyncerStep end
);
30 void SimulateThrottledImpl(sessions::SyncSession
* session
,
31 const base::TimeDelta
& delta
);
32 void SimulatePollIntervalUpdateImpl(sessions::SyncSession
* session
,
33 const base::TimeDelta
& new_poll
);
34 void SimulateSessionsCommitDelayUpdateImpl(sessions::SyncSession
* session
,
35 const base::TimeDelta
& new_delay
);
37 ACTION_P(SimulateThrottled
, throttle
) {
38 SimulateThrottledImpl(arg0
, throttle
);
41 ACTION_P(SimulatePollIntervalUpdate
, poll
) {
42 SimulatePollIntervalUpdateImpl(arg0
, poll
);
45 ACTION_P(SimulateSessionsCommitDelayUpdate
, poll
) {
46 SimulateSessionsCommitDelayUpdateImpl(arg0
, poll
);
49 } // namespace test_util
50 } // namespace sessions
53 #endif // SYNC_SESSIONS_TEST_UTIL_H_