void test_nghttp2_submit_priority(void) {
  nghttp2_session *session;
  nghttp2_session_callbacks callbacks;
  nghttp2_stream *stream;
  my_user_data ud;
  nghttp2_priority_spec pri_spec;

  memset(&callbacks, 0, sizeof(nghttp2_session_callbacks));
  callbacks.send_callback = null_send_callback;
  callbacks.on_frame_send_callback = on_frame_send_callback;

  nghttp2_session_client_new(&session, &callbacks, &ud);
  stream = open_sent_stream(session, 1);

  nghttp2_priority_spec_init(&pri_spec, 0, 3, 0);

  /* depends on stream 0 */
  CU_ASSERT(0 ==
            nghttp2_submit_priority(session, NGHTTP2_FLAG_NONE, 1, &pri_spec));
  CU_ASSERT(0 == nghttp2_session_send(session));
  CU_ASSERT(3 == stream->weight);

  /* submit against idle stream */
  CU_ASSERT(0 ==
            nghttp2_submit_priority(session, NGHTTP2_FLAG_NONE, 3, &pri_spec));

  ud.frame_send_cb_called = 0;
  CU_ASSERT(0 == nghttp2_session_send(session));
  CU_ASSERT(1 == ud.frame_send_cb_called);

  nghttp2_session_del(session);
}
void test_nghttp2_submit_priority(void) {
  nghttp2_session *session;
  nghttp2_session_callbacks callbacks;
  nghttp2_stream *stream;
  my_user_data ud;
  nghttp2_priority_spec pri_spec;

  memset(&callbacks, 0, sizeof(nghttp2_session_callbacks));
  callbacks.send_callback = null_send_callback;
  callbacks.on_frame_send_callback = on_frame_send_callback;

  nghttp2_session_client_new(&session, &callbacks, &ud);
  stream = open_sent_stream(session, 1);

  nghttp2_priority_spec_init(&pri_spec, 0, 3, 0);

   
  CU_ASSERT(0 ==
            nghttp2_submit_priority(session, NGHTTP2_FLAG_NONE, 1, &pri_spec));
  CU_ASSERT(0 == nghttp2_session_send(session));
  CU_ASSERT(3 == stream->weight);

   
  CU_ASSERT(0 ==
            nghttp2_submit_priority(session, NGHTTP2_FLAG_NONE, 3, &pri_spec));

  ud.frame_send_cb_called = 0;
  CU_ASSERT(0 == nghttp2_session_send(session));
  CU_ASSERT(1 == ud.frame_send_cb_called);

  nghttp2_session_del(session);
}