@ -212,7 +212,11 @@ AST_TEST_DEFINE(channel_messages)
struct stasis_message * msg ;
struct stasis_message * msg ;
struct stasis_message_type * type ;
struct stasis_message_type * type ;
struct ast_endpoint_snapshot * actual_snapshot ;
struct ast_endpoint_snapshot * actual_snapshot ;
int expected_count ;
int actual_count ;
int actual_count ;
int i ;
int got_channel = 0 ;
int got_endpoint = 0 ;
switch ( cmd ) {
switch ( cmd ) {
case TEST_INIT :
case TEST_INIT :
@ -255,17 +259,22 @@ AST_TEST_DEFINE(channel_messages)
ast_hangup ( chan ) ;
ast_hangup ( chan ) ;
chan = NULL ;
chan = NULL ;
actual_count = stasis_message_sink_wait_for_count ( sink , 3 ,
expected_count = 3 ;
actual_count = stasis_message_sink_wait_for_count ( sink , expected_count ,
STASIS_SINK_DEFAULT_WAIT ) ;
STASIS_SINK_DEFAULT_WAIT ) ;
ast_test_validate ( test , 3 = = actual_count ) ;
ast_test_validate ( test , expected_count = = actual_count ) ;
msg = sink - > messages [ 1 ] ;
for ( i = 0 ; i < expected_count ; i + + ) {
type = stasis_message_type ( msg ) ;
msg = sink - > messages [ i ] ;
ast_test_validate ( test , ast_channel_snapshot_type ( ) = = type ) ;
msg = sink - > messages [ 2 ] ;
type = stasis_message_type ( msg ) ;
type = stasis_message_type ( msg ) ;
ast_test_validate ( test , ast_endpoint_snapshot_type ( ) = = type ) ;
if ( type = = ast_channel_snapshot_type ( ) ) {
got_channel = 1 ;
}
if ( type = = ast_endpoint_snapshot_type ( ) ) {
got_endpoint = 1 ;
}
}
ast_test_validate ( test , got_channel & & got_endpoint ) ;
actual_snapshot = stasis_message_data ( msg ) ;
actual_snapshot = stasis_message_data ( msg ) ;
ast_test_validate ( test , 0 = = actual_snapshot - > num_channels ) ;
ast_test_validate ( test , 0 = = actual_snapshot - > num_channels ) ;