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/support/log.h>
23
24 #include "src/core/ext/filters/client_channel/resolver_registry.h"
25 #include "src/core/lib/channel/channel_stack.h"
26 #include "src/core/lib/surface/channel.h"
27 #include "test/core/util/test_config.h"
28
test_unknown_scheme_target(void)29 void test_unknown_scheme_target(void) {
30 grpc_channel* chan;
31 /* avoid default prefix */
32 grpc_core::ResolverRegistry::Builder::ShutdownRegistry();
33 grpc_core::ResolverRegistry::Builder::InitRegistry();
34
35 chan = grpc_insecure_channel_create("blah://blah", nullptr, nullptr);
36 GPR_ASSERT(chan != nullptr);
37
38 grpc_core::ExecCtx exec_ctx;
39 grpc_channel_element* elem =
40 grpc_channel_stack_element(grpc_channel_get_channel_stack(chan), 0);
41 GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client"));
42
43 grpc_channel_destroy(chan);
44 }
45
main(int argc,char ** argv)46 int main(int argc, char** argv) {
47 grpc_test_init(argc, argv);
48 grpc_init();
49 test_unknown_scheme_target();
50 grpc_shutdown();
51 return 0;
52 }
53