Go to the documentation of this file.
19 #include <condition_variable>
21 #include <gtest/gtest.h>
25 #include "src/proto/grpc/testing/echo.grpc.pb.h"
42 POST_RECV_INITIAL_METADATA)) {
108 const char* suffix_for_stats)
143 auto client_metadata =
context->client_metadata();
144 for (
const auto&
pair : client_metadata) {
156 auto client_metadata =
context->client_metadata();
157 for (
const auto&
pair : client_metadata) {
162 resp.set_message(
req.message());
170 EchoResponse*
resp)
override {
171 auto client_metadata =
context->client_metadata();
172 for (
const auto&
pair : client_metadata) {
177 string response_str =
"";
179 response_str +=
req.message();
181 resp->set_message(response_str);
187 auto client_metadata =
context->client_metadata();
188 for (
const auto&
pair : client_metadata) {
193 resp.set_message(
req->message());
194 for (
int i = 0;
i < 10;
i++) {
222 bool CheckMetadata(
const std::multimap<grpc::string_ref, grpc::string_ref>&
map,
223 const string&
key,
const string&
value);
226 const string&
key,
const string&
value);
228 std::vector<std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
231 inline void*
tag(
int i) {
return reinterpret_cast<void*
>(
i); }
233 return static_cast<int>(
reinterpret_cast<intptr_t>(p));
268 return detag(got_tag);
271 template <
typename T>
276 return cq->AsyncNext(got_tag,
ok, deadline);
279 return cq->DoThenAsyncNext(lambda, got_tag,
ok, deadline);
319 void GotTag(
void* got_tag,
bool ok,
bool ignore_ok) {
329 if (it2->second.seen !=
nullptr) {
331 *it2->second.seen =
true;
#define EXPECT_FALSE(condition)
Status RequestStream(ServerContext *context, ServerReader< EchoRequest > *reader, EchoResponse *resp) override
void MakeCallbackCall(const std::shared_ptr< Channel > &channel)
void Verify(CompletionQueue *cq, bool ignore_ok)
@ PRE_SEND_INITIAL_METADATA
The first three in this list are for clients and servers.
void MakeBidiStreamingCall(const std::shared_ptr< Channel > &channel)
Verifier & Expect(int i, bool expect_ok)
std::chrono::time_point< std::chrono::system_clock, D > time_point
~EchoTestServiceStreamingImpl() override
void MakeAsyncCQCall(const std::shared_ptr< Channel > &channel)
void MakeAsyncCQClientStreamingCall(const std::shared_ptr< Channel > &)
NextStatus
Tri-state return for AsyncNext: SHUTDOWN, GOT_EVENT, TIMEOUT.
const char * method() const
Return the fully-specified method name.
virtual bool QueryInterceptionHookPoint(InterceptionHookPoints type)=0
experimental::Interceptor * CreateClientInterceptor(experimental::ClientRpcInfo *) override
Status BidiStream(ServerContext *context, grpc::ServerReaderWriter< EchoResponse, EchoRequest > *stream) override
std::map< void *, MaybeExpect > maybe_expectations_
static AllocList * Next(int i, AllocList *prev, LowLevelAlloc::Arena *arena)
#define T(upbtypeconst, upbtype, ctype, default_value)
static std::atomic< int > num_times_run_
Per-message write options.
static int GetNumTimesCancel()
experimental::Interceptor * CreateServerInterceptor(experimental::ServerRpcInfo *) override
wrapped_grpc_channel * channel
static std::atomic< int > num_times_cancel_
int Next(CompletionQueue *cq, bool ignore_ok)
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
std::map< void *, bool > expectations_
Verifier & ExpectMaybe(int i, bool expect_ok, bool *seen)
std::map< void *, bool > expectations_
void Intercept(experimental::InterceptorBatchMethods *methods) override
void GotTag(void *got_tag, bool ok, bool ignore_ok)
static const Status & OK
An OK pre-defined instance.
void Verify(CompletionQueue *cq, std::chrono::system_clock::time_point deadline, const std::function< void(void)> &lambda)
experimental::Interceptor * CreateServerInterceptor(experimental::ServerRpcInfo *) override
void MakeCall(const std::shared_ptr< Channel > &channel, const StubOptions &options)
const char * suffix_for_stats() const
static void * tag(intptr_t t)
experimental::Interceptor * CreateClientInterceptor(experimental::ClientRpcInfo *) override
CompletionQueue::NextStatus DoOnceThenAsyncNext(CompletionQueue *cq, void **got_tag, bool *ok, T deadline, std::function< void(void)> lambda)
std::vector< std::unique_ptr< experimental::ClientInterceptorFactoryInterface > > CreatePhonyClientInterceptors()
TestInterceptorFactory(const std::string &method, const char *suffix_for_stats)
void MakeServerStreamingCall(const std::shared_ptr< Channel > &channel)
void Intercept(experimental::InterceptorBatchMethods *methods) override
void MakeAsyncCQServerStreamingCall(const std::shared_ptr< Channel > &channel)
std::string ToString(const grpc::string_ref &r)
@ TIMEOUT
deadline was reached.
void MakeClientStreamingCall(const std::shared_ptr< Channel > &channel)
static std::atomic< int > num_times_run_reverse_
Useful interface for generated stubs.
TestInterceptor(const std::string &method, const char *suffix_for_stats, experimental::ClientRpcInfo *info)
experimental::Interceptor * CreateClientInterceptor(experimental::ClientRpcInfo *info) override
EXPECT_EQ(options.token_exchange_service_uri, "https://foo/exchange")
void MakeAsyncCQBidiStreamingCall(const std::shared_ptr< Channel > &)
void Verify(CompletionQueue *cq)
grpc::ClientContext context
constexpr int kNumStreamingMessages
std::map< void *, MaybeExpect > maybe_expectations_
EXPECT_TRUE(grpc::experimental::StsCredentialsOptionsFromJson(minimum_valid_json, &options) .ok())
const char * suffix_for_stats_
Status ResponseStream(ServerContext *context, const EchoRequest *req, ServerWriter< EchoResponse > *writer) override
Status Echo(ServerContext *context, const EchoRequest *request, EchoResponse *response) override
Verifier & ExpectUnless(int i, bool expect_ok, bool seen)
static int GetNumTimesRun()
std::pair< std::string, std::string > pair
bool CheckMetadata(const std::multimap< grpc::string_ref, grpc::string_ref > &map, const string &key, const string &value)
static grpc_completion_queue * cq
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:21