Imported Upstream version 1.41.0
[platform/upstream/grpc.git] / test / core / transport / byte_stream_test.cc
index 6c54389..014bb1d 100644 (file)
@@ -18,6 +18,8 @@
 
 #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 {
 
@@ -37,7 +36,9 @@ 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;
@@ -62,7 +63,7 @@ TEST(SliceBufferByteStream, Basic) {
   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);
@@ -93,12 +94,12 @@ TEST(SliceBufferByteStream, Shutdown) {
   // 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.
@@ -140,7 +141,7 @@ TEST(CachingByteStream, Basic) {
   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);
@@ -173,7 +174,7 @@ TEST(CachingByteStream, Reset) {
   // 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);
@@ -216,7 +217,7 @@ TEST(CachingByteStream, SharedCache) {
   // 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);
@@ -244,9 +245,9 @@ TEST(CachingByteStream, SharedCache) {
 }  // 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;