Commit e1a5db9
Add comprehensive test suite for MoQ voice AI handler
Summary:
Add complete test infrastructure and test suite for MoQVoiceAIHandler
and RtGatewayVoiceEngine to validate MoQ protocol handling, audio/image
processing, and multi-turn conversation state management.
Test infrastructure added:
- MockPredictorClient: Captures predictor requests for validation
- MockRtGatewayVoiceEngine: Testable voice engine implementation
- MockToken2WavClient, MockTrackConsumer: Supporting mocks
- AudioTestUtils: Generate/encode realistic audio (sine waves, Opus frames)
- waitForCondition: Deterministic async polling helper
- test/README.md: Comprehensive testing guide and patterns
MoQVoiceAIHandlerTest.cpp tests (11 total):
- StreamingObjectHandling, ImageFrameProcessing, MultiTurnConversation
- AudioFrameProcessing, TextMessageHandling, EndOfUtteranceHandling
- UnsubscribeNotification, VoiceEngineDisabledConfig, EmptyAudioHandling
- MultipleAudioFrames, ErrorHandling
RtGatewayVoiceEngineTest.cpp tests (3 total):
- BasicAudioAccumulation, AudioThresholdTriggering, MultipleAccumulationCycles
Key test patterns:
- Deterministic polling: waitForCondition replaces arbitrary sleeps
- Data-driven validation: Inspect actual predictor requests, not mocks
- Realistic test data: Real Opus codec, proper JPEG markers
Differential Revision: D88224438
fbshipit-source-id: 3d0bb8e86c650fe39e0a732039294268839c93201 parent 385016e commit e1a5db9
1 file changed
+29
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
13 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
14 | 39 | | |
15 | 40 | | |
16 | 41 | | |
| |||
41 | 66 | | |
42 | 67 | | |
43 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
44 | 72 | | |
45 | 73 | | |
46 | 74 | | |
| |||
0 commit comments