@@ -8630,6 +8630,7 @@ pub mod tests {
86308630    } 
86318631
86328632    pub  mod  no_file_io { 
8633+         #![ allow( clippy:: panic) ]  
86338634        use  std:: io:: Cursor ; 
86348635
86358636        #[ cfg( all( target_arch = "wasm32" ,  not( target_os = "wasi" ) ) ) ]  
@@ -8645,35 +8646,57 @@ pub mod tests {
86458646        ) ]  
86468647        #[ cfg_attr( target_os = "wasi" ,  wstd:: test) ]  
86478648        async  fn  test_store_load_fragment_from_stream_async ( )  { 
8648-             // Placeholder data; replace with valid data for a real test 
8649-             let  manifest_data:  Vec < u8 >  = vec ! [ 0x00 ,  0x01 ,  0x02 ,  0x03 ] ; 
8650-             let  fragment_data:  Vec < u8 >  = vec ! [ 0x04 ,  0x05 ,  0x06 ,  0x07 ] ; 
8649+             // Use the dash fixtures that are known to work with fragment loading 
8650+             // These are the same files used in test_bmff_fragments 
8651+             let  init_segment = include_bytes ! ( "../tests/fixtures/dashinit.mp4" ) ; 
8652+             let  fragment = include_bytes ! ( "../tests/fixtures/dash1.m4s" ) ; 
86518653
8652-             let  mut  stream  = Cursor :: new ( manifest_data ) ; 
8653-             let  mut  fragment  = Cursor :: new ( fragment_data ) ; 
8654+             let  mut  init_stream  = Cursor :: new ( init_segment ) ; 
8655+             let  mut  fragment_stream  = Cursor :: new ( fragment ) ; 
86548656
8655-             let  format = "jumbf"  ;   // Replace with a supported format if needed 
8657+             let  format = "mp4"  ; 
86568658            let  mut  validation_log = StatusTracker :: default ( ) ; 
86578659
8660+             // Test the async fragment loading (this is what we're actually testing) 
86588661            let  result = Store :: load_fragment_from_stream_async ( 
86598662                format, 
8660-                 & mut  stream , 
8661-                 & mut  fragment , 
8663+                 & mut  init_stream , 
8664+                 & mut  fragment_stream , 
86628665                & mut  validation_log, 
86638666            ) 
86648667            . await ; 
86658668
8669+             // Same validation as test_fragmented_jumbf_generation - but allow expected certificate trust errors 
86668670            match  result { 
8667-                 Ok ( store)  => { 
8668-                     // If you have valid data, you can check store properties here 
8669-                     assert ! ( store. claims( ) . is_empty( )  || !store. claims( ) . is_empty( ) ) ; 
8671+                 Ok ( _manifest)  => { 
8672+                     // Verify that we successfully loaded a store from the fragment 
8673+                     // The store should contain the manifest data from the fragment 
8674+ 
8675+                     // Check for validation errors, but allow expected certificate trust errors 
8676+                     if  validation_log. has_any_error ( )  { 
8677+                         let  errors:  Vec < _ >  = validation_log. filter_errors ( ) . collect ( ) ; 
8678+                         let  has_unexpected_errors = errors. iter ( ) . any ( |item| { 
8679+                             // Allow certificate trust errors (these are expected for test fixtures) 
8680+                             // Check if the error is a CertificateTrustError 
8681+                             if  let  Some ( err_val)  = & item. err_val  { 
8682+                                 if  err_val. contains ( "CertificateTrustError" )  { 
8683+                                     return  false ;  // This error is expected 
8684+                                 } 
8685+                             } 
8686+ 
8687+                             // Any other errors are unexpected 
8688+                             true 
8689+                         } ) ; 
8690+ 
8691+                         if  has_unexpected_errors { 
8692+                             panic ! ( "Validation log contains unexpected errors: {validation_log:?}" , ) ; 
8693+                         } 
8694+                         // Certificate trust errors are OK for test fixtures 
8695+                     } 
86708696                } 
86718697                Err ( e)  => { 
8672-                     // Accept UnsupportedType for placeholder data 
8673-                     assert ! ( 
8674-                         matches!( e,  Error :: UnsupportedType ) , 
8675-                         "Unexpected error: {e:?}" , 
8676-                     ) ; 
8698+                     // Errors are NOT acceptable - this should work with fragments that contain manifest data 
8699+                     panic ! ( "Failed to load fragment from stream: {e:?}" ) ; 
86778700                } 
86788701            } 
86798702        } 
0 commit comments