Fix building RTCCameraVideoCapturereTests with iOS 11 SDK.

The iOS 11 SDK adds nullability annotations to several framework functions
and in this it added the _Nonnull specifier to a protocol method that
we implement. We were passing nil to that method in a test.
The warning is now fixed by passing a mock object instead of nil.

Bug: webrtc:7883
Change-Id: I9f64b0c59750629ca3969400aa725729bb10541b
Reviewed-on: https://chromium-review.googlesource.com/549927
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Kári Tristan Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#18780}
This commit is contained in:
Kári Tristan Helgason
2017-06-27 10:52:04 +02:00
committed by Commit Bot
parent 2d94f815c6
commit 17c11ec37c

View File

@ -64,16 +64,19 @@ CMSampleBufferRef createTestSampleBufferRef() {
@interface RTCCameraVideoCapturerTests : NSObject
@property(nonatomic, strong) id delegateMock;
@property(nonatomic, strong) id deviceMock;
@property(nonatomic, strong) id captureConnectionMock;
@property(nonatomic, strong) RTCCameraVideoCapturer *capturer;
@end
@implementation RTCCameraVideoCapturerTests
@synthesize delegateMock = _delegateMock;
@synthesize captureConnectionMock = _captureConnectionMock;
@synthesize capturer = _capturer;
@synthesize deviceMock = _deviceMock;
- (void)setup {
self.delegateMock = OCMProtocolMock(@protocol(RTCVideoCapturerDelegate));
self.captureConnectionMock = OCMClassMock([AVCaptureConnection class]);
self.capturer = [[RTCCameraVideoCapturer alloc] initWithDelegate:self.delegateMock];
self.deviceMock = [self createDeviceMock];
}
@ -169,7 +172,7 @@ CMSampleBufferRef createTestSampleBufferRef() {
// when
[self.capturer captureOutput:self.capturer.captureSession.outputs[0]
didOutputSampleBuffer:sampleBuffer
fromConnection:nil];
fromConnection:self.captureConnectionMock];
// then
[self.delegateMock verify];
@ -203,7 +206,7 @@ CMSampleBufferRef createTestSampleBufferRef() {
[self.capturer captureOutput:self.capturer.captureSession.outputs[0]
didOutputSampleBuffer:sampleBuffer
fromConnection:nil];
fromConnection:self.captureConnectionMock];
[self.delegateMock verify];