#include "src/core/lib/transport/byte_stream.h"
+#include <gtest/gtest.h>
+
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
-
#include "test/core/util/test_config.h"
-#include <gtest/gtest.h>
-
namespace grpc_core {
namespace {
// SliceBufferByteStream tests
//
-void NotCalledClosure(void* arg, grpc_error* error) { GPR_ASSERT(false); }
+void NotCalledClosure(void* /*arg*/, grpc_error_handle /*error*/) {
+ GPR_ASSERT(false);
+}
TEST(SliceBufferByteStream, Basic) {
grpc_core::ExecCtx exec_ctx;
for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) {
ASSERT_TRUE(stream.Next(~(size_t)0, &closure));
grpc_slice output;
- grpc_error* error = stream.Pull(&output);
+ grpc_error_handle error = stream.Pull(&output);
EXPECT_TRUE(error == GRPC_ERROR_NONE);
EXPECT_TRUE(grpc_slice_eq(input[i], output));
grpc_slice_unref_internal(output);
// Read the first slice.
ASSERT_TRUE(stream.Next(~(size_t)0, &closure));
grpc_slice output;
- grpc_error* error = stream.Pull(&output);
+ grpc_error_handle error = stream.Pull(&output);
EXPECT_TRUE(error == GRPC_ERROR_NONE);
EXPECT_TRUE(grpc_slice_eq(input[0], output));
grpc_slice_unref_internal(output);
// Now shutdown.
- grpc_error* shutdown_error =
+ grpc_error_handle shutdown_error =
GRPC_ERROR_CREATE_FROM_STATIC_STRING("shutdown error");
stream.Shutdown(GRPC_ERROR_REF(shutdown_error));
// After shutdown, the next pull() should return the error.
for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) {
ASSERT_TRUE(stream.Next(~(size_t)0, &closure));
grpc_slice output;
- grpc_error* error = stream.Pull(&output);
+ grpc_error_handle error = stream.Pull(&output);
EXPECT_TRUE(error == GRPC_ERROR_NONE);
EXPECT_TRUE(grpc_slice_eq(input[i], output));
grpc_slice_unref_internal(output);
// Read one slice.
ASSERT_TRUE(stream.Next(~(size_t)0, &closure));
grpc_slice output;
- grpc_error* error = stream.Pull(&output);
+ grpc_error_handle error = stream.Pull(&output);
EXPECT_TRUE(error == GRPC_ERROR_NONE);
EXPECT_TRUE(grpc_slice_eq(input[0], output));
grpc_slice_unref_internal(output);
// Read one slice from stream1.
EXPECT_TRUE(stream1.Next(~(size_t)0, &closure));
grpc_slice output;
- grpc_error* error = stream1.Pull(&output);
+ grpc_error_handle error = stream1.Pull(&output);
EXPECT_TRUE(error == GRPC_ERROR_NONE);
EXPECT_TRUE(grpc_slice_eq(input[0], output));
grpc_slice_unref_internal(output);
} // namespace grpc_core
int main(int argc, char** argv) {
- grpc_init();
grpc::testing::TestEnvironment env(argc, argv);
::testing::InitGoogleTest(&argc, argv);
+ grpc_init();
int retval = RUN_ALL_TESTS();
grpc_shutdown();
return retval;