secure_channel_create_test.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #include <string.h>
20 
21 #include <grpc/grpc.h>
22 #include <grpc/grpc_security.h>
23 #include <grpc/support/log.h>
24 
31 
35  grpc_channel* chan = grpc_channel_create("blah://blah", creds, nullptr);
38  GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client"));
41  creds->Unref();
42 }
43 
47  args.num_args = 1;
48  args.args = &arg;
49  grpc_channel* chan = grpc_channel_create(nullptr, nullptr, &args);
52  GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client"));
55 }
56 
57 void test_null_creds(void) {
58  grpc_channel* chan = grpc_channel_create(nullptr, nullptr, nullptr);
61  GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client"));
64 }
65 
66 int main(int argc, char** argv) {
68  grpc_init();
74  // Avoid default prefix
75  builder->resolver_registry()->Reset();
76  },
77  []() { test_unknown_scheme_target(); });
78  grpc_shutdown();
79  return 0;
80 }
grpc_arg
Definition: grpc_types.h:103
fake_credentials.h
log.h
core_configuration.h
generate.env
env
Definition: generate.py:37
grpc_channel_stack_element
grpc_channel_element * grpc_channel_stack_element(grpc_channel_stack *channel_stack, size_t index)
Definition: channel_stack.cc:78
grpc_core::CoreConfiguration::Builder
Definition: core_configuration.h:41
string.h
test_unknown_scheme_target
void test_unknown_scheme_target(void)
Definition: secure_channel_create_test.cc:32
grpc_channel_element
Definition: channel_stack.h:186
elem
Timer elem
Definition: event_engine/iomgr_event_engine/timer_heap_test.cc:109
grpc_channel_get_channel_stack
grpc_channel_stack * grpc_channel_get_channel_stack(grpc_channel *channel)
Definition: src/core/lib/surface/channel.h:178
grpc_security.h
grpc_channel_args
Definition: grpc_types.h:132
grpc_security_connector_to_arg
grpc_arg grpc_security_connector_to_arg(grpc_security_connector *sc)
Definition: security_connector.cc:101
grpc_core::RefCounted::Unref
void Unref()
Definition: ref_counted.h:302
profile_analyzer.builder
builder
Definition: profile_analyzer.py:159
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
grpc.h
security_connector.h
grpc_fake_transport_security_credentials_create
grpc_channel_credentials * grpc_fake_transport_security_credentials_create()
Definition: fake_credentials.cc:79
main
int main(int argc, char **argv)
Definition: secure_channel_create_test.cc:66
arg
Definition: cmdline.cc:40
grpc_core::ExecCtx
Definition: exec_ctx.h:97
test_null_creds
void test_null_creds(void)
Definition: secure_channel_create_test.cc:57
resolver_registry.h
test_security_connector_already_in_arg
void test_security_connector_already_in_arg(void)
Definition: secure_channel_create_test.cc:44
test_config.h
grpc_channel_create
GRPCAPI grpc_channel * grpc_channel_create(const char *target, grpc_channel_credentials *creds, const grpc_channel_args *args)
Definition: chttp2_connector.cc:366
exec_ctx
grpc_core::ExecCtx exec_ctx
Definition: end2end_binder_transport_test.cc:75
grpc_core::BuildCoreConfiguration
void BuildCoreConfiguration(CoreConfiguration::Builder *builder)
Definition: grpc_plugin_registry.cc:109
grpc::testing::TestEnvironment
Definition: test/core/util/test_config.h:54
arg
struct arg arg
grpc_core::CoreConfiguration::RunWithSpecialConfiguration
static void RunWithSpecialConfiguration(BuildFunc build_configuration, RunFunc code_to_run)
Definition: core_configuration.h:129
grpc_channel
struct grpc_channel grpc_channel
Definition: grpc_types.h:62
grpc_init
GRPCAPI void grpc_init(void)
Definition: init.cc:146
grpc_core::CppImplOf< Channel, grpc_channel >::FromC
static Channel * FromC(grpc_channel *c_type)
Definition: cpp_impl_of.h:30
grpc_shutdown
GRPCAPI void grpc_shutdown(void)
Definition: init.cc:209
grpc_channel_credentials
Definition: src/core/lib/security/credentials/credentials.h:96
channel.h


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:15