mirror of
https://github.com/falk-werner/webfuse-provider
synced 2024-10-27 20:44:10 +00:00
added timeout watcher to observe loops
This commit is contained in:
parent
1753841353
commit
021e056960
@ -6,11 +6,15 @@
|
|||||||
#include "webfuse/core/protocol_names.h"
|
#include "webfuse/core/protocol_names.h"
|
||||||
#include "webfuse/utils/ws_server.h"
|
#include "webfuse/utils/ws_server.h"
|
||||||
#include "webfuse/mocks/mock_adapter_client_callback.hpp"
|
#include "webfuse/mocks/mock_adapter_client_callback.hpp"
|
||||||
|
#include "webfuse/utils/timeout_watcher.hpp"
|
||||||
|
|
||||||
using webfuse_test::WsServer;
|
using webfuse_test::WsServer;
|
||||||
using webfuse_test::MockAdapterClientCallback;
|
using webfuse_test::MockAdapterClientCallback;
|
||||||
|
using webfuse_test::TimeoutWatcher;
|
||||||
using testing::_;
|
using testing::_;
|
||||||
|
|
||||||
|
#define TIMEOUT (std::chrono::milliseconds(10 * 1000))
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -106,6 +110,8 @@ TEST(AdapterClient, CreateAndDispose)
|
|||||||
|
|
||||||
TEST(AdapterClient, Connect)
|
TEST(AdapterClient, Connect)
|
||||||
{
|
{
|
||||||
|
TimeoutWatcher watcher(TIMEOUT);
|
||||||
|
|
||||||
WsServer server(WF_PROTOCOL_NAME_PROVIDER_SERVER);
|
WsServer server(WF_PROTOCOL_NAME_PROVIDER_SERVER);
|
||||||
MockAdapterClientCallback callback;
|
MockAdapterClientCallback callback;
|
||||||
|
|
||||||
@ -124,12 +130,14 @@ TEST(AdapterClient, Connect)
|
|||||||
wf_client_connect(client, server.GetUrl().c_str());
|
wf_client_connect(client, server.GetUrl().c_str());
|
||||||
while (!server.IsConnected())
|
while (!server.IsConnected())
|
||||||
{
|
{
|
||||||
|
watcher.check();
|
||||||
wf_client_service(client);
|
wf_client_service(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
wf_client_disconnect(client);
|
wf_client_disconnect(client);
|
||||||
while (server.IsConnected())
|
while (server.IsConnected())
|
||||||
{
|
{
|
||||||
|
watcher.check();
|
||||||
wf_client_service(client);
|
wf_client_service(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user