|
|
@ -92,10 +92,9 @@ TEST(jsonrpc_proxy, init)
|
|
|
|
|
|
|
|
|
|
|
|
SendContext context;
|
|
|
|
SendContext context;
|
|
|
|
void * user_data = reinterpret_cast<void*>(&context);
|
|
|
|
void * user_data = reinterpret_cast<void*>(&context);
|
|
|
|
struct jsonrpc_proxy proxy;
|
|
|
|
struct jsonrpc_proxy * proxy = jsonrpc_proxy_create(&timeout_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, user_data);
|
|
|
|
jsonrpc_proxy_init(&proxy, &timeout_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, user_data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jsonrpc_proxy_cleanup(&proxy);
|
|
|
|
jsonrpc_proxy_dispose(proxy);
|
|
|
|
wf_impl_timeout_manager_cleanup(&timeout_manager);
|
|
|
|
wf_impl_timeout_manager_cleanup(&timeout_manager);
|
|
|
|
|
|
|
|
|
|
|
|
ASSERT_FALSE(context.is_called);
|
|
|
|
ASSERT_FALSE(context.is_called);
|
|
|
@ -108,12 +107,11 @@ TEST(jsonrpc_proxy, invoke)
|
|
|
|
|
|
|
|
|
|
|
|
SendContext send_context;
|
|
|
|
SendContext send_context;
|
|
|
|
void * send_data = reinterpret_cast<void*>(&send_context);
|
|
|
|
void * send_data = reinterpret_cast<void*>(&send_context);
|
|
|
|
struct jsonrpc_proxy proxy;
|
|
|
|
struct jsonrpc_proxy * proxy = jsonrpc_proxy_create(&timeout_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data);
|
|
|
|
jsonrpc_proxy_init(&proxy, &timeout_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FinishedContext finished_context;
|
|
|
|
FinishedContext finished_context;
|
|
|
|
void * finished_data = reinterpret_cast<void*>(&finished_context);
|
|
|
|
void * finished_data = reinterpret_cast<void*>(&finished_context);
|
|
|
|
jsonrpc_proxy_invoke(&proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42);
|
|
|
|
jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42);
|
|
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(send_context.is_called);
|
|
|
|
ASSERT_TRUE(send_context.is_called);
|
|
|
|
ASSERT_TRUE(json_is_object(send_context.response));
|
|
|
|
ASSERT_TRUE(json_is_object(send_context.response));
|
|
|
@ -135,7 +133,7 @@ TEST(jsonrpc_proxy, invoke)
|
|
|
|
|
|
|
|
|
|
|
|
ASSERT_FALSE(finished_context.is_called);
|
|
|
|
ASSERT_FALSE(finished_context.is_called);
|
|
|
|
|
|
|
|
|
|
|
|
jsonrpc_proxy_cleanup(&proxy);
|
|
|
|
jsonrpc_proxy_dispose(proxy);
|
|
|
|
wf_impl_timeout_manager_cleanup(&timeout_manager);
|
|
|
|
wf_impl_timeout_manager_cleanup(&timeout_manager);
|
|
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(finished_context.is_called);
|
|
|
|
ASSERT_TRUE(finished_context.is_called);
|
|
|
@ -149,12 +147,11 @@ TEST(jsonrpc_proxy, invoke_calls_finish_if_send_fails)
|
|
|
|
|
|
|
|
|
|
|
|
SendContext send_context(false);
|
|
|
|
SendContext send_context(false);
|
|
|
|
void * send_data = reinterpret_cast<void*>(&send_context);
|
|
|
|
void * send_data = reinterpret_cast<void*>(&send_context);
|
|
|
|
struct jsonrpc_proxy proxy;
|
|
|
|
struct jsonrpc_proxy * proxy = jsonrpc_proxy_create(&timeout_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data);
|
|
|
|
jsonrpc_proxy_init(&proxy, &timeout_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FinishedContext finished_context;
|
|
|
|
FinishedContext finished_context;
|
|
|
|
void * finished_data = reinterpret_cast<void*>(&finished_context);
|
|
|
|
void * finished_data = reinterpret_cast<void*>(&finished_context);
|
|
|
|
jsonrpc_proxy_invoke(&proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42);
|
|
|
|
jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42);
|
|
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(send_context.is_called);
|
|
|
|
ASSERT_TRUE(send_context.is_called);
|
|
|
|
ASSERT_TRUE(json_is_object(send_context.response));
|
|
|
|
ASSERT_TRUE(json_is_object(send_context.response));
|
|
|
@ -162,7 +159,7 @@ TEST(jsonrpc_proxy, invoke_calls_finish_if_send_fails)
|
|
|
|
ASSERT_TRUE(finished_context.is_called);
|
|
|
|
ASSERT_TRUE(finished_context.is_called);
|
|
|
|
ASSERT_FALSE(nullptr == finished_context.error);
|
|
|
|
ASSERT_FALSE(nullptr == finished_context.error);
|
|
|
|
|
|
|
|
|
|
|
|
jsonrpc_proxy_cleanup(&proxy);
|
|
|
|
jsonrpc_proxy_dispose(proxy);
|
|
|
|
wf_impl_timeout_manager_cleanup(&timeout_manager);
|
|
|
|
wf_impl_timeout_manager_cleanup(&timeout_manager);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -173,16 +170,15 @@ TEST(jsonrpc_proxy, invoke_fails_if_another_request_is_pending)
|
|
|
|
|
|
|
|
|
|
|
|
SendContext send_context;
|
|
|
|
SendContext send_context;
|
|
|
|
void * send_data = reinterpret_cast<void*>(&send_context);
|
|
|
|
void * send_data = reinterpret_cast<void*>(&send_context);
|
|
|
|
struct jsonrpc_proxy proxy;
|
|
|
|
struct jsonrpc_proxy * proxy = jsonrpc_proxy_create(&timeout_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data);
|
|
|
|
jsonrpc_proxy_init(&proxy, &timeout_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FinishedContext finished_context;
|
|
|
|
FinishedContext finished_context;
|
|
|
|
void * finished_data = reinterpret_cast<void*>(&finished_context);
|
|
|
|
void * finished_data = reinterpret_cast<void*>(&finished_context);
|
|
|
|
jsonrpc_proxy_invoke(&proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42);
|
|
|
|
jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42);
|
|
|
|
|
|
|
|
|
|
|
|
FinishedContext finished_context2;
|
|
|
|
FinishedContext finished_context2;
|
|
|
|
void * finished_data2 = reinterpret_cast<void*>(&finished_context2);
|
|
|
|
void * finished_data2 = reinterpret_cast<void*>(&finished_context2);
|
|
|
|
jsonrpc_proxy_invoke(&proxy, &jsonrpc_finished, finished_data2, "foo", "");
|
|
|
|
jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data2, "foo", "");
|
|
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(send_context.is_called);
|
|
|
|
ASSERT_TRUE(send_context.is_called);
|
|
|
|
ASSERT_TRUE(json_is_object(send_context.response));
|
|
|
|
ASSERT_TRUE(json_is_object(send_context.response));
|
|
|
@ -192,7 +188,7 @@ TEST(jsonrpc_proxy, invoke_fails_if_another_request_is_pending)
|
|
|
|
ASSERT_TRUE(finished_context2.is_called);
|
|
|
|
ASSERT_TRUE(finished_context2.is_called);
|
|
|
|
ASSERT_EQ(WF_BAD_BUSY, wf_impl_jsonrpc_get_status(finished_context2.error));
|
|
|
|
ASSERT_EQ(WF_BAD_BUSY, wf_impl_jsonrpc_get_status(finished_context2.error));
|
|
|
|
|
|
|
|
|
|
|
|
jsonrpc_proxy_cleanup(&proxy);
|
|
|
|
jsonrpc_proxy_dispose(proxy);
|
|
|
|
wf_impl_timeout_manager_cleanup(&timeout_manager);
|
|
|
|
wf_impl_timeout_manager_cleanup(&timeout_manager);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -203,19 +199,18 @@ TEST(jsonrpc_proxy, invoke_fails_if_request_is_invalid)
|
|
|
|
|
|
|
|
|
|
|
|
SendContext send_context;
|
|
|
|
SendContext send_context;
|
|
|
|
void * send_data = reinterpret_cast<void*>(&send_context);
|
|
|
|
void * send_data = reinterpret_cast<void*>(&send_context);
|
|
|
|
struct jsonrpc_proxy proxy;
|
|
|
|
struct jsonrpc_proxy * proxy = jsonrpc_proxy_create(&timeout_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data);
|
|
|
|
jsonrpc_proxy_init(&proxy, &timeout_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FinishedContext finished_context;
|
|
|
|
FinishedContext finished_context;
|
|
|
|
void * finished_data = reinterpret_cast<void*>(&finished_context);
|
|
|
|
void * finished_data = reinterpret_cast<void*>(&finished_context);
|
|
|
|
jsonrpc_proxy_invoke(&proxy, &jsonrpc_finished, finished_data, "foo", "?", "error");
|
|
|
|
jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "?", "error");
|
|
|
|
|
|
|
|
|
|
|
|
ASSERT_FALSE(send_context.is_called);
|
|
|
|
ASSERT_FALSE(send_context.is_called);
|
|
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(finished_context.is_called);
|
|
|
|
ASSERT_TRUE(finished_context.is_called);
|
|
|
|
ASSERT_EQ(WF_BAD, wf_impl_jsonrpc_get_status(finished_context.error));
|
|
|
|
ASSERT_EQ(WF_BAD, wf_impl_jsonrpc_get_status(finished_context.error));
|
|
|
|
|
|
|
|
|
|
|
|
jsonrpc_proxy_cleanup(&proxy);
|
|
|
|
jsonrpc_proxy_dispose(proxy);
|
|
|
|
wf_impl_timeout_manager_cleanup(&timeout_manager);
|
|
|
|
wf_impl_timeout_manager_cleanup(&timeout_manager);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -226,12 +221,11 @@ TEST(jsonrpc_proxy, on_result)
|
|
|
|
|
|
|
|
|
|
|
|
SendContext send_context;
|
|
|
|
SendContext send_context;
|
|
|
|
void * send_data = reinterpret_cast<void*>(&send_context);
|
|
|
|
void * send_data = reinterpret_cast<void*>(&send_context);
|
|
|
|
struct jsonrpc_proxy proxy;
|
|
|
|
struct jsonrpc_proxy * proxy = jsonrpc_proxy_create(&timeout_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data);
|
|
|
|
jsonrpc_proxy_init(&proxy, &timeout_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FinishedContext finished_context;
|
|
|
|
FinishedContext finished_context;
|
|
|
|
void * finished_data = reinterpret_cast<void*>(&finished_context);
|
|
|
|
void * finished_data = reinterpret_cast<void*>(&finished_context);
|
|
|
|
jsonrpc_proxy_invoke(&proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42);
|
|
|
|
jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42);
|
|
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(send_context.is_called);
|
|
|
|
ASSERT_TRUE(send_context.is_called);
|
|
|
|
ASSERT_TRUE(json_is_object(send_context.response));
|
|
|
|
ASSERT_TRUE(json_is_object(send_context.response));
|
|
|
@ -243,7 +237,7 @@ TEST(jsonrpc_proxy, on_result)
|
|
|
|
json_object_set_new(response, "result", json_string("okay"));
|
|
|
|
json_object_set_new(response, "result", json_string("okay"));
|
|
|
|
json_object_set(response, "id", id);
|
|
|
|
json_object_set(response, "id", id);
|
|
|
|
|
|
|
|
|
|
|
|
jsonrpc_proxy_onresult(&proxy, response);
|
|
|
|
jsonrpc_proxy_onresult(proxy, response);
|
|
|
|
json_decref(response);
|
|
|
|
json_decref(response);
|
|
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(finished_context.is_called);
|
|
|
|
ASSERT_TRUE(finished_context.is_called);
|
|
|
@ -251,7 +245,7 @@ TEST(jsonrpc_proxy, on_result)
|
|
|
|
ASSERT_TRUE(json_is_string(finished_context.result));
|
|
|
|
ASSERT_TRUE(json_is_string(finished_context.result));
|
|
|
|
ASSERT_STREQ("okay", json_string_value(finished_context.result));
|
|
|
|
ASSERT_STREQ("okay", json_string_value(finished_context.result));
|
|
|
|
|
|
|
|
|
|
|
|
jsonrpc_proxy_cleanup(&proxy);
|
|
|
|
jsonrpc_proxy_dispose(proxy);
|
|
|
|
wf_impl_timeout_manager_cleanup(&timeout_manager);
|
|
|
|
wf_impl_timeout_manager_cleanup(&timeout_manager);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -262,12 +256,11 @@ TEST(jsonrpc_proxy, on_result_reject_response_with_unknown_id)
|
|
|
|
|
|
|
|
|
|
|
|
SendContext send_context;
|
|
|
|
SendContext send_context;
|
|
|
|
void * send_data = reinterpret_cast<void*>(&send_context);
|
|
|
|
void * send_data = reinterpret_cast<void*>(&send_context);
|
|
|
|
struct jsonrpc_proxy proxy;
|
|
|
|
struct jsonrpc_proxy * proxy = jsonrpc_proxy_create(&timeout_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data);
|
|
|
|
jsonrpc_proxy_init(&proxy, &timeout_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FinishedContext finished_context;
|
|
|
|
FinishedContext finished_context;
|
|
|
|
void * finished_data = reinterpret_cast<void*>(&finished_context);
|
|
|
|
void * finished_data = reinterpret_cast<void*>(&finished_context);
|
|
|
|
jsonrpc_proxy_invoke(&proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42);
|
|
|
|
jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42);
|
|
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(send_context.is_called);
|
|
|
|
ASSERT_TRUE(send_context.is_called);
|
|
|
|
ASSERT_TRUE(json_is_object(send_context.response));
|
|
|
|
ASSERT_TRUE(json_is_object(send_context.response));
|
|
|
@ -279,12 +272,12 @@ TEST(jsonrpc_proxy, on_result_reject_response_with_unknown_id)
|
|
|
|
json_object_set_new(response, "result", json_string("okay"));
|
|
|
|
json_object_set_new(response, "result", json_string("okay"));
|
|
|
|
json_object_set_new(response, "id", json_integer(1 + json_integer_value(id)));
|
|
|
|
json_object_set_new(response, "id", json_integer(1 + json_integer_value(id)));
|
|
|
|
|
|
|
|
|
|
|
|
jsonrpc_proxy_onresult(&proxy, response);
|
|
|
|
jsonrpc_proxy_onresult(proxy, response);
|
|
|
|
json_decref(response);
|
|
|
|
json_decref(response);
|
|
|
|
|
|
|
|
|
|
|
|
ASSERT_FALSE(finished_context.is_called);
|
|
|
|
ASSERT_FALSE(finished_context.is_called);
|
|
|
|
|
|
|
|
|
|
|
|
jsonrpc_proxy_cleanup(&proxy);
|
|
|
|
jsonrpc_proxy_dispose(proxy);
|
|
|
|
wf_impl_timeout_manager_cleanup(&timeout_manager);
|
|
|
|
wf_impl_timeout_manager_cleanup(&timeout_manager);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -295,12 +288,11 @@ TEST(jsonrpc_proxy, timeout)
|
|
|
|
|
|
|
|
|
|
|
|
SendContext send_context;
|
|
|
|
SendContext send_context;
|
|
|
|
void * send_data = reinterpret_cast<void*>(&send_context);
|
|
|
|
void * send_data = reinterpret_cast<void*>(&send_context);
|
|
|
|
struct jsonrpc_proxy proxy;
|
|
|
|
struct jsonrpc_proxy * proxy = jsonrpc_proxy_create(&timeout_manager, 0, &jsonrpc_send, send_data);
|
|
|
|
jsonrpc_proxy_init(&proxy, &timeout_manager, 0, &jsonrpc_send, send_data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FinishedContext finished_context;
|
|
|
|
FinishedContext finished_context;
|
|
|
|
void * finished_data = reinterpret_cast<void*>(&finished_context);
|
|
|
|
void * finished_data = reinterpret_cast<void*>(&finished_context);
|
|
|
|
jsonrpc_proxy_invoke(&proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42);
|
|
|
|
jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42);
|
|
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(send_context.is_called);
|
|
|
|
ASSERT_TRUE(send_context.is_called);
|
|
|
|
ASSERT_TRUE(json_is_object(send_context.response));
|
|
|
|
ASSERT_TRUE(json_is_object(send_context.response));
|
|
|
@ -311,7 +303,7 @@ TEST(jsonrpc_proxy, timeout)
|
|
|
|
ASSERT_TRUE(finished_context.is_called);
|
|
|
|
ASSERT_TRUE(finished_context.is_called);
|
|
|
|
ASSERT_EQ(WF_BAD_TIMEOUT, wf_impl_jsonrpc_get_status(finished_context.error));
|
|
|
|
ASSERT_EQ(WF_BAD_TIMEOUT, wf_impl_jsonrpc_get_status(finished_context.error));
|
|
|
|
|
|
|
|
|
|
|
|
jsonrpc_proxy_cleanup(&proxy);
|
|
|
|
jsonrpc_proxy_dispose(proxy);
|
|
|
|
wf_impl_timeout_manager_cleanup(&timeout_manager);
|
|
|
|
wf_impl_timeout_manager_cleanup(&timeout_manager);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -322,12 +314,11 @@ TEST(jsonrpc_proxy, cleanup_pending_request)
|
|
|
|
|
|
|
|
|
|
|
|
SendContext send_context;
|
|
|
|
SendContext send_context;
|
|
|
|
void * send_data = reinterpret_cast<void*>(&send_context);
|
|
|
|
void * send_data = reinterpret_cast<void*>(&send_context);
|
|
|
|
struct jsonrpc_proxy proxy;
|
|
|
|
struct jsonrpc_proxy * proxy = jsonrpc_proxy_create(&timeout_manager, 10, &jsonrpc_send, send_data);
|
|
|
|
jsonrpc_proxy_init(&proxy, &timeout_manager, 10, &jsonrpc_send, send_data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FinishedContext finished_context;
|
|
|
|
FinishedContext finished_context;
|
|
|
|
void * finished_data = reinterpret_cast<void*>(&finished_context);
|
|
|
|
void * finished_data = reinterpret_cast<void*>(&finished_context);
|
|
|
|
jsonrpc_proxy_invoke(&proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42);
|
|
|
|
jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42);
|
|
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(send_context.is_called);
|
|
|
|
ASSERT_TRUE(send_context.is_called);
|
|
|
|
ASSERT_TRUE(json_is_object(send_context.response));
|
|
|
|
ASSERT_TRUE(json_is_object(send_context.response));
|
|
|
@ -335,7 +326,7 @@ TEST(jsonrpc_proxy, cleanup_pending_request)
|
|
|
|
ASSERT_FALSE(finished_context.is_called);
|
|
|
|
ASSERT_FALSE(finished_context.is_called);
|
|
|
|
ASSERT_NE(nullptr, timeout_manager.timers);
|
|
|
|
ASSERT_NE(nullptr, timeout_manager.timers);
|
|
|
|
|
|
|
|
|
|
|
|
jsonrpc_proxy_cleanup(&proxy);
|
|
|
|
jsonrpc_proxy_dispose(proxy);
|
|
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(finished_context.is_called);
|
|
|
|
ASSERT_TRUE(finished_context.is_called);
|
|
|
|
ASSERT_EQ(nullptr, timeout_manager.timers);
|
|
|
|
ASSERT_EQ(nullptr, timeout_manager.timers);
|
|
|
@ -352,10 +343,9 @@ TEST(jsonrpc_proxy, notify)
|
|
|
|
|
|
|
|
|
|
|
|
SendContext send_context;
|
|
|
|
SendContext send_context;
|
|
|
|
void * send_data = reinterpret_cast<void*>(&send_context);
|
|
|
|
void * send_data = reinterpret_cast<void*>(&send_context);
|
|
|
|
struct jsonrpc_proxy proxy;
|
|
|
|
struct jsonrpc_proxy * proxy = jsonrpc_proxy_create(&timeout_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data);
|
|
|
|
jsonrpc_proxy_init(&proxy, &timeout_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jsonrpc_proxy_notify(&proxy, "foo", "si", "bar", 42);
|
|
|
|
jsonrpc_proxy_notify(proxy, "foo", "si", "bar", 42);
|
|
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(send_context.is_called);
|
|
|
|
ASSERT_TRUE(send_context.is_called);
|
|
|
|
ASSERT_TRUE(json_is_object(send_context.response));
|
|
|
|
ASSERT_TRUE(json_is_object(send_context.response));
|
|
|
@ -376,7 +366,7 @@ TEST(jsonrpc_proxy, notify)
|
|
|
|
ASSERT_EQ(nullptr, id);
|
|
|
|
ASSERT_EQ(nullptr, id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jsonrpc_proxy_cleanup(&proxy);
|
|
|
|
jsonrpc_proxy_dispose(proxy);
|
|
|
|
wf_impl_timeout_manager_cleanup(&timeout_manager);
|
|
|
|
wf_impl_timeout_manager_cleanup(&timeout_manager);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -387,13 +377,12 @@ TEST(jsonrpc_proxy, notify_dont_send_invalid_request)
|
|
|
|
|
|
|
|
|
|
|
|
SendContext send_context;
|
|
|
|
SendContext send_context;
|
|
|
|
void * send_data = reinterpret_cast<void*>(&send_context);
|
|
|
|
void * send_data = reinterpret_cast<void*>(&send_context);
|
|
|
|
struct jsonrpc_proxy proxy;
|
|
|
|
struct jsonrpc_proxy * proxy = jsonrpc_proxy_create(&timeout_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data);
|
|
|
|
jsonrpc_proxy_init(&proxy, &timeout_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jsonrpc_proxy_notify(&proxy, "foo", "?");
|
|
|
|
jsonrpc_proxy_notify(proxy, "foo", "?");
|
|
|
|
|
|
|
|
|
|
|
|
ASSERT_FALSE(send_context.is_called);
|
|
|
|
ASSERT_FALSE(send_context.is_called);
|
|
|
|
|
|
|
|
|
|
|
|
jsonrpc_proxy_cleanup(&proxy);
|
|
|
|
jsonrpc_proxy_dispose(proxy);
|
|
|
|
wf_impl_timeout_manager_cleanup(&timeout_manager);
|
|
|
|
wf_impl_timeout_manager_cleanup(&timeout_manager);
|
|
|
|
}
|
|
|
|
}
|
|
|
|