Remove objc tests from rtc_unittests and move tests to sdk_unittests
The tests in rtc_unittests_objc are old gtest based tests and The tests in sdk_unittests are XCTest based tests. The objc tests in rtc_unittest are causing problems [1], so I think it's time to combine the two types of objc tests. Renaming the files to match the existing sdk_unittests and removing the use of gtest helper functions (eg, EXPECT_EQ) are planned for follow-up CLs. [1] https://webrtc-review.googlesource.com/c/src/+/261724/9 Bug: webrtc:8382 Change-Id: I9308b35f654c4479c9df72bf7cd7f4032e267eb2 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262380 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Daniel.L (Byoungchan) Lee <daniel.l@hpcnt.com> Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36878}
This commit is contained in:
parent
cbb8fb8337
commit
c8a6fb2bb8
4
BUILD.gn
4
BUILD.gn
@ -596,10 +596,6 @@ if (rtc_include_tests && !build_with_chromium) {
|
||||
]
|
||||
shard_timeout = 900
|
||||
}
|
||||
|
||||
if (is_ios || is_mac) {
|
||||
deps += [ "sdk:rtc_unittests_objc" ]
|
||||
}
|
||||
}
|
||||
|
||||
if (enable_google_benchmarks) {
|
||||
|
||||
87
sdk/BUILD.gn
87
sdk/BUILD.gn
@ -1056,17 +1056,32 @@ if (is_ios || is_mac) {
|
||||
|
||||
sources = [
|
||||
"objc/unittests/ObjCVideoTrackSource_xctest.mm",
|
||||
"objc/unittests/RTCAudioSessionTest.mm",
|
||||
"objc/unittests/RTCCVPixelBuffer_xctest.mm",
|
||||
"objc/unittests/RTCCallbackLogger_xctest.m",
|
||||
"objc/unittests/RTCCameraVideoCapturerTests.mm",
|
||||
"objc/unittests/RTCCertificateTest.mm",
|
||||
"objc/unittests/RTCConfigurationTest.mm",
|
||||
"objc/unittests/RTCDataChannelConfigurationTest.mm",
|
||||
"objc/unittests/RTCEncodedImage_xctest.mm",
|
||||
"objc/unittests/RTCFileVideoCapturer_xctest.mm",
|
||||
"objc/unittests/RTCH264ProfileLevelId_xctest.m",
|
||||
"objc/unittests/RTCIceCandidateTest.mm",
|
||||
"objc/unittests/RTCIceServerTest.mm",
|
||||
"objc/unittests/RTCMTLVideoView_xctest.m",
|
||||
"objc/unittests/RTCMediaConstraintsTest.mm",
|
||||
"objc/unittests/RTCNV12TextureCache_xctest.m",
|
||||
"objc/unittests/RTCPeerConnectionFactoryBuilderTest.mm",
|
||||
"objc/unittests/RTCPeerConnectionFactory_xctest.m",
|
||||
"objc/unittests/RTCPeerConnectionTest.mm",
|
||||
"objc/unittests/RTCSessionDescriptionTest.mm",
|
||||
"objc/unittests/RTCTracingTest.mm",
|
||||
"objc/unittests/frame_buffer_helpers.h",
|
||||
"objc/unittests/frame_buffer_helpers.mm",
|
||||
"objc/unittests/nalu_rewriter_xctest.mm",
|
||||
"objc/unittests/objc_video_decoder_factory_tests.mm",
|
||||
"objc/unittests/objc_video_encoder_factory_tests.mm",
|
||||
"objc/unittests/scoped_cftyperef_tests.mm",
|
||||
]
|
||||
|
||||
# TODO(bugs.webrtc.org/12937): Remove OpenGL deprecation warning
|
||||
@ -1089,6 +1104,7 @@ if (is_ios || is_mac) {
|
||||
":base_objc",
|
||||
":callback_logger_objc",
|
||||
":framework_objc",
|
||||
":helpers_objc",
|
||||
":mediaconstraints_objc",
|
||||
":metal_objc",
|
||||
":native_api",
|
||||
@ -1102,17 +1118,25 @@ if (is_ios || is_mac) {
|
||||
":videosource_objc",
|
||||
":videotoolbox_objc",
|
||||
"../api:scoped_refptr",
|
||||
"../api/audio_codecs:builtin_audio_decoder_factory",
|
||||
"../api/audio_codecs:builtin_audio_encoder_factory",
|
||||
"../api/task_queue:default_task_queue_factory",
|
||||
"../api/video:video_frame",
|
||||
"../api/video_codecs:video_codecs_api",
|
||||
"../common_video",
|
||||
"../media:rtc_media_base",
|
||||
"../media:rtc_media_tests_utils",
|
||||
"../modules/audio_device:audio_device_api",
|
||||
"../modules/audio_processing:api",
|
||||
"../modules/video_coding:video_codec_interface",
|
||||
"../rtc_base",
|
||||
"../rtc_base:gunit_helpers",
|
||||
"../rtc_base:macromagic",
|
||||
"../rtc_base:refcount",
|
||||
"../rtc_base:rtc_event",
|
||||
"../rtc_base/system:unused",
|
||||
"../system_wrappers",
|
||||
"../test:test_support", # TODO(webrtc:8382): Remove use of gtest
|
||||
"//third_party/libyuv",
|
||||
]
|
||||
|
||||
@ -1175,69 +1199,6 @@ if (is_ios || is_mac) {
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
# TODO(denicija): once all tests are migrated to xctest remove this source set.
|
||||
rtc_library("rtc_unittests_objc") {
|
||||
testonly = true
|
||||
|
||||
sources = [
|
||||
"objc/unittests/RTCCertificateTest.mm",
|
||||
"objc/unittests/RTCConfigurationTest.mm",
|
||||
"objc/unittests/RTCDataChannelConfigurationTest.mm",
|
||||
"objc/unittests/RTCIceCandidateTest.mm",
|
||||
"objc/unittests/RTCIceServerTest.mm",
|
||||
"objc/unittests/RTCMediaConstraintsTest.mm",
|
||||
"objc/unittests/RTCPeerConnectionFactoryBuilderTest.mm",
|
||||
"objc/unittests/RTCPeerConnectionTest.mm",
|
||||
"objc/unittests/RTCSessionDescriptionTest.mm",
|
||||
"objc/unittests/RTCTracingTest.mm",
|
||||
"objc/unittests/objc_video_decoder_factory_tests.mm",
|
||||
"objc/unittests/objc_video_encoder_factory_tests.mm",
|
||||
"objc/unittests/scoped_cftyperef_tests.mm",
|
||||
]
|
||||
if (is_ios) {
|
||||
sources += [ "objc/unittests/RTCCameraVideoCapturerTests.mm" ]
|
||||
}
|
||||
|
||||
# |-ObjC| flag needed to make sure category method implementations
|
||||
# are included:
|
||||
# https://developer.apple.com/library/mac/qa/qa1490/_index.html
|
||||
ldflags = [ "-ObjC" ]
|
||||
|
||||
deps = [
|
||||
":base_objc",
|
||||
":helpers_objc",
|
||||
":mediaconstraints_objc",
|
||||
":native_api",
|
||||
":native_video",
|
||||
":peerconnectionfactory_base_objc",
|
||||
":videocapture_objc",
|
||||
":videocodec_objc",
|
||||
":videoframebuffer_objc",
|
||||
":videosource_objc",
|
||||
":videotoolbox_objc",
|
||||
"../api:libjingle_peerconnection_api",
|
||||
"../api/audio_codecs:audio_codecs_api",
|
||||
"../api/audio_codecs:builtin_audio_decoder_factory",
|
||||
"../api/audio_codecs:builtin_audio_encoder_factory",
|
||||
"../api/video_codecs:video_codecs_api",
|
||||
"../media:rtc_media_base",
|
||||
"../modules/audio_device:audio_device_api",
|
||||
"../modules/audio_processing",
|
||||
"../modules/audio_processing:api",
|
||||
"../modules/video_coding:video_codec_interface",
|
||||
"../rtc_base:gunit_helpers",
|
||||
"../rtc_base:rtc_event",
|
||||
"../rtc_base/system:unused",
|
||||
"../test:test_support",
|
||||
"//third_party/ocmock",
|
||||
]
|
||||
|
||||
if (is_ios) {
|
||||
sources += [ "objc/unittests/RTCAudioSessionTest.mm" ]
|
||||
deps += [ ":audio_session_objc" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_ios) {
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <OCMock/OCMock.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -111,8 +112,7 @@
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface RTCAudioSessionTest : NSObject
|
||||
@interface RTCAudioSessionTest : XCTestCase
|
||||
|
||||
@end
|
||||
|
||||
@ -322,57 +322,3 @@ OCMLocation *OCMMakeLocation(id testCase, const char *fileCString, int line){
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class AudioSessionTest : public ::testing::Test {
|
||||
protected:
|
||||
void TearDown() override {
|
||||
RTC_OBJC_TYPE(RTCAudioSession) *session = [RTC_OBJC_TYPE(RTCAudioSession) sharedInstance];
|
||||
for (id<RTC_OBJC_TYPE(RTCAudioSessionDelegate)> delegate : session.delegates) {
|
||||
[session removeDelegate:delegate];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(AudioSessionTest, AddAndRemoveDelegates) {
|
||||
RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init];
|
||||
[test testAddAndRemoveDelegates];
|
||||
}
|
||||
|
||||
TEST_F(AudioSessionTest, PushDelegate) {
|
||||
RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init];
|
||||
[test testPushDelegate];
|
||||
}
|
||||
|
||||
TEST_F(AudioSessionTest, ZeroingWeakDelegate) {
|
||||
RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init];
|
||||
[test testZeroingWeakDelegate];
|
||||
}
|
||||
|
||||
TEST_F(AudioSessionTest, RemoveDelegateOnDealloc) {
|
||||
RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init];
|
||||
[test testRemoveDelegateOnDealloc];
|
||||
}
|
||||
|
||||
TEST_F(AudioSessionTest, AudioSessionActivation) {
|
||||
RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init];
|
||||
[test testAudioSessionActivation];
|
||||
}
|
||||
|
||||
TEST_F(AudioSessionTest, ConfigureWebRTCSession) {
|
||||
RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init];
|
||||
[test testConfigureWebRTCSession];
|
||||
}
|
||||
|
||||
TEST_F(AudioSessionTest, ConfigureWebRTCSessionWithoutLocking) {
|
||||
RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init];
|
||||
[test testConfigureWebRTCSessionWithoutLocking];
|
||||
}
|
||||
|
||||
TEST_F(AudioSessionTest, AudioVolumeDidNotify) {
|
||||
RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init];
|
||||
[test testAudioVolumeDidNotify];
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#import <OCMock/OCMock.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
#import <UIKit/UIKit.h>
|
||||
@ -67,7 +68,7 @@ CMSampleBufferRef createTestSampleBufferRef() {
|
||||
: (AVCaptureSession *)captureSession;
|
||||
@end
|
||||
|
||||
@interface RTCCameraVideoCapturerTests : NSObject
|
||||
@interface RTCCameraVideoCapturerTests : XCTestCase
|
||||
@property(nonatomic, strong) id delegateMock;
|
||||
@property(nonatomic, strong) id deviceMock;
|
||||
@property(nonatomic, strong) id captureConnectionMock;
|
||||
@ -455,112 +456,3 @@ CMSampleBufferRef createTestSampleBufferRef() {
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
TEST(RTCCameraVideoCapturerTests, SetupSession) {
|
||||
RTCCameraVideoCapturerTests *test = [[RTCCameraVideoCapturerTests alloc] init];
|
||||
[test setup];
|
||||
[test testSetupSession];
|
||||
[test tearDown];
|
||||
}
|
||||
|
||||
TEST(RTCCameraVideoCapturerTests, SetupSessionOutput) {
|
||||
RTCCameraVideoCapturerTests *test = [[RTCCameraVideoCapturerTests alloc] init];
|
||||
[test setup];
|
||||
[test testSetupSessionOutput];
|
||||
[test tearDown];
|
||||
}
|
||||
|
||||
TEST(RTCCameraVideoCapturerTests, SupportedFormatsForDevice) {
|
||||
RTCCameraVideoCapturerTests *test = [[RTCCameraVideoCapturerTests alloc] init];
|
||||
[test setup];
|
||||
[test testSupportedFormatsForDevice];
|
||||
[test tearDown];
|
||||
}
|
||||
|
||||
TEST(RTCCameraVideoCapturerTests, DelegateCallbackNotCalledWhenInvalidBuffer) {
|
||||
RTCCameraVideoCapturerTests *test = [[RTCCameraVideoCapturerTests alloc] init];
|
||||
[test setup];
|
||||
[test testDelegateCallbackNotCalledWhenInvalidBuffer];
|
||||
[test tearDown];
|
||||
}
|
||||
|
||||
TEST(RTCCameraVideoCapturerTests, DelegateCallbackWithValidBufferAndOrientationUpdate) {
|
||||
RTCCameraVideoCapturerTests *test = [[RTCCameraVideoCapturerTests alloc] init];
|
||||
[test setup];
|
||||
[test testDelegateCallbackWithValidBufferAndOrientationUpdate];
|
||||
[test tearDown];
|
||||
}
|
||||
|
||||
TEST(RTCCameraVideoCapturerTests, RotationCameraBackLandscapeLeft) {
|
||||
RTCCameraVideoCapturerTests *test = [[RTCCameraVideoCapturerTests alloc] init];
|
||||
[test setup];
|
||||
[test testRotationCamera:AVCaptureDevicePositionBack
|
||||
withOrientation:UIDeviceOrientationLandscapeLeft];
|
||||
[test tearDown];
|
||||
}
|
||||
|
||||
TEST(RTCCameraVideoCapturerTests, RotationCameraFrontLandscapeLeft) {
|
||||
RTCCameraVideoCapturerTests *test = [[RTCCameraVideoCapturerTests alloc] init];
|
||||
[test setup];
|
||||
[test testRotationCamera:AVCaptureDevicePositionFront
|
||||
withOrientation:UIDeviceOrientationLandscapeLeft];
|
||||
[test tearDown];
|
||||
}
|
||||
|
||||
TEST(RTCCameraVideoCapturerTests, RotationCameraBackLandscapeRight) {
|
||||
RTCCameraVideoCapturerTests *test = [[RTCCameraVideoCapturerTests alloc] init];
|
||||
[test setup];
|
||||
[test testRotationCamera:AVCaptureDevicePositionBack
|
||||
withOrientation:UIDeviceOrientationLandscapeRight];
|
||||
[test tearDown];
|
||||
}
|
||||
|
||||
TEST(RTCCameraVideoCapturerTests, RotationCameraFrontLandscapeRight) {
|
||||
RTCCameraVideoCapturerTests *test = [[RTCCameraVideoCapturerTests alloc] init];
|
||||
[test setup];
|
||||
[test testRotationCamera:AVCaptureDevicePositionFront
|
||||
withOrientation:UIDeviceOrientationLandscapeRight];
|
||||
[test tearDown];
|
||||
}
|
||||
|
||||
TEST(RTCCameraVideoCapturerTests, RotationCameraFrame) {
|
||||
RTCCameraVideoCapturerTests *test = [[RTCCameraVideoCapturerTests alloc] init];
|
||||
[test setup];
|
||||
[test testRotationFrame];
|
||||
[test tearDown];
|
||||
}
|
||||
|
||||
TEST(RTCCameraVideoCapturerTests, ImageExif) {
|
||||
RTCCameraVideoCapturerTests *test = [[RTCCameraVideoCapturerTests alloc] init];
|
||||
[test setup];
|
||||
[test testImageExif];
|
||||
[test tearDown];
|
||||
}
|
||||
|
||||
TEST(RTCCameraVideoCapturerTests, StartAndStopCapture) {
|
||||
RTCCameraVideoCapturerTests *test = [[RTCCameraVideoCapturerTests alloc] init];
|
||||
[test setupWithMockedCaptureSession];
|
||||
[test testStartingAndStoppingCapture];
|
||||
[test tearDown];
|
||||
}
|
||||
|
||||
TEST(RTCCameraVideoCapturerTests, StartCaptureFailingToLockForConfiguration) {
|
||||
RTCCameraVideoCapturerTests *test = [[RTCCameraVideoCapturerTests alloc] init];
|
||||
[test setupWithMockedCaptureSession];
|
||||
[test testStartCaptureFailingToLockForConfiguration];
|
||||
[test tearDown];
|
||||
}
|
||||
|
||||
TEST(RTCCameraVideoCapturerTests, StartAndStopCaptureWithCallbacks) {
|
||||
RTCCameraVideoCapturerTests *test = [[RTCCameraVideoCapturerTests alloc] init];
|
||||
[test setupWithMockedCaptureSession];
|
||||
[test testStartingAndStoppingCaptureWithCallbacks];
|
||||
[test tearDown];
|
||||
}
|
||||
|
||||
TEST(RTCCameraVideoCapturerTests, StartCaptureFailingToLockForConfigurationWithCallback) {
|
||||
RTCCameraVideoCapturerTests *test = [[RTCCameraVideoCapturerTests alloc] init];
|
||||
[test setupWithMockedCaptureSession];
|
||||
[test testStartCaptureFailingToLockForConfigurationWithCallback];
|
||||
[test tearDown];
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -22,8 +23,7 @@
|
||||
#import "api/peerconnection/RTCPeerConnectionFactory.h"
|
||||
#import "helpers/NSString+StdString.h"
|
||||
|
||||
@interface RTCCertificateTest : NSObject
|
||||
- (void)testCertificateIsUsedInConfig;
|
||||
@interface RTCCertificateTest : XCTestCase
|
||||
@end
|
||||
|
||||
@implementation RTCCertificateTest
|
||||
@ -71,8 +71,3 @@
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
TEST(CertificateTest, DISABLED_CertificateIsUsedInConfig) {
|
||||
RTCCertificateTest *test = [[RTCCertificateTest alloc] init];
|
||||
[test testCertificateIsUsedInConfig];
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -19,9 +20,7 @@
|
||||
#import "api/peerconnection/RTCIceServer.h"
|
||||
#import "helpers/NSString+StdString.h"
|
||||
|
||||
@interface RTCConfigurationTest : NSObject
|
||||
- (void)testConversionToNativeConfiguration;
|
||||
- (void)testNativeConversionToConfiguration;
|
||||
@interface RTCConfigurationTest : XCTestCase
|
||||
@end
|
||||
|
||||
@implementation RTCConfigurationTest
|
||||
@ -161,12 +160,3 @@
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
TEST(RTCConfigurationTest, NativeConfigurationConversionTest) {
|
||||
@autoreleasepool {
|
||||
RTCConfigurationTest *test = [[RTCConfigurationTest alloc] init];
|
||||
[test testConversionToNativeConfiguration];
|
||||
[test testNativeConversionToConfiguration];
|
||||
[test testDefaultValues];
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#include "rtc_base/gunit.h"
|
||||
|
||||
@ -16,8 +17,7 @@
|
||||
#import "api/peerconnection/RTCDataChannelConfiguration.h"
|
||||
#import "helpers/NSString+StdString.h"
|
||||
|
||||
@interface RTCDataChannelConfigurationTest : NSObject
|
||||
- (void)testConversionToNativeDataChannelInit;
|
||||
@interface RTCDataChannelConfigurationTest : XCTestCase
|
||||
@end
|
||||
|
||||
@implementation RTCDataChannelConfigurationTest
|
||||
@ -49,11 +49,3 @@
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
TEST(RTC_OBJC_TYPE(RTCDataChannelConfiguration), NativeDataChannelInitConversionTest) {
|
||||
@autoreleasepool {
|
||||
RTCDataChannelConfigurationTest *test =
|
||||
[[RTCDataChannelConfigurationTest alloc] init];
|
||||
[test testConversionToNativeDataChannelInit];
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
@ -18,9 +19,7 @@
|
||||
#import "api/peerconnection/RTCIceCandidate.h"
|
||||
#import "helpers/NSString+StdString.h"
|
||||
|
||||
@interface RTCIceCandidateTest : NSObject
|
||||
- (void)testCandidate;
|
||||
- (void)testInitFromNativeCandidate;
|
||||
@interface RTCIceCandidateTest : XCTestCase
|
||||
@end
|
||||
|
||||
@implementation RTCIceCandidateTest
|
||||
@ -59,17 +58,3 @@
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
TEST(RTCIceCandidateTest, CandidateTest) {
|
||||
@autoreleasepool {
|
||||
RTCIceCandidateTest *test = [[RTCIceCandidateTest alloc] init];
|
||||
[test testCandidate];
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RTCIceCandidateTest, InitFromCandidateTest) {
|
||||
@autoreleasepool {
|
||||
RTCIceCandidateTest *test = [[RTCIceCandidateTest alloc] init];
|
||||
[test testInitFromNativeCandidate];
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -18,11 +19,7 @@
|
||||
#import "api/peerconnection/RTCIceServer.h"
|
||||
#import "helpers/NSString+StdString.h"
|
||||
|
||||
@interface RTCIceServerTest : NSObject
|
||||
- (void)testOneURLServer;
|
||||
- (void)testTwoURLServer;
|
||||
- (void)testPasswordCredential;
|
||||
- (void)testInitFromNativeServer;
|
||||
@interface RTCIceServerTest : XCTestCase
|
||||
@end
|
||||
|
||||
@implementation RTCIceServerTest
|
||||
@ -137,38 +134,3 @@
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
TEST(RTCIceServerTest, OneURLTest) {
|
||||
@autoreleasepool {
|
||||
RTCIceServerTest *test = [[RTCIceServerTest alloc] init];
|
||||
[test testOneURLServer];
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RTCIceServerTest, TwoURLTest) {
|
||||
@autoreleasepool {
|
||||
RTCIceServerTest *test = [[RTCIceServerTest alloc] init];
|
||||
[test testTwoURLServer];
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RTCIceServerTest, PasswordCredentialTest) {
|
||||
@autoreleasepool {
|
||||
RTCIceServerTest *test = [[RTCIceServerTest alloc] init];
|
||||
[test testPasswordCredential];
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RTCIceServerTest, HostnameTest) {
|
||||
@autoreleasepool {
|
||||
RTCIceServerTest *test = [[RTCIceServerTest alloc] init];
|
||||
[test testHostname];
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RTCIceServerTest, InitFromNativeServerTest) {
|
||||
@autoreleasepool {
|
||||
RTCIceServerTest *test = [[RTCIceServerTest alloc] init];
|
||||
[test testInitFromNativeServer];
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
@ -18,11 +19,10 @@
|
||||
#import "api/peerconnection/RTCMediaConstraints.h"
|
||||
#import "helpers/NSString+StdString.h"
|
||||
|
||||
@interface RTCMediaConstraintsTest : NSObject
|
||||
- (void)testMediaConstraints;
|
||||
@interface RTCMediaConstraintsTests : XCTestCase
|
||||
@end
|
||||
|
||||
@implementation RTCMediaConstraintsTest
|
||||
@implementation RTCMediaConstraintsTests
|
||||
|
||||
- (void)testMediaConstraints {
|
||||
NSDictionary *mandatory = @{@"key1": @"value1", @"key2": @"value2"};
|
||||
@ -56,10 +56,3 @@
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
TEST(RTCMediaConstraintsTest, MediaConstraintsTest) {
|
||||
@autoreleasepool {
|
||||
RTCMediaConstraintsTest *test = [[RTCMediaConstraintsTest alloc] init];
|
||||
[test testMediaConstraints];
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -30,12 +31,10 @@ extern "C" {
|
||||
#include "rtc_base/gunit.h"
|
||||
#include "rtc_base/system/unused.h"
|
||||
|
||||
@interface RTCPeerConnectionFactoryBuilderTest : NSObject
|
||||
- (void)testBuilder;
|
||||
- (void)testDefaultComponentsBuilder;
|
||||
@interface RTCPeerConnectionFactoryBuilderTests : XCTestCase
|
||||
@end
|
||||
|
||||
@implementation RTCPeerConnectionFactoryBuilderTest
|
||||
@implementation RTCPeerConnectionFactoryBuilderTests
|
||||
|
||||
- (void)testBuilder {
|
||||
id factoryMock = OCMStrictClassMock([RTC_OBJC_TYPE(RTCPeerConnectionFactory) class]);
|
||||
@ -79,17 +78,3 @@ extern "C" {
|
||||
OCMVerifyAll(factoryMock);
|
||||
}
|
||||
@end
|
||||
|
||||
TEST(RTCPeerConnectionFactoryBuilderTest, BuilderTest) {
|
||||
@autoreleasepool {
|
||||
RTCPeerConnectionFactoryBuilderTest* test = [[RTCPeerConnectionFactoryBuilderTest alloc] init];
|
||||
[test testBuilder];
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RTCPeerConnectionFactoryBuilderTest, DefaultComponentsBuilderTest) {
|
||||
@autoreleasepool {
|
||||
RTCPeerConnectionFactoryBuilderTest* test = [[RTCPeerConnectionFactoryBuilderTest alloc] init];
|
||||
[test testDefaultComponentsBuilder];
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@ -27,14 +28,10 @@
|
||||
#import "api/peerconnection/RTCSessionDescription.h"
|
||||
#import "helpers/NSString+StdString.h"
|
||||
|
||||
@interface RTCPeerConnectionTest : NSObject
|
||||
- (void)testConfigurationGetter;
|
||||
- (void)testWithDependencies;
|
||||
- (void)testWithInvalidSDP;
|
||||
- (void)testWithInvalidIceCandidate;
|
||||
@interface RTCPeerConnectionTests : XCTestCase
|
||||
@end
|
||||
|
||||
@implementation RTCPeerConnectionTest
|
||||
@implementation RTCPeerConnectionTests
|
||||
|
||||
- (void)testConfigurationGetter {
|
||||
NSArray *urlStrings = @[ @"stun:stun1.example.net" ];
|
||||
@ -205,31 +202,3 @@
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
TEST(RTCPeerConnectionTest, ConfigurationGetterTest) {
|
||||
@autoreleasepool {
|
||||
RTCPeerConnectionTest *test = [[RTCPeerConnectionTest alloc] init];
|
||||
[test testConfigurationGetter];
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RTCPeerConnectionTest, TestWithDependencies) {
|
||||
@autoreleasepool {
|
||||
RTCPeerConnectionTest *test = [[RTCPeerConnectionTest alloc] init];
|
||||
[test testWithDependencies];
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RTCPeerConnectionTest, TestWithInvalidSDP) {
|
||||
@autoreleasepool {
|
||||
RTCPeerConnectionTest *test = [[RTCPeerConnectionTest alloc] init];
|
||||
[test testWithInvalidSDP];
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RTCPeerConnectionTest, TestWithInvalidIceCandidate) {
|
||||
@autoreleasepool {
|
||||
RTCPeerConnectionTest *test = [[RTCPeerConnectionTest alloc] init];
|
||||
[test testWithInvalidIceCandidate];
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#include "rtc_base/gunit.h"
|
||||
|
||||
@ -16,12 +17,10 @@
|
||||
#import "api/peerconnection/RTCSessionDescription.h"
|
||||
#import "helpers/NSString+StdString.h"
|
||||
|
||||
@interface RTCSessionDescriptionTest : NSObject
|
||||
- (void)testSessionDescriptionConversion;
|
||||
- (void)testInitFromNativeSessionDescription;
|
||||
@interface RTCSessionDescriptionTests : XCTestCase
|
||||
@end
|
||||
|
||||
@implementation RTCSessionDescriptionTest
|
||||
@implementation RTCSessionDescriptionTests
|
||||
|
||||
/**
|
||||
* Test conversion of an Objective-C RTC_OBJC_TYPE(RTCSessionDescription) to a native
|
||||
@ -121,17 +120,3 @@
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
TEST(RTCSessionDescriptionTest, SessionDescriptionConversionTest) {
|
||||
@autoreleasepool {
|
||||
RTCSessionDescriptionTest *test = [[RTCSessionDescriptionTest alloc] init];
|
||||
[test testSessionDescriptionConversion];
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RTCSessionDescriptionTest, InitFromSessionDescriptionTest) {
|
||||
@autoreleasepool {
|
||||
RTCSessionDescriptionTest *test = [[RTCSessionDescriptionTest alloc] init];
|
||||
[test testInitFromNativeSessionDescription];
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -17,11 +18,10 @@
|
||||
#import "api/peerconnection/RTCTracing.h"
|
||||
#import "helpers/NSString+StdString.h"
|
||||
|
||||
@interface RTCTracingTest : NSObject
|
||||
- (void)tracingTestNoInitialization;
|
||||
@interface RTCTracingTests : XCTestCase
|
||||
@end
|
||||
|
||||
@implementation RTCTracingTest
|
||||
@implementation RTCTracingTests
|
||||
|
||||
- (NSString *)documentsFilePathForFileName:(NSString *)fileName {
|
||||
NSParameterAssert(fileName.length);
|
||||
@ -32,17 +32,10 @@
|
||||
return filePath;
|
||||
}
|
||||
|
||||
- (void)tracingTestNoInitialization {
|
||||
- (void)testTracingTestNoInitialization {
|
||||
NSString *filePath = [self documentsFilePathForFileName:@"webrtc-trace.txt"];
|
||||
EXPECT_EQ(NO, RTCStartInternalCapture(filePath));
|
||||
RTCStopInternalCapture();
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
TEST(RTCTracingTest, TracingTestNoInitialization) {
|
||||
@autoreleasepool {
|
||||
RTCTracingTest *test = [[RTCTracingTest alloc] init];
|
||||
[test tracingTestNoInitialization];
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <OCMock/OCMock.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#include "sdk/objc/native/src/objc_video_decoder_factory.h"
|
||||
|
||||
@ -55,21 +56,26 @@ std::unique_ptr<webrtc::VideoDecoder> GetObjCDecoder(
|
||||
|
||||
#pragma mark -
|
||||
|
||||
TEST(ObjCVideoDecoderFactoryTest, ConfigureReturnsTrueOnSuccess) {
|
||||
@interface ObjCVideoDecoderFactoryTests : XCTestCase
|
||||
@end
|
||||
|
||||
@implementation ObjCVideoDecoderFactoryTests
|
||||
|
||||
- (void)testConfigureReturnsTrueOnSuccess {
|
||||
std::unique_ptr<webrtc::VideoDecoder> decoder = GetObjCDecoder(CreateOKDecoderFactory());
|
||||
|
||||
webrtc::VideoDecoder::Settings settings;
|
||||
EXPECT_TRUE(decoder->Configure(settings));
|
||||
}
|
||||
|
||||
TEST(ObjCVideoDecoderFactoryTest, ConfigureReturnsFalseOnFail) {
|
||||
- (void)testConfigureReturnsFalseOnFail {
|
||||
std::unique_ptr<webrtc::VideoDecoder> decoder = GetObjCDecoder(CreateErrorDecoderFactory());
|
||||
|
||||
webrtc::VideoDecoder::Settings settings;
|
||||
EXPECT_FALSE(decoder->Configure(settings));
|
||||
}
|
||||
|
||||
TEST(ObjCVideoDecoderFactoryTest, DecodeReturnsOKOnSuccess) {
|
||||
- (void)testDecodeReturnsOKOnSuccess {
|
||||
std::unique_ptr<webrtc::VideoDecoder> decoder = GetObjCDecoder(CreateOKDecoderFactory());
|
||||
|
||||
webrtc::EncodedImage encoded_image;
|
||||
@ -78,7 +84,7 @@ TEST(ObjCVideoDecoderFactoryTest, DecodeReturnsOKOnSuccess) {
|
||||
EXPECT_EQ(decoder->Decode(encoded_image, false, 0), WEBRTC_VIDEO_CODEC_OK);
|
||||
}
|
||||
|
||||
TEST(ObjCVideoDecoderFactoryTest, DecodeReturnsErrorOnFail) {
|
||||
- (void)testDecodeReturnsErrorOnFail {
|
||||
std::unique_ptr<webrtc::VideoDecoder> decoder = GetObjCDecoder(CreateErrorDecoderFactory());
|
||||
|
||||
webrtc::EncodedImage encoded_image;
|
||||
@ -87,14 +93,15 @@ TEST(ObjCVideoDecoderFactoryTest, DecodeReturnsErrorOnFail) {
|
||||
EXPECT_EQ(decoder->Decode(encoded_image, false, 0), WEBRTC_VIDEO_CODEC_ERROR);
|
||||
}
|
||||
|
||||
TEST(ObjCVideoDecoderFactoryTest, ReleaseDecodeReturnsOKOnSuccess) {
|
||||
- (void)testReleaseDecodeReturnsOKOnSuccess {
|
||||
std::unique_ptr<webrtc::VideoDecoder> decoder = GetObjCDecoder(CreateOKDecoderFactory());
|
||||
|
||||
EXPECT_EQ(decoder->Release(), WEBRTC_VIDEO_CODEC_OK);
|
||||
}
|
||||
|
||||
TEST(ObjCVideoDecoderFactoryTest, ReleaseDecodeReturnsErrorOnFail) {
|
||||
- (void)testReleaseDecodeReturnsErrorOnFail {
|
||||
std::unique_ptr<webrtc::VideoDecoder> decoder = GetObjCDecoder(CreateErrorDecoderFactory());
|
||||
|
||||
EXPECT_EQ(decoder->Release(), WEBRTC_VIDEO_CODEC_ERROR);
|
||||
}
|
||||
@end
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <OCMock/OCMock.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#include "sdk/objc/native/src/objc_video_encoder_factory.h"
|
||||
|
||||
@ -59,7 +60,12 @@ std::unique_ptr<webrtc::VideoEncoder> GetObjCEncoder(
|
||||
|
||||
#pragma mark -
|
||||
|
||||
TEST(ObjCVideoEncoderFactoryTest, InitEncodeReturnsOKOnSuccess) {
|
||||
@interface ObjCVideoEncoderFactoryTests : XCTestCase
|
||||
@end
|
||||
|
||||
@implementation ObjCVideoEncoderFactoryTests
|
||||
|
||||
- (void)testInitEncodeReturnsOKOnSuccess {
|
||||
std::unique_ptr<webrtc::VideoEncoder> encoder = GetObjCEncoder(CreateOKEncoderFactory());
|
||||
|
||||
auto* settings = new webrtc::VideoCodec();
|
||||
@ -68,7 +74,7 @@ TEST(ObjCVideoEncoderFactoryTest, InitEncodeReturnsOKOnSuccess) {
|
||||
WEBRTC_VIDEO_CODEC_OK);
|
||||
}
|
||||
|
||||
TEST(ObjCVideoEncoderFactoryTest, InitEncodeReturnsErrorOnFail) {
|
||||
- (void)testInitEncodeReturnsErrorOnFail {
|
||||
std::unique_ptr<webrtc::VideoEncoder> encoder = GetObjCEncoder(CreateErrorEncoderFactory());
|
||||
|
||||
auto* settings = new webrtc::VideoCodec();
|
||||
@ -77,7 +83,7 @@ TEST(ObjCVideoEncoderFactoryTest, InitEncodeReturnsErrorOnFail) {
|
||||
WEBRTC_VIDEO_CODEC_ERROR);
|
||||
}
|
||||
|
||||
TEST(ObjCVideoEncoderFactoryTest, EncodeReturnsOKOnSuccess) {
|
||||
- (void)testEncodeReturnsOKOnSuccess {
|
||||
std::unique_ptr<webrtc::VideoEncoder> encoder = GetObjCEncoder(CreateOKEncoderFactory());
|
||||
|
||||
CVPixelBufferRef pixel_buffer;
|
||||
@ -95,7 +101,7 @@ TEST(ObjCVideoEncoderFactoryTest, EncodeReturnsOKOnSuccess) {
|
||||
EXPECT_EQ(encoder->Encode(frame, &frame_types), WEBRTC_VIDEO_CODEC_OK);
|
||||
}
|
||||
|
||||
TEST(ObjCVideoEncoderFactoryTest, EncodeReturnsErrorOnFail) {
|
||||
- (void)testEncodeReturnsErrorOnFail {
|
||||
std::unique_ptr<webrtc::VideoEncoder> encoder = GetObjCEncoder(CreateErrorEncoderFactory());
|
||||
|
||||
CVPixelBufferRef pixel_buffer;
|
||||
@ -113,28 +119,30 @@ TEST(ObjCVideoEncoderFactoryTest, EncodeReturnsErrorOnFail) {
|
||||
EXPECT_EQ(encoder->Encode(frame, &frame_types), WEBRTC_VIDEO_CODEC_ERROR);
|
||||
}
|
||||
|
||||
TEST(ObjCVideoEncoderFactoryTest, ReleaseEncodeReturnsOKOnSuccess) {
|
||||
- (void)testReleaseEncodeReturnsOKOnSuccess {
|
||||
std::unique_ptr<webrtc::VideoEncoder> encoder = GetObjCEncoder(CreateOKEncoderFactory());
|
||||
|
||||
EXPECT_EQ(encoder->Release(), WEBRTC_VIDEO_CODEC_OK);
|
||||
}
|
||||
|
||||
TEST(ObjCVideoEncoderFactoryTest, ReleaseEncodeReturnsErrorOnFail) {
|
||||
- (void)testReleaseEncodeReturnsErrorOnFail {
|
||||
std::unique_ptr<webrtc::VideoEncoder> encoder = GetObjCEncoder(CreateErrorEncoderFactory());
|
||||
|
||||
EXPECT_EQ(encoder->Release(), WEBRTC_VIDEO_CODEC_ERROR);
|
||||
}
|
||||
|
||||
TEST(ObjCVideoEncoderFactoryTest, GetSupportedFormats) {
|
||||
- (void)testGetSupportedFormats {
|
||||
webrtc::ObjCVideoEncoderFactory encoder_factory(CreateOKEncoderFactory());
|
||||
std::vector<webrtc::SdpVideoFormat> supportedFormats = encoder_factory.GetSupportedFormats();
|
||||
EXPECT_EQ(supportedFormats.size(), 1u);
|
||||
EXPECT_EQ(supportedFormats[0].name, "H264");
|
||||
}
|
||||
|
||||
TEST(ObjCVideoEncoderFactoryTest, GetImplementations) {
|
||||
- (void)testGetImplementations {
|
||||
webrtc::ObjCVideoEncoderFactory encoder_factory(CreateOKEncoderFactory());
|
||||
std::vector<webrtc::SdpVideoFormat> supportedFormats = encoder_factory.GetImplementations();
|
||||
EXPECT_EQ(supportedFormats.size(), 1u);
|
||||
EXPECT_EQ(supportedFormats[0].name, "H264");
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -8,6 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#include "sdk/objc/helpers/scoped_cftyperef.h"
|
||||
|
||||
#include "test/gtest.h"
|
||||
@ -40,19 +42,24 @@ using ScopedTestType = rtc::internal::ScopedTypeRef<TestTypeRef, TestTypeTraits>
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-variable"
|
||||
|
||||
TEST(ScopedTypeRefTest, ShouldNotRetainByDefault) {
|
||||
@interface ScopedTypeRefTests : XCTestCase
|
||||
@end
|
||||
|
||||
@implementation ScopedTypeRefTests
|
||||
|
||||
- (void)testShouldNotRetainByDefault {
|
||||
TestType a;
|
||||
ScopedTestType ref(&a);
|
||||
EXPECT_EQ(0, a.retain_count);
|
||||
}
|
||||
|
||||
TEST(ScopedTypeRefTest, ShouldRetainWithPolicy) {
|
||||
- (void)testShouldRetainWithPolicy {
|
||||
TestType a;
|
||||
ScopedTestType ref(&a, rtc::RetainPolicy::RETAIN);
|
||||
EXPECT_EQ(1, a.retain_count);
|
||||
}
|
||||
|
||||
TEST(ScopedTypeRefTest, ShouldReleaseWhenLeavingScope) {
|
||||
- (void)testShouldReleaseWhenLeavingScope {
|
||||
TestType a;
|
||||
EXPECT_EQ(0, a.retain_count);
|
||||
{
|
||||
@ -62,7 +69,7 @@ TEST(ScopedTypeRefTest, ShouldReleaseWhenLeavingScope) {
|
||||
EXPECT_EQ(0, a.retain_count);
|
||||
}
|
||||
|
||||
TEST(ScopedTypeRefTest, ShouldBeCopyable) {
|
||||
- (void)testShouldBeCopyable {
|
||||
TestType a;
|
||||
EXPECT_EQ(0, a.retain_count);
|
||||
{
|
||||
@ -74,7 +81,7 @@ TEST(ScopedTypeRefTest, ShouldBeCopyable) {
|
||||
EXPECT_EQ(0, a.retain_count);
|
||||
}
|
||||
|
||||
TEST(ScopedTypeRefTest, CanReleaseOwnership) {
|
||||
- (void)testCanReleaseOwnership {
|
||||
TestType a;
|
||||
EXPECT_EQ(0, a.retain_count);
|
||||
{
|
||||
@ -85,7 +92,7 @@ TEST(ScopedTypeRefTest, CanReleaseOwnership) {
|
||||
EXPECT_EQ(1, a.retain_count);
|
||||
}
|
||||
|
||||
TEST(ScopedTypeRefTest, ShouldBeTestableForTruthiness) {
|
||||
- (void)testShouldBeTestableForTruthiness {
|
||||
ScopedTestType ref;
|
||||
EXPECT_FALSE(ref);
|
||||
TestType a;
|
||||
@ -95,10 +102,12 @@ TEST(ScopedTypeRefTest, ShouldBeTestableForTruthiness) {
|
||||
EXPECT_FALSE(ref);
|
||||
}
|
||||
|
||||
TEST(ScopedTypeRefTest, ShouldProvideAccessToWrappedType) {
|
||||
- (void)testShouldProvideAccessToWrappedType {
|
||||
TestType a;
|
||||
ScopedTestType ref(&a);
|
||||
EXPECT_EQ(&(a.retain_count), &(ref->retain_count));
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user