aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/end2end/cq_verifier.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/end2end/cq_verifier.c')
-rw-r--r--test/core/end2end/cq_verifier.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/test/core/end2end/cq_verifier.c b/test/core/end2end/cq_verifier.c
index 57373970c4..9b0106ec84 100644
--- a/test/core/end2end/cq_verifier.c
+++ b/test/core/end2end/cq_verifier.c
@@ -92,8 +92,8 @@ static int has_metadata(const grpc_metadata *md, size_t count, const char *key,
const char *value) {
size_t i;
for (i = 0; i < count; i++) {
- if (0 == strcmp(key, md[i].key) && strlen(value) == md[i].value_length &&
- 0 == memcmp(md[i].value, value, md[i].value_length)) {
+ if (0 == grpc_slice_str_cmp(md[i].key, key) &&
+ 0 == grpc_slice_str_cmp(md[i].value, value)) {
return 1;
}
}
@@ -105,6 +105,22 @@ int contains_metadata(grpc_metadata_array *array, const char *key,
return has_metadata(array->metadata, array->count, key, value);
}
+static int has_metadata_slices(const grpc_metadata *md, size_t count,
+ grpc_slice key, grpc_slice value) {
+ size_t i;
+ for (i = 0; i < count; i++) {
+ if (grpc_slice_eq(md[i].key, key) && grpc_slice_eq(md[i].value, value)) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+int contains_metadata_slices(grpc_metadata_array *array, grpc_slice key,
+ grpc_slice value) {
+ return has_metadata_slices(array->metadata, array->count, key, value);
+}
+
static grpc_slice merge_slices(grpc_slice *slices, size_t nslices) {
size_t i;
size_t len = 0;
@@ -233,7 +249,7 @@ static void fail_no_event_received(cq_verifier *v) {
}
void cq_verify(cq_verifier *v) {
- const gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10);
+ const gpr_timespec deadline = grpc_timeout_seconds_to_deadline(10);
while (v->first_expectation != NULL) {
grpc_event ev = grpc_completion_queue_next(v->cq, deadline, NULL);
if (ev.type == GRPC_QUEUE_TIMEOUT) {