#![cfg(not(cronet_static_link))]
#[test]
#[ignore = "requires CRONET_143_LIBRARY and CRONET_154_LIBRARY"]
fn reject_old_abi_then_load_154() {
let old = std::env::var("CRONET_143_LIBRARY").expect("143 library path");
let new = std::env::var("CRONET_154_LIBRARY").expect("154 library path");
assert!(libcronet_sys::loaded_library_path().is_none());
let error = unsafe { libcronet_sys::load_library(&old) }.expect_err("old dialer ABI");
assert!(
error.to_string().contains("incompatible Cronet 143."),
"{error}"
);
assert!(libcronet_sys::loaded_library_path().is_none());
unsafe {
libcronet_sys::load_library(&new).expect("retry with the 154 library");
let path = std::path::Path::new(&new);
assert_eq!(
libcronet_sys::loaded_library_path(),
Some(path.canonicalize().unwrap().as_path())
);
assert!(libcronet_sys::conflicting_library(path).is_none());
let engine = libcronet_sys::Cronet_Engine_Create();
libcronet_sys::Cronet_Engine_SetUdpDialer(engine, None, std::ptr::null_mut(), None);
libcronet_sys::Cronet_Engine_Destroy(engine);
}
}