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

Unified Diff: webrtc/examples/objc/AppRTCMobile/tests/ARDSDPUtils_xctest.mm

Issue 2697603002: Move iOS tests to XCTest from gtest. (Closed)
Patch Set: Enable apprtcmobile tests on bots Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/examples/objc/AppRTCMobile/tests/ARDSDPUtils_xctest.mm
diff --git a/webrtc/examples/objc/AppRTCMobile/tests/ARDSDPUtils_xctest.mm b/webrtc/examples/objc/AppRTCMobile/tests/ARDSDPUtils_xctest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..e764f86f96f32678e111f9c430c247ecae134ebb
--- /dev/null
+++ b/webrtc/examples/objc/AppRTCMobile/tests/ARDSDPUtils_xctest.mm
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2017 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#import <Foundation/Foundation.h>
+#import <XCTest/XCTest.h>
+
+#import "WebRTC/RTCSessionDescription.h"
+
+#import "ARDSDPUtils.h"
+
+@interface ARDSDPUtilsTest : XCTestCase
+- (void)testPreferVideoCodecH264;
daniela-webrtc 2017/02/13 16:08:22 nit: We could probably ditch the declaration of te
kjellander_webrtc 2017/02/14 09:04:10 Fine with me. If they don't provide any value I do
kthelgason 2017/02/14 09:48:46 Done.
+- (void)testPreferVideoCodecVP8;
+- (void)testNoMLine;
+- (void)testMissingCodec;
+@end
+
+@implementation ARDSDPUtilsTest
+
+- (void)testPreferVideoCodecH264 {
+ NSString *sdp = @("m=video 9 RTP/SAVPF 100 116 117 96 120 97\n"
+ "a=rtpmap:120 H264/90000\n"
+ "a=rtpmap:97 H264/90000\n");
+ NSString *expectedSdp = @("m=video 9 RTP/SAVPF 120 97 100 116 117 96\n"
+ "a=rtpmap:120 H264/90000\n"
+ "a=rtpmap:97 H264/90000\n");
+ [self preferVideoCodec:@"H264" sdp:sdp expected:expectedSdp];
+}
+
+- (void)testPreferVideoCodecVP8 {
+ NSString *sdp = @("m=video 9 RTP/SAVPF 100 116 117 96 120 97\n"
+ "a=rtpmap:116 VP8/90000\n");
+ NSString *expectedSdp = @("m=video 9 RTP/SAVPF 116 100 117 96 120 97\n"
+ "a=rtpmap:116 VP8/90000\n");
+ [self preferVideoCodec:@"VP8" sdp:sdp expected:expectedSdp];
+}
+
+- (void)testNoMLine {
+ NSString *sdp = @("a=rtpmap:116 VP8/90000\n");
+ [self preferVideoCodec:@"VP8" sdp:sdp expected:sdp];
+}
+
+- (void)testMissingCodec {
+ NSString *sdp = @("m=video 9 RTP/SAVPF 100 116 117 96 120 97\n"
+ "a=rtpmap:116 VP8/90000\n");
+ [self preferVideoCodec:@"foo" sdp:sdp expected:sdp];
+}
+
+#pragma mark - Helpers
+
+- (void)preferVideoCodec:(NSString *)codec
+ sdp:(NSString *)sdp
+ expected:(NSString *)expectedSdp{
+ RTCSessionDescription* desc =
+ [[RTCSessionDescription alloc] initWithType:RTCSdpTypeOffer sdp:sdp];
+ RTCSessionDescription *outputDesc =
+ [ARDSDPUtils descriptionForDescription:desc
+ preferredVideoCodec:codec];
+ XCTAssertTrue([outputDesc.description rangeOfString:expectedSdp].location != NSNotFound);
+}
+@end

Powered by Google App Engine
This is Rietveld 408576698