Chromium Code Reviews| Index: webrtc/api/objctests/RTCDataChannelConfigurationTest.mm |
| diff --git a/webrtc/api/objctests/RTCDataChannelConfigurationTest.mm b/webrtc/api/objctests/RTCDataChannelConfigurationTest.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f3973031e211338a0141b88e3c90375a9b8e7313 |
| --- /dev/null |
| +++ b/webrtc/api/objctests/RTCDataChannelConfigurationTest.mm |
| @@ -0,0 +1,52 @@ |
| +/* |
| + * Copyright 2015 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> |
| + |
| +#include "webrtc/base/gunit.h" |
| + |
| +#import "webrtc/api/objc/RTCDataChannelConfiguration.h" |
| +#import "webrtc/api/objc/RTCDataChannelConfiguration+Private.h" |
| +#import "webrtc/base/objc/NSString+StdString.h" |
| + |
| +@interface RTCDataChannelConfigurationTest : NSObject |
| +- (void)testConversionToNativeDataChannelInit; |
| +@end |
| + |
| +@implementation RTCDataChannelConfigurationTest |
| + |
| +- (void)testConversionToNativeDataChannelInit { |
| + RTCDataChannelConfiguration *dataChannelConfig = |
| + [[RTCDataChannelConfiguration alloc] init]; |
| + dataChannelConfig.isOrdered = NO; |
| + dataChannelConfig.maxPacketLifeTime = 5; |
|
tkchin_webrtc
2016/01/26 20:12:43
consider using one variable for both setting the c
hjon_webrtc
2016/01/27 18:38:36
Done.
|
| + dataChannelConfig.maxRetransmits = 4; |
| + dataChannelConfig.isNegotiated = YES; |
| + dataChannelConfig.streamId = 4; |
| + dataChannelConfig.protocol = @"protocol"; |
| + |
| + webrtc::DataChannelInit nativeInit = dataChannelConfig.nativeDataChannelInit; |
| + EXPECT_EQ(false, nativeInit.ordered); |
| + EXPECT_EQ(5, nativeInit.maxRetransmitTime); |
| + EXPECT_EQ(4, nativeInit.maxRetransmits); |
| + EXPECT_EQ(true, nativeInit.negotiated); |
| + EXPECT_EQ(4, nativeInit.id); |
| + EXPECT_EQ("protocol", nativeInit.protocol); |
| +} |
| + |
| +@end |
| + |
| +TEST(RTCDataChannelConfiguration, NativeDataChannelInitConversionTest) { |
| + @autoreleasepool { |
| + RTCDataChannelConfigurationTest *test = |
| + [[RTCDataChannelConfigurationTest alloc] init]; |
| + [test testConversionToNativeDataChannelInit]; |
| + } |
| +} |