From 17c11ec37ca155613e298acb1069f05901b1588f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A1ri=20Tristan=20Helgason?= Date: Tue, 27 Jun 2017 10:52:04 +0200 Subject: [PATCH] Fix building RTCCameraVideoCapturereTests with iOS 11 SDK. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Commit-Queue: Kári Tristan Helgason Cr-Commit-Position: refs/heads/master@{#18780} --- .../Framework/UnitTests/RTCCameraVideoCapturerTests.mm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/webrtc/sdk/objc/Framework/UnitTests/RTCCameraVideoCapturerTests.mm b/webrtc/sdk/objc/Framework/UnitTests/RTCCameraVideoCapturerTests.mm index affd45275e..76ff66116b 100644 --- a/webrtc/sdk/objc/Framework/UnitTests/RTCCameraVideoCapturerTests.mm +++ b/webrtc/sdk/objc/Framework/UnitTests/RTCCameraVideoCapturerTests.mm @@ -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];