From 924c858c8f382609dc4b665b3720a5e1a894e2bd Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Mon, 28 Oct 2013 01:08:09 +0900 Subject: [PATCH] tests: Add SETTINGS_HEADER_TABLE_SIZE test case --- tests/nghttp2_session_test.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/nghttp2_session_test.c b/tests/nghttp2_session_test.c index f21bed0e..c6dd8e6a 100644 --- a/tests/nghttp2_session_test.c +++ b/tests/nghttp2_session_test.c @@ -2236,7 +2236,7 @@ void test_nghttp2_submit_settings(void) my_user_data ud; nghttp2_outbound_item *item; nghttp2_frame *frame; - nghttp2_settings_entry iv[5]; + nghttp2_settings_entry iv[6]; nghttp2_frame ack_frame; iv[0].settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS; @@ -2251,17 +2251,20 @@ void test_nghttp2_submit_settings(void) iv[3].settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS; iv[3].value = 50; - /* Attempt to re-enable flow-control */ - iv[4].settings_id = NGHTTP2_SETTINGS_FLOW_CONTROL_OPTIONS; + iv[4].settings_id = NGHTTP2_SETTINGS_HEADER_TABLE_SIZE; iv[4].value = 0; + /* Attempt to re-enable flow-control */ + iv[5].settings_id = NGHTTP2_SETTINGS_FLOW_CONTROL_OPTIONS; + iv[5].value = 0; + memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); callbacks.send_callback = null_send_callback; callbacks.on_frame_send_callback = on_frame_send_callback; nghttp2_session_server_new(&session, &callbacks, &ud); CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == - nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 5)); + nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 6)); /* Make sure that local settings are not changed */ CU_ASSERT(NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS == @@ -2271,15 +2274,15 @@ void test_nghttp2_submit_settings(void) CU_ASSERT(0 == session->local_settings[NGHTTP2_SETTINGS_FLOW_CONTROL_OPTIONS]); - /* Now sends without 5th one */ - CU_ASSERT(0 == nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 4)); + /* Now sends without 6th one */ + CU_ASSERT(0 == nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 5)); item = nghttp2_session_get_next_ob_item(session); CU_ASSERT(NGHTTP2_SETTINGS == OB_CTRL_TYPE(item)); frame = item->frame; - CU_ASSERT(4 == frame->settings.niv); + CU_ASSERT(5 == frame->settings.niv); CU_ASSERT(5 == frame->settings.iv[0].value); CU_ASSERT(NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS == frame->settings.iv[0].settings_id); @@ -2305,6 +2308,7 @@ void test_nghttp2_submit_settings(void) CU_ASSERT(1 == session->local_settings[NGHTTP2_SETTINGS_FLOW_CONTROL_OPTIONS]); CU_ASSERT(0 == session->local_flow_control); + CU_ASSERT(0 == session->hd_inflater.hd_table_bufsize_max); nghttp2_session_del(session); }