Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: webrtc/sdk/objc/Framework/UnitTests/objc_video_decoder_factory_tests.mm

Issue 3007433002: Let CreateVideoDecoder take a cricket::VideoCodec. (Closed)
Patch Set: return a value from unused function Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/sdk/objc/Framework/Classes/VideoToolbox/objc_video_decoder_factory.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #import <Foundation/Foundation.h> 11 #import <Foundation/Foundation.h>
12 #import <OCMock/OCMock.h> 12 #import <OCMock/OCMock.h>
13 13
14 #include "webrtc/sdk/objc/Framework/Classes/VideoToolbox/objc_video_decoder_fact ory.h" 14 #include "webrtc/sdk/objc/Framework/Classes/VideoToolbox/objc_video_decoder_fact ory.h"
15 15
16 #import "WebRTC/RTCVideoCodec.h" 16 #import "WebRTC/RTCVideoCodec.h"
17 #import "WebRTC/RTCVideoCodecFactory.h" 17 #import "WebRTC/RTCVideoCodecFactory.h"
18 #include "webrtc/media/base/codec.h"
18 #include "webrtc/modules/include/module_common_types.h" 19 #include "webrtc/modules/include/module_common_types.h"
19 #include "webrtc/modules/video_coding/include/video_codec_interface.h" 20 #include "webrtc/modules/video_coding/include/video_codec_interface.h"
20 #include "webrtc/modules/video_coding/include/video_error_codes.h" 21 #include "webrtc/modules/video_coding/include/video_error_codes.h"
21 #include "webrtc/rtc_base/gunit.h" 22 #include "webrtc/rtc_base/gunit.h"
22 23
23 id<RTCVideoDecoderFactory> CreateDecoderFactoryReturning(int return_code) { 24 id<RTCVideoDecoderFactory> CreateDecoderFactoryReturning(int return_code) {
24 id decoderMock = OCMProtocolMock(@protocol(RTCVideoDecoder)); 25 id decoderMock = OCMProtocolMock(@protocol(RTCVideoDecoder));
25 OCMStub([decoderMock startDecodeWithSettings:[OCMArg any] numberOfCores:1]) 26 OCMStub([decoderMock startDecodeWithSettings:[OCMArg any] numberOfCores:1])
26 .andReturn(return_code); 27 .andReturn(return_code);
27 OCMStub([decoderMock decode:[OCMArg any] 28 OCMStub([decoderMock decode:[OCMArg any]
(...skipping 14 matching lines...) Expand all
42 id<RTCVideoDecoderFactory> CreateOKDecoderFactory() { 43 id<RTCVideoDecoderFactory> CreateOKDecoderFactory() {
43 return CreateDecoderFactoryReturning(WEBRTC_VIDEO_CODEC_OK); 44 return CreateDecoderFactoryReturning(WEBRTC_VIDEO_CODEC_OK);
44 } 45 }
45 46
46 id<RTCVideoDecoderFactory> CreateErrorDecoderFactory() { 47 id<RTCVideoDecoderFactory> CreateErrorDecoderFactory() {
47 return CreateDecoderFactoryReturning(WEBRTC_VIDEO_CODEC_ERROR); 48 return CreateDecoderFactoryReturning(WEBRTC_VIDEO_CODEC_ERROR);
48 } 49 }
49 50
50 webrtc::VideoDecoder *GetObjCDecoder(id<RTCVideoDecoderFactory> factory) { 51 webrtc::VideoDecoder *GetObjCDecoder(id<RTCVideoDecoderFactory> factory) {
51 webrtc::ObjCVideoDecoderFactory decoder_factory(factory); 52 webrtc::ObjCVideoDecoderFactory decoder_factory(factory);
52 return decoder_factory.CreateVideoDecoder(webrtc::kVideoCodecH264); 53 return decoder_factory.CreateVideoDecoderWithParams(cricket::VideoCodec(cricke t::kH264CodecName),
54 {});
53 } 55 }
54 56
55 #pragma mark - 57 #pragma mark -
56 58
57 TEST(ObjCVideoDecoderFactoryTest, InitDecodeReturnsOKOnSuccess) { 59 TEST(ObjCVideoDecoderFactoryTest, InitDecodeReturnsOKOnSuccess) {
58 webrtc::VideoDecoder *decoder = GetObjCDecoder(CreateOKDecoderFactory()); 60 webrtc::VideoDecoder *decoder = GetObjCDecoder(CreateOKDecoderFactory());
59 61
60 auto settings = new webrtc::VideoCodec(); 62 auto settings = new webrtc::VideoCodec();
61 EXPECT_EQ(decoder->InitDecode(settings, 1), WEBRTC_VIDEO_CODEC_OK); 63 EXPECT_EQ(decoder->InitDecode(settings, 1), WEBRTC_VIDEO_CODEC_OK);
62 } 64 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 webrtc::VideoDecoder *decoder = GetObjCDecoder(CreateOKDecoderFactory()); 96 webrtc::VideoDecoder *decoder = GetObjCDecoder(CreateOKDecoderFactory());
95 97
96 EXPECT_EQ(decoder->Release(), WEBRTC_VIDEO_CODEC_OK); 98 EXPECT_EQ(decoder->Release(), WEBRTC_VIDEO_CODEC_OK);
97 } 99 }
98 100
99 TEST(ObjCVideoDecoderFactoryTest, ReleaseDecodeReturnsErrorOnFail) { 101 TEST(ObjCVideoDecoderFactoryTest, ReleaseDecodeReturnsErrorOnFail) {
100 webrtc::VideoDecoder *decoder = GetObjCDecoder(CreateErrorDecoderFactory()); 102 webrtc::VideoDecoder *decoder = GetObjCDecoder(CreateErrorDecoderFactory());
101 103
102 EXPECT_EQ(decoder->Release(), WEBRTC_VIDEO_CODEC_ERROR); 104 EXPECT_EQ(decoder->Release(), WEBRTC_VIDEO_CODEC_ERROR);
103 } 105 }
OLDNEW
« no previous file with comments | « webrtc/sdk/objc/Framework/Classes/VideoToolbox/objc_video_decoder_factory.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698