1/* 2 * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11// Copied from Chromium base/test/ios/google_test_runner.mm to avoid 12// the //base dependency. The protocol is required to run iOS Unittest. 13 14#import <UIKit/UIKit.h> 15#import <XCTest/XCTest.h> 16 17#import "test/ios/google_test_runner_delegate.h" 18 19#if !defined(__has_feature) || !__has_feature(objc_arc) 20#error "This file requires ARC support." 21#endif 22 23@interface GoogleTestRunner : XCTestCase 24@end 25 26@implementation GoogleTestRunner 27 28- (void)testRunGoogleTests { 29 self.continueAfterFailure = false; 30 31 id appDelegate = UIApplication.sharedApplication.delegate; 32 XCTAssertTrue([appDelegate conformsToProtocol:@protocol(GoogleTestRunnerDelegate)]); 33 34 id<GoogleTestRunnerDelegate> runnerDelegate = 35 static_cast<id<GoogleTestRunnerDelegate>>(appDelegate); 36 XCTAssertTrue(runnerDelegate.supportsRunningGoogleTests); 37 XCTAssertTrue([runnerDelegate runGoogleTests] == 0); 38} 39 40@end 41