test/include/SyncTests.h
author Volker Birk <vb@pep.foundation>
Thu, 23 Aug 2018 15:23:31 +0200
branchsync
changeset 2886 ee600afcb920
parent 2852 135a3e49e48d
child 2887 c5ab1f6ad3ee
permissions -rw-r--r--
reworking sructure for more tests
     1 // This file is under GNU General Public License 3.0
     2 // see LICENSE.txt
     3 
     4 #ifndef SYNC_H
     5 #define SYNC_H
     6 
     7 #include <string>
     8 #include <thread>
     9 #include "EngineTestSessionSuite.h"
    10 #include "locked_queue.hh"
    11 #include "sync_api.h"
    12 #include "Sync_impl.h"
    13 
    14 using namespace std;
    15 
    16 class Sync_Adapter {
    17 public:
    18     utility::locked_queue< Sync_event_t * > q;
    19 
    20     static PEP_STATUS notifyHandshake(
    21             void *obj,
    22             pEp_identity *me,
    23             pEp_identity *partner,
    24             sync_handshake_signal signal
    25         );
    26     static int inject_sync_event(SYNC_EVENT ev, void *management);
    27     static Sync_event_t *retrieve_next_sync_event(void *management);
    28     static PEP_STATUS messageToSend(void *obj, struct _message *msg);
    29 
    30     static void sync_thread(PEP_SESSION session, Sync_Adapter *adapter);
    31 };
    32 
    33 class SyncTests : public EngineTestSessionSuite {
    34     public:
    35         SyncTests(string test_suite, string test_home_dir);
    36 
    37         void setup();
    38         void tear_down();
    39 
    40     private:
    41         Sync_Adapter adapter;
    42         PEP_SESSION sync = NULL;
    43         thread *sync_thread;
    44         void check_sync();
    45 };
    46 
    47 #endif