Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
xuning
/
livekitAndroidXuningTest
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
David Liu
2021-04-04 11:57:37 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
56ddaeafcac475cfd1a3f75d6bd9c861e593105e
56ddaeaf
1 parent
d2271be1
More remote participant tests
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
42 行增加
和
3 行删除
livekit-android-sdk/src/test/java/io/livekit/android/room/participant/RemoteParticipantTest.kt
livekit-android-sdk/src/test/java/io/livekit/android/room/participant/RemoteParticipantTest.kt
查看文件 @
56ddaea
...
...
@@ -2,23 +2,35 @@ package io.livekit.android.room.participant
import io.livekit.android.room.RTCClient
import livekit.LivekitModels
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Assert.*
import org.junit.Before
import org.junit.Test
import org.mockito.Mockito
class RemoteParticipantTest {
lateinit var rtcClient: RTCClient
lateinit var participant: RemoteParticipant
@Before
fun setup() {
val
rtcClient = Mockito.mock(RTCClient::class.java)
rtcClient = Mockito.mock(RTCClient::class.java)
participant = RemoteParticipant(rtcClient, "sid")
}
@Test
fun constructorAddsTrack() {
val info = LivekitModels.ParticipantInfo.newBuilder(INFO)
.addTracks(TRACK_INFO)
.build()
participant = RemoteParticipant(rtcClient, info)
assertEquals(1, participant.tracks.values.size)
assertNotNull(participant.getTrackPublication(TRACK_INFO.sid))
}
@Test
fun updateFromInfoAddsTrack() {
val newTrackInfo = LivekitModels.ParticipantInfo.newBuilder(INFO)
.addTracks(TRACK_INFO)
...
...
@@ -30,6 +42,33 @@ class RemoteParticipantTest {
assertNotNull(participant.getTrackPublication(TRACK_INFO.sid))
}
@Test
fun updateFromInfoRemovesTrack() {
val newTrackInfo = LivekitModels.ParticipantInfo.newBuilder(INFO)
.addTracks(TRACK_INFO)
.build()
participant.updateFromInfo(newTrackInfo)
participant.updateFromInfo(INFO)
assertEquals(0, participant.tracks.values.size)
assertNull(participant.getTrackPublication(TRACK_INFO.sid))
}
@Test
fun unpublishTrackRemoves() {
val newTrackInfo = LivekitModels.ParticipantInfo.newBuilder(INFO)
.addTracks(TRACK_INFO)
.build()
participant.updateFromInfo(newTrackInfo)
participant.unpublishTrack(TRACK_INFO.sid)
assertEquals(0, participant.tracks.values.size)
assertNull(participant.getTrackPublication(TRACK_INFO.sid))
}
companion object {
val INFO = LivekitModels.ParticipantInfo.newBuilder()
...
...
请
注册
或
登录
后发表评论