Added test for EOF from recv_callback.
This commit is contained in:
parent
88599228f8
commit
164312d857
|
@ -158,6 +158,8 @@ int main(int argc, char* argv[])
|
|||
test_spdylay_submit_window_update) ||
|
||||
!CU_add_test(pSuite, "session_data_read_temporal_failure",
|
||||
test_spdylay_session_data_read_temporal_failure) ||
|
||||
!CU_add_test(pSuite, "session_recv_eof",
|
||||
test_spdylay_session_recv_eof) ||
|
||||
!CU_add_test(pSuite, "frame_unpack_nv_spdy2",
|
||||
test_spdylay_frame_unpack_nv_spdy2) ||
|
||||
!CU_add_test(pSuite, "frame_unpack_nv_spdy3",
|
||||
|
|
|
@ -105,6 +105,13 @@ static ssize_t scripted_recv_callback(spdylay_session *session,
|
|||
return wlen;
|
||||
}
|
||||
|
||||
static ssize_t eof_recv_callback(spdylay_session *session,
|
||||
uint8_t* data, size_t len, int flags,
|
||||
void *user_data)
|
||||
{
|
||||
return SPDYLAY_ERR_EOF;
|
||||
}
|
||||
|
||||
static ssize_t accumulator_send_callback(spdylay_session *session,
|
||||
const uint8_t *buf, size_t len,
|
||||
int flags, void* user_data)
|
||||
|
@ -2399,3 +2406,20 @@ void test_spdylay_session_data_read_temporal_failure(void)
|
|||
|
||||
spdylay_session_del(session);
|
||||
}
|
||||
|
||||
void test_spdylay_session_recv_eof(void)
|
||||
{
|
||||
spdylay_session *session;
|
||||
spdylay_session_callbacks callbacks;
|
||||
|
||||
memset(&callbacks, 0, sizeof(spdylay_session_callbacks));
|
||||
callbacks.send_callback = null_send_callback;
|
||||
callbacks.recv_callback = eof_recv_callback;
|
||||
|
||||
spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY3,
|
||||
&callbacks, NULL);
|
||||
|
||||
CU_ASSERT(SPDYLAY_ERR_EOF == spdylay_session_recv(session));
|
||||
|
||||
spdylay_session_del(session);
|
||||
}
|
||||
|
|
|
@ -70,5 +70,6 @@ void test_spdylay_session_set_initial_client_cert_origin(void);
|
|||
void test_spdylay_session_set_option(void);
|
||||
void test_spdylay_submit_window_update(void);
|
||||
void test_spdylay_session_data_read_temporal_failure(void);
|
||||
void test_spdylay_session_recv_eof(void);
|
||||
|
||||
#endif /* SPDYLAY_SESSION_TEST_H */
|
||||
|
|
Loading…
Reference in New Issue