test/include/SyncTests.h
author Volker Birk <vb@pep.foundation>
Sun, 21 Oct 2018 15:37:18 +0200
branchsync
changeset 3086 c35fd5131941
parent 2909 13da9af3bd4f
child 3242 a878c9a02139
permissions -rw-r--r--
adapt sync test
     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     void processing();
    21 
    22     static PEP_STATUS notifyHandshake(
    23             pEp_identity *me,
    24             pEp_identity *partner,
    25             sync_handshake_signal signal
    26         );
    27     static int inject_sync_event(SYNC_EVENT ev, void *management);
    28     static Sync_event_t *retrieve_next_sync_event(void *management, time_t threshold);
    29     static PEP_STATUS messageToSend(struct _message *msg);
    30 
    31     static void sync_thread(PEP_SESSION session, Sync_Adapter *adapter);
    32 };
    33 
    34 class SyncTests : public EngineTestSessionSuite {
    35     public:
    36         SyncTests(string test_suite, string test_home_dir);
    37 
    38         void setup();
    39         void tear_down();
    40 
    41     private:
    42         Sync_Adapter adapter;
    43         PEP_SESSION sync = NULL;
    44         thread *sync_thread;
    45 
    46         void check_sync();
    47 };
    48 
    49 #endif