1*d9f75844SAndroid Build Coastguard Worker/* 2*d9f75844SAndroid Build Coastguard Worker * Copyright 2015 The WebRTC project authors. All Rights Reserved. 3*d9f75844SAndroid Build Coastguard Worker * 4*d9f75844SAndroid Build Coastguard Worker * Use of this source code is governed by a BSD-style license 5*d9f75844SAndroid Build Coastguard Worker * that can be found in the LICENSE file in the root of the source 6*d9f75844SAndroid Build Coastguard Worker * tree. An additional intellectual property rights grant can be found 7*d9f75844SAndroid Build Coastguard Worker * in the file PATENTS. All contributing project authors may 8*d9f75844SAndroid Build Coastguard Worker * be found in the AUTHORS file in the root of the source tree. 9*d9f75844SAndroid Build Coastguard Worker */ 10*d9f75844SAndroid Build Coastguard Worker 11*d9f75844SAndroid Build Coastguard Worker#import <Foundation/Foundation.h> 12*d9f75844SAndroid Build Coastguard Worker#import <XCTest/XCTest.h> 13*d9f75844SAndroid Build Coastguard Worker#ifdef __cplusplus 14*d9f75844SAndroid Build Coastguard Workerextern "C" { 15*d9f75844SAndroid Build Coastguard Worker#endif 16*d9f75844SAndroid Build Coastguard Worker#import <OCMock/OCMock.h> 17*d9f75844SAndroid Build Coastguard Worker#ifdef __cplusplus 18*d9f75844SAndroid Build Coastguard Worker} 19*d9f75844SAndroid Build Coastguard Worker#endif 20*d9f75844SAndroid Build Coastguard Worker#import "api/peerconnection/RTCPeerConnectionFactory+Native.h" 21*d9f75844SAndroid Build Coastguard Worker#import "api/peerconnection/RTCPeerConnectionFactoryBuilder+DefaultComponents.h" 22*d9f75844SAndroid Build Coastguard Worker#import "api/peerconnection/RTCPeerConnectionFactoryBuilder.h" 23*d9f75844SAndroid Build Coastguard Worker 24*d9f75844SAndroid Build Coastguard Worker#include "api/audio_codecs/builtin_audio_decoder_factory.h" 25*d9f75844SAndroid Build Coastguard Worker#include "api/audio_codecs/builtin_audio_encoder_factory.h" 26*d9f75844SAndroid Build Coastguard Worker#include "api/video_codecs/video_decoder_factory.h" 27*d9f75844SAndroid Build Coastguard Worker#include "api/video_codecs/video_encoder_factory.h" 28*d9f75844SAndroid Build Coastguard Worker#include "modules/audio_device/include/audio_device.h" 29*d9f75844SAndroid Build Coastguard Worker#include "modules/audio_processing/include/audio_processing.h" 30*d9f75844SAndroid Build Coastguard Worker 31*d9f75844SAndroid Build Coastguard Worker#include "rtc_base/gunit.h" 32*d9f75844SAndroid Build Coastguard Worker#include "rtc_base/system/unused.h" 33*d9f75844SAndroid Build Coastguard Worker 34*d9f75844SAndroid Build Coastguard Worker@interface RTCPeerConnectionFactoryBuilderTests : XCTestCase 35*d9f75844SAndroid Build Coastguard Worker@end 36*d9f75844SAndroid Build Coastguard Worker 37*d9f75844SAndroid Build Coastguard Worker@implementation RTCPeerConnectionFactoryBuilderTests 38*d9f75844SAndroid Build Coastguard Worker 39*d9f75844SAndroid Build Coastguard Worker- (void)testBuilder { 40*d9f75844SAndroid Build Coastguard Worker id factoryMock = OCMStrictClassMock([RTC_OBJC_TYPE(RTCPeerConnectionFactory) class]); 41*d9f75844SAndroid Build Coastguard Worker OCMExpect([factoryMock alloc]).andReturn(factoryMock); 42*d9f75844SAndroid Build Coastguard Worker RTC_UNUSED([[[[factoryMock expect] andReturn:factoryMock] ignoringNonObjectArgs] 43*d9f75844SAndroid Build Coastguard Worker initWithNativeAudioEncoderFactory:nullptr 44*d9f75844SAndroid Build Coastguard Worker nativeAudioDecoderFactory:nullptr 45*d9f75844SAndroid Build Coastguard Worker nativeVideoEncoderFactory:nullptr 46*d9f75844SAndroid Build Coastguard Worker nativeVideoDecoderFactory:nullptr 47*d9f75844SAndroid Build Coastguard Worker audioDeviceModule:nullptr 48*d9f75844SAndroid Build Coastguard Worker audioProcessingModule:nullptr]); 49*d9f75844SAndroid Build Coastguard Worker RTCPeerConnectionFactoryBuilder* builder = [[RTCPeerConnectionFactoryBuilder alloc] init]; 50*d9f75844SAndroid Build Coastguard Worker RTC_OBJC_TYPE(RTCPeerConnectionFactory)* peerConnectionFactory = 51*d9f75844SAndroid Build Coastguard Worker [builder createPeerConnectionFactory]; 52*d9f75844SAndroid Build Coastguard Worker EXPECT_TRUE(peerConnectionFactory != nil); 53*d9f75844SAndroid Build Coastguard Worker OCMVerifyAll(factoryMock); 54*d9f75844SAndroid Build Coastguard Worker} 55*d9f75844SAndroid Build Coastguard Worker 56*d9f75844SAndroid Build Coastguard Worker- (void)testDefaultComponentsBuilder { 57*d9f75844SAndroid Build Coastguard Worker id factoryMock = OCMStrictClassMock([RTC_OBJC_TYPE(RTCPeerConnectionFactory) class]); 58*d9f75844SAndroid Build Coastguard Worker OCMExpect([factoryMock alloc]).andReturn(factoryMock); 59*d9f75844SAndroid Build Coastguard Worker RTC_UNUSED([[[[factoryMock expect] andReturn:factoryMock] ignoringNonObjectArgs] 60*d9f75844SAndroid Build Coastguard Worker initWithNativeAudioEncoderFactory:nullptr 61*d9f75844SAndroid Build Coastguard Worker nativeAudioDecoderFactory:nullptr 62*d9f75844SAndroid Build Coastguard Worker nativeVideoEncoderFactory:nullptr 63*d9f75844SAndroid Build Coastguard Worker nativeVideoDecoderFactory:nullptr 64*d9f75844SAndroid Build Coastguard Worker audioDeviceModule:nullptr 65*d9f75844SAndroid Build Coastguard Worker audioProcessingModule:nullptr]); 66*d9f75844SAndroid Build Coastguard Worker RTCPeerConnectionFactoryBuilder* builder = [RTCPeerConnectionFactoryBuilder defaultBuilder]; 67*d9f75844SAndroid Build Coastguard Worker RTC_OBJC_TYPE(RTCPeerConnectionFactory)* peerConnectionFactory = 68*d9f75844SAndroid Build Coastguard Worker [builder createPeerConnectionFactory]; 69*d9f75844SAndroid Build Coastguard Worker EXPECT_TRUE(peerConnectionFactory != nil); 70*d9f75844SAndroid Build Coastguard Worker OCMVerifyAll(factoryMock); 71*d9f75844SAndroid Build Coastguard Worker} 72*d9f75844SAndroid Build Coastguard Worker@end 73