1/* 2 * 3 * Copyright 2023 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#import <XCTest/XCTest.h> 20 21#include <grpc/grpc.h> 22 23#include "src/core/lib/event_engine/cf_engine/cf_engine.h" 24#include "test/core/event_engine/test_suite/event_engine_test_framework.h" 25#include "test/core/event_engine/test_suite/tests/dns_test.h" 26#include "test/core/event_engine/test_suite/tests/timer_test.h" 27#include "test/core/util/test_config.h" 28 29@interface EventEngineTimerTests : XCTestCase 30@end 31 32@implementation EventEngineTimerTests 33 34- (void)testAll { 35 NSArray *arguments = [NSProcessInfo processInfo].arguments; 36 int argc = (int)arguments.count; 37 char **argv = static_cast<char **>(alloca((sizeof(char *) * (argc + 1)))); 38 for (int index = 0; index < argc; index++) { 39 argv[index] = const_cast<char *>([arguments[index] UTF8String]); 40 } 41 argv[argc] = NULL; 42 43 testing::InitGoogleTest(&argc, (char **)argv); 44 grpc::testing::TestEnvironment env(&argc, (char **)argv); 45 46 auto factory = []() { 47 return std::make_unique<grpc_event_engine::experimental::CFEventEngine>(); 48 }; 49 SetEventEngineFactories(factory, nullptr); 50 grpc_event_engine::experimental::InitTimerTests(); 51 grpc_event_engine::experimental::InitDNSTests(); 52 // TODO(ctiller): EventEngine temporarily needs grpc to be initialized first 53 // until we clear out the iomgr shutdown code. 54 grpc_init(); 55 int r = RUN_ALL_TESTS(); 56 grpc_shutdown(); 57 58 XCTAssertEqual(r, 0); 59} 60 61@end 62