smoke_test.cc 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. #include <gmock/gmock.h>
  16. #include <gtest/gtest.h>
  17. #include <grpc/event_engine/event_engine.h>
  18. #include <grpc/grpc.h>
  19. #include "test/core/util/test_config.h"
  20. namespace {
  21. using ::testing::MockFunction;
  22. class EventEngineSmokeTest : public testing::Test {};
  23. TEST_F(EventEngineSmokeTest, SetDefaultEventEngineFactoryLinks) {
  24. // See https://github.com/grpc/grpc/pull/28707
  25. testing::MockFunction<
  26. std::unique_ptr<grpc_event_engine::experimental::EventEngine>()>
  27. factory;
  28. EXPECT_CALL(factory, Call()).Times(1);
  29. auto stdfn_fact = factory.AsStdFunction();
  30. grpc_event_engine::experimental::SetDefaultEventEngineFactory(&stdfn_fact);
  31. EXPECT_EQ(nullptr, grpc_event_engine::experimental::CreateEventEngine());
  32. }
  33. } // namespace
  34. int main(int argc, char** argv) {
  35. testing::InitGoogleTest(&argc, argv);
  36. grpc::testing::TestEnvironment env(argc, argv);
  37. grpc_init();
  38. auto result = RUN_ALL_TESTS();
  39. grpc_shutdown();
  40. return result;
  41. }