summaryrefslogtreecommitdiffstats
path: root/sync/sessions/test_util.h
blob: 6ab32b194c423c5cf3483a18b70dcd0bc2f3e523 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// 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.
//
// Utils to simulate various outcomes of a sync session.
#ifndef SYNC_SESSIONS_TEST_UTIL_H_
#define SYNC_SESSIONS_TEST_UTIL_H_

#include "sync/engine/syncer.h"
#include "sync/sessions/sync_session.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace syncer {
namespace sessions {
namespace test_util {

void SimulateGetEncryptionKeyFailed(sessions::SyncSession* session,
                                    SyncerStep begin, SyncerStep end);
void SimulateDownloadUpdatesFailed(sessions::SyncSession* session,
                                   SyncerStep begin, SyncerStep end);
void SimulateCommitFailed(sessions::SyncSession* session,
                          SyncerStep begin, SyncerStep end);
void SimulateConnectionFailure(sessions::SyncSession* session,
                          SyncerStep begin, SyncerStep end);
void SimulateSuccess(sessions::SyncSession* session,
                     SyncerStep begin, SyncerStep end);
void SimulateThrottledImpl(sessions::SyncSession* session,
    const base::TimeDelta& delta);
void SimulateTypesThrottledImpl(
    sessions::SyncSession* session,
    ModelTypeSet types,
    const base::TimeDelta& delta);
void SimulatePollIntervalUpdateImpl(sessions::SyncSession* session,
    const base::TimeDelta& new_poll);
void SimulateSessionsCommitDelayUpdateImpl(sessions::SyncSession* session,
    const base::TimeDelta& new_delay);

ACTION_P(SimulateThrottled, throttle) {
  SimulateThrottledImpl(arg0, throttle);
}

ACTION_P2(SimulateTypesThrottled, types, throttle) {
  SimulateTypesThrottledImpl(arg0, types, throttle);
}

ACTION_P(SimulatePollIntervalUpdate, poll) {
  SimulatePollIntervalUpdateImpl(arg0, poll);
}

ACTION_P(SimulateSessionsCommitDelayUpdate, poll) {
  SimulateSessionsCommitDelayUpdateImpl(arg0, poll);
}

}  // namespace test_util
}  // namespace sessions
}  // namespace syncer

#endif  // SYNC_SESSIONS_TEST_UTIL_H_