test/include/SyncTests.h
author Volker Birk <vb@pep-project.org>
Mon, 28 Jan 2019 11:53:20 +0100
branchsync
changeset 3242 a878c9a02139
parent 3086 c35fd5131941
child 3834 2934fc35d7a3
permissions -rw-r--r--
sync tests with unsigned instead of time_t
vb@2852
     1
// This file is under GNU General Public License 3.0
vb@2852
     2
// see LICENSE.txt
vb@2852
     3
vb@2852
     4
#ifndef SYNC_H
vb@2852
     5
#define SYNC_H
vb@2852
     6
vb@2852
     7
#include <string>
vb@2886
     8
#include <thread>
vb@2852
     9
#include "EngineTestSessionSuite.h"
vb@2886
    10
#include "locked_queue.hh"
vb@2886
    11
#include "sync_api.h"
vb@2886
    12
#include "Sync_impl.h"
vb@2852
    13
vb@2852
    14
using namespace std;
vb@2852
    15
vb@2886
    16
class Sync_Adapter {
vb@2886
    17
public:
vb@2886
    18
    utility::locked_queue< Sync_event_t * > q;
vb@2886
    19
vb@2888
    20
    void processing();
vb@2888
    21
vb@2886
    22
    static PEP_STATUS notifyHandshake(
vb@2886
    23
            pEp_identity *me,
vb@2886
    24
            pEp_identity *partner,
vb@2886
    25
            sync_handshake_signal signal
vb@2886
    26
        );
vb@2886
    27
    static int inject_sync_event(SYNC_EVENT ev, void *management);
vb@3242
    28
    static Sync_event_t *retrieve_next_sync_event(void *management, unsigned threshold);
vb@2899
    29
    static PEP_STATUS messageToSend(struct _message *msg);
vb@2886
    30
vb@2886
    31
    static void sync_thread(PEP_SESSION session, Sync_Adapter *adapter);
vb@2886
    32
};
vb@2886
    33
vb@2852
    34
class SyncTests : public EngineTestSessionSuite {
vb@2852
    35
    public:
vb@2852
    36
        SyncTests(string test_suite, string test_home_dir);
vb@2886
    37
vb@2886
    38
        void setup();
vb@2886
    39
        void tear_down();
vb@2886
    40
vb@2852
    41
    private:
vb@2886
    42
        Sync_Adapter adapter;
vb@2886
    43
        PEP_SESSION sync = NULL;
vb@2886
    44
        thread *sync_thread;
vb@2887
    45
vb@2852
    46
        void check_sync();
vb@2852
    47
};
vb@2852
    48
vb@2852
    49
#endif