src/lib/fidl/c/walker_tests/decoding_tests.cc
// Most fidl_encode_etc code paths are covered by the fidl_encode tests.
// The FidlDecodeEtc tests cover additional paths.
Most fidl_encode_etc code paths are covered by the fidl_encode tests.
The FidlDecodeEtc tests cover additional paths.
Most fidl_encode_etc code paths are covered by the fidl_encode tests . The FidlDecodeEtc tests cover additional paths .
TEST(FidlDecodeEtc, decode_invalid_handle_info) {
  nonnullable_handle_message_layout message = {};
  message.inline_struct.handle = FIDL_HANDLE_PRESENT;
  zx_handle_info_t handle_infos[] = {{
      .handle = ZX_HANDLE_INVALID,
      .type = ZX_OBJ_TYPE_NONE,
      .rights = 0,
      .unused = 0,
  }};
  const char* error = nullptr;
  auto status = fidl_decode_etc(&nonnullable_handle_message_type, &message, sizeof(message),
                                handle_infos, ArrayCount(handle_infos), &error);
  EXPECT_EQ(status, ZX_ERR_INVALID_ARGS);
  EXPECT_NOT_NULL(error);
  const char expected_error_msg[] = "invalid handle detected in handle table";
  EXPECT_STR_EQ(expected_error_msg, error, "wrong error msg");
}
TEST ( FidlDecodeEtc , decode_invalid_handle_info ) { nonnullable_handle_message_layout message = { } ; message . inline_struct . handle = FIDL_HANDLE_PRESENT ; zx_handle_info_t handle_infos [ ] = { { . handle = ZX_HANDLE_INVALID , . type = ZX_OBJ_TYPE_NONE , . rights = 0 , . unused = 0 , } } ; const char * error = nullptr ; auto status = fidl_decode_etc ( & nonnullable_handle_message_type , & message , sizeof ( message ) , handle_infos , ArrayCount ( handle_infos ) , & error ) ; EXPECT_EQ ( status , ZX_ERR_INVALID_ARGS ) ; EXPECT_NOT_NULL ( error ) ; const char expected_error_msg [ ] = " " ; EXPECT_STR_EQ ( expected_error_msg , error , " " ) ; }
Most fidl_encode_etc code paths are covered by the fidl_encode tests.
Most fidl_encode_etc code paths are covered by the fidl_encode tests .