Debian Codegraph @

test/core/event_engine/smoke_test.cc

raw
1 // Copyright 2022 The gRPC Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 #include <grpc/support/port_platform.h>
15
16 #include <memory>
17
18 #include "gmock/gmock.h"
19 #include "gtest/gtest.h"
20
21 #include <grpc/event_engine/event_engine.h>
22 #include <grpc/grpc.h>
23
24 #include "test/core/util/test_config.h"
25
26 namespace {
27
28 using ::testing::MockFunction;
29
30 class EventEngineSmokeTest : public testing::Test {};
31
32 TEST_F(EventEngineSmokeTest, SetEventEngineFactoryLinks) {
33 // See https://github.com/grpc/grpc/pull/28707
34 testing::MockFunction<
35 std::unique_ptr<grpc_event_engine::experimental::EventEngine>()>
36 factory;
37 EXPECT_CALL(factory, Call()).Times(1);
38 grpc_event_engine::experimental::SetEventEngineFactory(
39 factory.AsStdFunction());
40 EXPECT_EQ(nullptr, grpc_event_engine::experimental::CreateEventEngine());
41 }
42
43 } // namespace
44
45 int main(int argc, char** argv) {
46 testing::InitGoogleTest(&argc, argv);
47 grpc::testing::TestEnvironment env(&argc, argv);
48 grpc_init();
49 auto result = RUN_ALL_TESTS();
50 grpc_shutdown();
51 return result;
52 }