reviewable/pr12677/r1
Craig Tiller 7 years ago
parent a16be228f8
commit 12b29ec5f3
  1. 8
      test/core/transport/bdp_estimator_test.c

@ -58,16 +58,18 @@ static void add_samples(grpc_bdp_estimator *estimator, int64_t *samples,
size_t n) { size_t n) {
grpc_bdp_estimator_add_incoming_bytes(estimator, 1234567); grpc_bdp_estimator_add_incoming_bytes(estimator, 1234567);
inc_time(); inc_time();
GPR_ASSERT(grpc_bdp_estimator_need_ping(estimator) == true); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
GPR_ASSERT(grpc_bdp_estimator_need_ping(&exec_ctx, estimator) == true);
grpc_bdp_estimator_schedule_ping(estimator); grpc_bdp_estimator_schedule_ping(estimator);
grpc_bdp_estimator_start_ping(estimator); grpc_bdp_estimator_start_ping(estimator);
for (size_t i = 0; i < n; i++) { for (size_t i = 0; i < n; i++) {
grpc_bdp_estimator_add_incoming_bytes(estimator, samples[i]); grpc_bdp_estimator_add_incoming_bytes(estimator, samples[i]);
GPR_ASSERT(grpc_bdp_estimator_need_ping(estimator) == false); GPR_ASSERT(grpc_bdp_estimator_need_ping(&exec_ctx, estimator) == false);
} }
gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
gpr_time_from_millis(1, GPR_TIMESPAN))); gpr_time_from_millis(1, GPR_TIMESPAN)));
grpc_bdp_estimator_complete_ping(estimator); grpc_bdp_estimator_complete_ping(&exec_ctx, estimator);
grpc_exec_ctx_finish(&exec_ctx);
} }
static void add_sample(grpc_bdp_estimator *estimator, int64_t sample) { static void add_sample(grpc_bdp_estimator *estimator, int64_t sample) {

Loading…
Cancel
Save