Implement native WebRtcTest validation (#96)
Some checks failed
Native code generation / deterministic (push) Failing after 2m5s
Imaging and meshing gate / native (push) Failing after 5m37s
JPEG 2000 feature / linux (push) Successful in 2m49s
Native Rust workspace compile / compile (push) Failing after 17m32s
Skia feature / linux (push) Successful in 31m32s
Some checks failed
Native code generation / deterministic (push) Failing after 2m5s
Imaging and meshing gate / native (push) Failing after 5m37s
JPEG 2000 feature / linux (push) Successful in 2m49s
Native Rust workspace compile / compile (push) Failing after 17m32s
Skia feature / linux (push) Successful in 31m32s
This commit is contained in:
@@ -20,6 +20,7 @@ libremetaverse-types = { path = "../../crates/libremetaverse-types" }
|
||||
libremetaverse-utilities = { path = "../../crates/libremetaverse-utilities" }
|
||||
libremetaverse-voice-vivox = { path = "../../crates/libremetaverse-voice-vivox" }
|
||||
libremetaverse-voice-webrtc = { path = "../../crates/libremetaverse-voice-webrtc" }
|
||||
serde_json = "1"
|
||||
tokio = { version = "1.47.1", features = ["io-util", "macros", "net", "rt-multi-thread", "time"] }
|
||||
|
||||
[lints]
|
||||
|
||||
57
tests/compat/tests/webrtc_protocol_semantics.rs
Normal file
57
tests/compat/tests/webrtc_protocol_semantics.rs
Normal file
@@ -0,0 +1,57 @@
|
||||
use libremetaverse::types::UUID;
|
||||
use libremetaverse_voice_webrtc::{
|
||||
CloseRequest, Jsep, ProvisionRequest, SignalingComplete, SignalingCompleteRequest, VoiceSecret,
|
||||
encode_pcm_48k_mono,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn local_provision_matches_web_rtc_capability_wire_shape() {
|
||||
let request = ProvisionRequest {
|
||||
jsep: Jsep {
|
||||
kind: "offer".into(),
|
||||
sdp: "v=0\r\n".into(),
|
||||
},
|
||||
channel_type: "local".into(),
|
||||
voice_server_type: "webrtc".into(),
|
||||
parcel_local_id: Some(42),
|
||||
};
|
||||
let value = serde_json::to_value(request).unwrap();
|
||||
assert_eq!(value["jsep"]["type"], "offer");
|
||||
assert_eq!(value["parcel_local_id"], 42);
|
||||
assert_eq!(value["channel_type"], "local");
|
||||
assert_eq!(value["voice_server_type"], "webrtc");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn completion_uses_singular_candidate_and_close_is_explicit() {
|
||||
let session = UUID::new_with_string("11111111-2222-4333-8444-555555555555".into()).unwrap();
|
||||
let completion = serde_json::to_value(SignalingCompleteRequest {
|
||||
voice_server_type: "webrtc".into(),
|
||||
viewer_session: session.to_string(),
|
||||
candidate: SignalingComplete { completed: true },
|
||||
})
|
||||
.unwrap();
|
||||
assert_eq!(completion["candidate"]["completed"], true);
|
||||
assert!(completion.get("candidates").is_none());
|
||||
|
||||
let close = serde_json::to_value(CloseRequest {
|
||||
logout: true,
|
||||
voice_server_type: "webrtc".into(),
|
||||
viewer_session: session.to_string(),
|
||||
channel: None,
|
||||
credentials: None,
|
||||
})
|
||||
.unwrap();
|
||||
assert_eq!(close["logout"], true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn native_opus_frames_are_nonempty_and_credentials_are_redacted() {
|
||||
let frames = encode_pcm_48k_mono(&vec![0_i16; 1_920]).unwrap();
|
||||
assert_eq!(frames.len(), 2);
|
||||
assert!(frames.iter().all(|frame| !frame.0.is_empty()));
|
||||
assert_eq!(
|
||||
format!("{:?}", VoiceSecret::new("capability-token").unwrap()),
|
||||
"VoiceSecret(<redacted>)"
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user