You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
2.0 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Copyright 2015 The WebRTC project authors. All Rights Reserved.
  3. *
  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
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #import <Foundation/Foundation.h>
  11. #include "rtc_base/gunit.h"
  12. #import "api/peerconnection/RTCDataChannelConfiguration+Private.h"
  13. #import "api/peerconnection/RTCDataChannelConfiguration.h"
  14. #import "helpers/NSString+StdString.h"
  15. @interface RTCDataChannelConfigurationTest : NSObject
  16. - (void)testConversionToNativeDataChannelInit;
  17. @end
  18. @implementation RTCDataChannelConfigurationTest
  19. - (void)testConversionToNativeDataChannelInit {
  20. BOOL isOrdered = NO;
  21. int maxPacketLifeTime = 5;
  22. int maxRetransmits = 4;
  23. BOOL isNegotiated = YES;
  24. int channelId = 4;
  25. NSString *protocol = @"protocol";
  26. RTCDataChannelConfiguration *dataChannelConfig =
  27. [[RTCDataChannelConfiguration alloc] init];
  28. dataChannelConfig.isOrdered = isOrdered;
  29. dataChannelConfig.maxPacketLifeTime = maxPacketLifeTime;
  30. dataChannelConfig.maxRetransmits = maxRetransmits;
  31. dataChannelConfig.isNegotiated = isNegotiated;
  32. dataChannelConfig.channelId = channelId;
  33. dataChannelConfig.protocol = protocol;
  34. webrtc::DataChannelInit nativeInit = dataChannelConfig.nativeDataChannelInit;
  35. EXPECT_EQ(isOrdered, nativeInit.ordered);
  36. EXPECT_EQ(maxPacketLifeTime, nativeInit.maxRetransmitTime);
  37. EXPECT_EQ(maxRetransmits, nativeInit.maxRetransmits);
  38. EXPECT_EQ(isNegotiated, nativeInit.negotiated);
  39. EXPECT_EQ(channelId, nativeInit.id);
  40. EXPECT_EQ(protocol.stdString, nativeInit.protocol);
  41. }
  42. @end
  43. TEST(RTCDataChannelConfiguration, NativeDataChannelInitConversionTest) {
  44. @autoreleasepool {
  45. RTCDataChannelConfigurationTest *test =
  46. [[RTCDataChannelConfigurationTest alloc] init];
  47. [test testConversionToNativeDataChannelInit];
  48. }
  49. }