From fd287182adcf0a65c3130980b492d5add0fbe88a Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Mon, 13 May 2024 18:39:17 +0000 Subject: [PATCH] code review changes --- test/core/channelz/channel_trace_test.cc | 2 +- test/cpp/util/channel_trace_proto_helper.cc | 18 +++++++++--------- test/cpp/util/channel_trace_proto_helper.h | 18 +++++++++--------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/test/core/channelz/channel_trace_test.cc b/test/core/channelz/channel_trace_test.cc index a465613e12a..59adb4fefda 100644 --- a/test/core/channelz/channel_trace_test.cc +++ b/test/core/channelz/channel_trace_test.cc @@ -163,7 +163,7 @@ MATCHER_P(IsEmptyChannelTrace, num_events_logged_expected, void ValidateJsonProtoTranslation(const Json& json) { std::string json_str = JsonDump(json); - grpc::testing::ValidateChannelTraceProtoJsonTranslation(json_str.c_str()); + grpc::testing::ValidateChannelTraceProtoJsonTranslation(json_str); } } // anonymous namespace diff --git a/test/cpp/util/channel_trace_proto_helper.cc b/test/cpp/util/channel_trace_proto_helper.cc index 9b08718b726..37a9898007e 100644 --- a/test/cpp/util/channel_trace_proto_helper.cc +++ b/test/cpp/util/channel_trace_proto_helper.cc @@ -41,7 +41,7 @@ namespace { // then back to json. This ensures that the json string was correctly formatted // according to https://developers.google.com/protocol-buffers/docs/proto3#json template -void VaidateProtoJsonTranslation(const std::string& json_str) { +void VaidateProtoJsonTranslation(absl::string_view json_str) { Message msg; grpc::protobuf::json::JsonParseOptions parse_options; // If the following line is failing, then uncomment the last line of the @@ -73,42 +73,42 @@ void VaidateProtoJsonTranslation(const std::string& json_str) { namespace testing { -void ValidateChannelTraceProtoJsonTranslation(const std::string& json_string) { +void ValidateChannelTraceProtoJsonTranslation(absl::string_view json_string) { VaidateProtoJsonTranslation(json_string); } -void ValidateChannelProtoJsonTranslation(const std::string& json_string) { +void ValidateChannelProtoJsonTranslation(absl::string_view json_string) { VaidateProtoJsonTranslation(json_string); } void ValidateGetTopChannelsResponseProtoJsonTranslation( - const std::string& json_string) { + absl::string_view json_string) { VaidateProtoJsonTranslation( json_string); } void ValidateGetChannelResponseProtoJsonTranslation( - const std::string& json_string) { + absl::string_view json_string) { VaidateProtoJsonTranslation( json_string); } void ValidateGetServerResponseProtoJsonTranslation( - const std::string& json_string) { + absl::string_view json_string) { VaidateProtoJsonTranslation( json_string); } -void ValidateSubchannelProtoJsonTranslation(const std::string& json_string) { +void ValidateSubchannelProtoJsonTranslation(absl::string_view json_string) { VaidateProtoJsonTranslation(json_string); } -void ValidateServerProtoJsonTranslation(const std::string& json_string) { +void ValidateServerProtoJsonTranslation(absl::string_view json_string) { VaidateProtoJsonTranslation(json_string); } void ValidateGetServersResponseProtoJsonTranslation( - const std::string& json_string) { + absl::string_view json_string) { VaidateProtoJsonTranslation( json_string); } diff --git a/test/cpp/util/channel_trace_proto_helper.h b/test/cpp/util/channel_trace_proto_helper.h index a808f147d5a..0d5cafd4a16 100644 --- a/test/cpp/util/channel_trace_proto_helper.h +++ b/test/cpp/util/channel_trace_proto_helper.h @@ -19,23 +19,23 @@ #ifndef GRPC_TEST_CPP_UTIL_CHANNEL_TRACE_PROTO_HELPER_H #define GRPC_TEST_CPP_UTIL_CHANNEL_TRACE_PROTO_HELPER_H -#include +#include "absl/strings/string_view.h" namespace grpc { namespace testing { -void ValidateChannelTraceProtoJsonTranslation(const std::string& json_string); -void ValidateChannelProtoJsonTranslation(const std::string& json_string); +void ValidateChannelTraceProtoJsonTranslation(absl::string_view json_string); +void ValidateChannelProtoJsonTranslation(absl::string_view json_string); void ValidateGetTopChannelsResponseProtoJsonTranslation( - const std::string& json_string); + absl::string_view json_string); void ValidateGetChannelResponseProtoJsonTranslation( - const std::string& json_string); + absl::string_view json_string); void ValidateGetServerResponseProtoJsonTranslation( - const std::string& json_string); -void ValidateSubchannelProtoJsonTranslation(const std::string& json_string); -void ValidateServerProtoJsonTranslation(const std::string& json_string); + absl::string_view json_string); +void ValidateSubchannelProtoJsonTranslation(absl::string_view json_string); +void ValidateServerProtoJsonTranslation(absl::string_view json_string); void ValidateGetServersResponseProtoJsonTranslation( - const std::string& json_string); + absl::string_view json_string); } // namespace testing } // namespace grpc