aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2018-11-29 01:26:45 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2018-11-29 01:26:45 -0800
commit9506d356740f8375f121e00e057a2eba41c97a98 (patch)
tree7ed16ae19b1478f2a13398205859ace41f47ef0c /test/core
parentfe4ef31ac28f702755c67cb0d79140bc9cbaa552 (diff)
Add a byte counter to chttp2_stream and use that for timestamps
Diffstat (limited to 'test/core')
-rw-r--r--test/core/transport/chttp2/context_list_test.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/core/transport/chttp2/context_list_test.cc b/test/core/transport/chttp2/context_list_test.cc
index e2100899d3..d61f32985e 100644
--- a/test/core/transport/chttp2/context_list_test.cc
+++ b/test/core/transport/chttp2/context_list_test.cc
@@ -33,8 +33,12 @@
namespace grpc_core {
namespace testing {
namespace {
+
+const int kByteOffset = 123;
+
void TestExecuteFlushesListVerifier(void* arg, grpc_core::Timestamps* ts) {
- GPR_ASSERT(arg != nullptr);
+ ASSERT_NE(arg, nullptr);
+ EXPECT_EQ(ts->byte_offset, kByteOffset);
gpr_atm* done = reinterpret_cast<gpr_atm*>(arg);
gpr_atm_rel_store(done, static_cast<gpr_atm>(1));
}
@@ -43,7 +47,7 @@ void discard_write(grpc_slice slice) {}
/** Tests that all ContextList elements in the list are flushed out on
* execute.
- * Also tests that arg is passed correctly.
+ * Also tests that arg and byte_counter are passed correctly.
*/
TEST(ContextList, ExecuteFlushesList) {
grpc_core::ContextList* list = nullptr;
@@ -68,14 +72,14 @@ TEST(ContextList, ExecuteFlushesList) {
reinterpret_cast<grpc_stream*>(s[i]), &ref,
nullptr, nullptr);
s[i]->context = &verifier_called[i];
+ s[i]->byte_counter = kByteOffset;
gpr_atm_rel_store(&verifier_called[i], static_cast<gpr_atm>(0));
grpc_core::ContextList::Append(&list, s[i]);
}
grpc_core::Timestamps ts;
grpc_core::ContextList::Execute(list, &ts, GRPC_ERROR_NONE);
for (auto i = 0; i < kNumElems; i++) {
- GPR_ASSERT(gpr_atm_acq_load(&verifier_called[i]) ==
- static_cast<gpr_atm>(1));
+ EXPECT_EQ(gpr_atm_acq_load(&verifier_called[i]), static_cast<gpr_atm>(1));
grpc_transport_destroy_stream(reinterpret_cast<grpc_transport*>(t),
reinterpret_cast<grpc_stream*>(s[i]),
nullptr);