-
Couldn't load subscription status.
- Fork 2
Fix crash on addIceCandidate, setRemote/LocalDescription #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,16 +18,20 @@ | |
| #import "api/peerconnection/RTCConfiguration+Private.h" | ||
| #import "api/peerconnection/RTCConfiguration.h" | ||
| #import "api/peerconnection/RTCCryptoOptions.h" | ||
| #import "api/peerconnection/RTCIceCandidate.h" | ||
| #import "api/peerconnection/RTCIceServer.h" | ||
| #import "api/peerconnection/RTCMediaConstraints.h" | ||
| #import "api/peerconnection/RTCPeerConnection.h" | ||
| #import "api/peerconnection/RTCPeerConnectionFactory+Native.h" | ||
| #import "api/peerconnection/RTCPeerConnectionFactory.h" | ||
| #import "api/peerconnection/RTCSessionDescription.h" | ||
| #import "helpers/NSString+StdString.h" | ||
|
|
||
| @interface RTCPeerConnectionTest : NSObject | ||
| - (void)testConfigurationGetter; | ||
| - (void)testWithDependencies; | ||
| - (void)testWithInvalidSDP; | ||
| - (void)testWithInvalidIceCandidate; | ||
| @end | ||
|
|
||
| @implementation RTCPeerConnectionTest | ||
|
|
@@ -137,6 +141,66 @@ - (void)testWithDependencies { | |
| } | ||
| } | ||
|
|
||
| - (void)testWithInvalidSDP { | ||
| RTC_OBJC_TYPE(RTCPeerConnectionFactory) *factory = | ||
| [[RTC_OBJC_TYPE(RTCPeerConnectionFactory) alloc] init]; | ||
|
|
||
| RTC_OBJC_TYPE(RTCConfiguration) *config = [[RTC_OBJC_TYPE(RTCConfiguration) alloc] init]; | ||
| RTC_OBJC_TYPE(RTCMediaConstraints) *contraints = | ||
| [[RTC_OBJC_TYPE(RTCMediaConstraints) alloc] initWithMandatoryConstraints:@{} | ||
| optionalConstraints:nil]; | ||
| RTC_OBJC_TYPE(RTCPeerConnection) *peerConnection = | ||
| [factory peerConnectionWithConfiguration:config constraints:contraints delegate:nil]; | ||
|
|
||
| dispatch_semaphore_t negotiatedSem = dispatch_semaphore_create(0); | ||
| [peerConnection setRemoteDescription:[[RTC_OBJC_TYPE(RTCSessionDescription) alloc] | ||
| initWithType:RTCSdpTypeOffer | ||
| sdp:@"invalid"] | ||
| completionHandler:^(NSError *error) { | ||
| ASSERT_NE(error, nil); | ||
| if (error != nil) { | ||
| dispatch_semaphore_signal(negotiatedSem); | ||
| } | ||
| }]; | ||
|
|
||
| NSTimeInterval timeout = 5; | ||
| ASSERT_EQ( | ||
| 0, | ||
| dispatch_semaphore_wait(negotiatedSem, | ||
| dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeout * NSEC_PER_SEC)))); | ||
|
Comment on lines
+162
to
+170
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 167 번째줄의 ASSERT_EQ은 162번째줄의 disaptch_semaphor_signal 메소드 호출까지 기다리는게 맞나요? |
||
| [peerConnection close]; | ||
| } | ||
|
|
||
| - (void)testWithInvalidIceCandidate { | ||
| RTC_OBJC_TYPE(RTCPeerConnectionFactory) *factory = | ||
| [[RTC_OBJC_TYPE(RTCPeerConnectionFactory) alloc] init]; | ||
|
|
||
| RTC_OBJC_TYPE(RTCConfiguration) *config = [[RTC_OBJC_TYPE(RTCConfiguration) alloc] init]; | ||
| RTC_OBJC_TYPE(RTCMediaConstraints) *contraints = | ||
| [[RTC_OBJC_TYPE(RTCMediaConstraints) alloc] initWithMandatoryConstraints:@{} | ||
| optionalConstraints:nil]; | ||
| RTC_OBJC_TYPE(RTCPeerConnection) *peerConnection = | ||
| [factory peerConnectionWithConfiguration:config constraints:contraints delegate:nil]; | ||
|
|
||
| dispatch_semaphore_t negotiatedSem = dispatch_semaphore_create(0); | ||
| [peerConnection addIceCandidate:[[RTC_OBJC_TYPE(RTCIceCandidate) alloc] initWithSdp:@"invalid" | ||
| sdpMLineIndex:-1 | ||
| sdpMid:nil] | ||
| completionHandler:^(NSError *error) { | ||
| ASSERT_NE(error, nil); | ||
| if (error != nil) { | ||
| dispatch_semaphore_signal(negotiatedSem); | ||
| } | ||
| }]; | ||
|
|
||
| NSTimeInterval timeout = 5; | ||
| ASSERT_EQ( | ||
| 0, | ||
| dispatch_semaphore_wait(negotiatedSem, | ||
| dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeout * NSEC_PER_SEC)))); | ||
| [peerConnection close]; | ||
| } | ||
|
|
||
| @end | ||
|
|
||
| TEST(RTCPeerConnectionTest, ConfigurationGetterTest) { | ||
|
|
@@ -152,3 +216,17 @@ - (void)testWithDependencies { | |
| [test testWithDependencies]; | ||
| } | ||
| } | ||
|
|
||
| TEST(RTCPeerConnectionTest, TestWithInvalidSDP) { | ||
| @autoreleasepool { | ||
| RTCPeerConnectionTest *test = [[RTCPeerConnectionTest alloc] init]; | ||
| [test testWithInvalidSDP]; | ||
| } | ||
| } | ||
|
|
||
| TEST(RTCPeerConnectionTest, TestWithInvalidIceCandidate) { | ||
| @autoreleasepool { | ||
| RTCPeerConnectionTest *test = [[RTCPeerConnectionTest alloc] init]; | ||
| [test testWithInvalidIceCandidate]; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,7 @@ - (void)testSessionDescriptionConversion { | |
| RTC_OBJC_TYPE(RTCSessionDescription) *description = | ||
| [[RTC_OBJC_TYPE(RTCSessionDescription) alloc] initWithType:RTCSdpTypeAnswer sdp:[self sdp]]; | ||
|
|
||
| webrtc::SessionDescriptionInterface *nativeDescription = | ||
| std::unique_ptr<webrtc::SessionDescriptionInterface> nativeDescription = | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 둘의 차이가 뭔가요? |
||
| description.nativeDescription; | ||
|
|
||
| EXPECT_EQ(RTCSdpTypeAnswer, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clone()은 뭔가요? Copying인가요?
제거하신 이유가 뭔가요?