Debian Codegraph @

test/core/event_engine/test_init.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 "test/core/event_engine/test_init.h"
17
18 #include "absl/strings/str_cat.h"
19
20 namespace grpc_event_engine {
21 namespace experimental {
22
23 /// Sets the default EventEngine factory, used for testing.
24 /// Currently the only valid engine is 'default' or ''.
25 /// When more engines are added, this should be updated accordingly.
26 absl::Status InitializeTestingEventEngineFactory(absl::string_view engine) {
27 if (engine == "default" || engine.empty()) {
28 // No-op, the default will be used
29 return absl::OkStatus();
30 }
31 return absl::InvalidArgumentError(
32 absl::StrCat("Unknown EventEngine implementation: ", engine));
33 }
34
35 } // namespace experimental
36 } // namespace grpc_event_engine