Beispiel #1
0
static void bad_candidate_test(NiceAgent *lagent,NiceAgent *ragent)
{
  NiceCandidate *cand =  NULL;

  g_debug ("test-dribblemode:%s", G_STRFUNC);

  init_test (lagent, ragent, FALSE);

  nice_agent_gather_candidates (lagent, global_ls_id);
  while (!got_stun_packet)
    g_main_context_iteration (NULL, TRUE);
  g_cancellable_reset (global_cancellable);
  g_assert (global_lagent_state == NICE_COMPONENT_STATE_GATHERING &&
            !lagent_candidate_gathering_done);

  nice_agent_gather_candidates (ragent, global_rs_id);
  while (!ragent_candidate_gathering_done)
      g_main_context_iteration (NULL, TRUE);
  g_cancellable_reset (global_cancellable);

  g_assert (ragent_candidate_gathering_done);

  add_bad_candidate (lagent, global_ls_id, cand);

  // lagent will finish candidate gathering causing this mainloop to quit
  while (!lagent_candidate_gathering_done)
    g_main_context_iteration (NULL, TRUE);
  g_cancellable_reset (global_cancellable);

  // connchecks will fail causing this mainloop to quit
  while (global_lagent_state != NICE_COMPONENT_STATE_FAILED)
    g_main_context_iteration (NULL, TRUE);
  g_cancellable_reset (global_cancellable);

  g_assert (global_lagent_state == NICE_COMPONENT_STATE_FAILED &&
            !data_received);
  set_credentials (lagent, global_ls_id, ragent, global_rs_id);

  swap_candidates (ragent, global_rs_id,
                   lagent, global_ls_id,
                   FALSE);

  swap_candidates (lagent, global_ls_id,
                   ragent, global_rs_id,
                   FALSE);

  while (!data_received)
    g_main_context_iteration (NULL, TRUE);
  g_cancellable_reset (global_cancellable);

  g_assert (lagent_candidate_gathering_done);

  g_assert (global_lagent_state >= NICE_COMPONENT_STATE_CONNECTED);
  g_assert (global_ragent_state >= NICE_COMPONENT_STATE_CONNECTED);

  cleanup (lagent, ragent);
}
Beispiel #2
0
static void bad_candidate_test(NiceAgent *lagent,NiceAgent *ragent)
{
  NiceCandidate *cand =  NULL;

  g_debug ("test-dribblemode:%s", G_STRFUNC);

  init_test (lagent, ragent, FALSE);

  nice_agent_gather_candidates (lagent, global_ls_id);
  g_main_loop_run (global_mainloop);
  g_assert (global_lagent_state == NICE_COMPONENT_STATE_GATHERING &&
            !lagent_candidate_gathering_done);

  nice_agent_gather_candidates (ragent, global_rs_id);
  if (!ragent_candidate_gathering_done) {
    g_main_loop_run (global_mainloop);
    g_assert (ragent_candidate_gathering_done);
  }

  add_bad_candidate (lagent, global_ls_id, cand);

  // lagent will finish candidate gathering causing this mainloop to quit
  g_main_loop_run (global_mainloop);

  // connchecks will fail causing this mainloop to quit
  g_main_loop_run (global_mainloop);

  g_assert (global_lagent_state == NICE_COMPONENT_STATE_FAILED &&
            !data_received);
  set_credentials (lagent, global_ls_id, ragent, global_rs_id);

  swap_candidates (ragent, global_rs_id,
                   lagent, global_ls_id,
                   FALSE);

  swap_candidates (lagent, global_ls_id,
                   ragent, global_rs_id,
                   FALSE);

  g_main_loop_run (global_mainloop);

  g_assert (lagent_candidate_gathering_done);

  g_assert (global_lagent_state == NICE_COMPONENT_STATE_READY);
  g_assert (global_ragent_state >= NICE_COMPONENT_STATE_CONNECTED);

  cleanup (lagent, ragent);
}