Skip to content

Commit a9433c5

Browse files
committed
test: add tests for recording device functionality in HeadlessADM
1 parent f5b8880 commit a9433c5

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

webrtc/src/test/java/dev/onvoid/webrtc/media/audio/HeadlessADMTest.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ void tearDown() {
3434
catch (Throwable ignored) {
3535
// Ignore any exceptions during stopPlayout, as it may not be initialized.
3636
}
37+
try {
38+
adm.stopRecording();
39+
}
40+
catch (Throwable ignored) {
41+
// Ignore any exceptions during stopRecording, as it may not be initialized.
42+
}
3743
adm.dispose();
3844
adm = null;
3945
}
@@ -46,6 +52,13 @@ void getPlayoutDevices_returnsAtLeastOneDevice() {
4652
assertFalse(devices.isEmpty(), "Headless module should expose at least one dummy playout device");
4753
}
4854

55+
@Test
56+
void getRecordingDevices_returnsAtLeastOneDevice() {
57+
List<AudioDevice> devices = adm.getRecordingDevices();
58+
assertNotNull(devices, "Recording devices list should not be null");
59+
assertFalse(devices.isEmpty(), "Headless module should expose at least one dummy recording device");
60+
}
61+
4962
@Test
5063
void startStopPlayout_afterInit_doesNotThrow() {
5164
assertDoesNotThrow(() -> {
@@ -55,11 +68,25 @@ void startStopPlayout_afterInit_doesNotThrow() {
5568
});
5669
}
5770

71+
@Test
72+
void startStopRecording_afterInit_doesNotThrow() {
73+
assertDoesNotThrow(() -> {
74+
adm.initRecording();
75+
adm.startRecording();
76+
adm.stopRecording();
77+
});
78+
}
79+
5880
@Test
5981
void startPlayout_withoutInit_throwsException() {
6082
assertThrows(Error.class, () -> adm.startPlayout());
6183
}
6284

85+
@Test
86+
void startRecording_withoutInit_throwsException() {
87+
assertThrows(Error.class, () -> adm.startRecording());
88+
}
89+
6390
@Test
6491
void initPeerConnectionFactory() {
6592
PeerConnectionFactory factory = new PeerConnectionFactory(adm);

0 commit comments

Comments
 (0)