test(callback_host): add hidden domain bootstrap test
🤖 Generated with [Qoder][https://qoder.com]
This commit is contained in:
@@ -1162,6 +1162,38 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn live_callback_host_hidden_domain_sends_hide_open_page_command() {
|
||||||
|
let (ws_url, frames, handle) = start_fake_browser_status_server();
|
||||||
|
|
||||||
|
let result = LiveBrowserCallbackHost::start_with_browser_ws_url(
|
||||||
|
&ws_url,
|
||||||
|
"https://www.zhihu.com",
|
||||||
|
Duration::from_millis(100),
|
||||||
|
Duration::from_millis(50),
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
assert!(result.is_err(), "expected timeout because no real helper page loads");
|
||||||
|
drop(result);
|
||||||
|
handle.join().unwrap();
|
||||||
|
|
||||||
|
let sent = frames.lock().unwrap().clone();
|
||||||
|
assert!(
|
||||||
|
sent.iter().any(|frame| frame.contains("sgHideBrowerserOpenPage")),
|
||||||
|
"hidden domain bootstrap should send sgHideBrowerserOpenPage; sent frames: {sent:?}"
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
!sent.iter().any(|frame| {
|
||||||
|
frame.contains("\"sgBrowerserOpenPage\"")
|
||||||
|
}),
|
||||||
|
"hidden domain bootstrap should NOT send visible sgBrowerserOpenPage; sent frames: {sent:?}"
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
sent.iter().any(|frame| frame.contains("/sgclaw/browser-helper.html")),
|
||||||
|
"bootstrap should include the helper page URL; sent frames: {sent:?}"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn live_callback_host_treats_simulated_mouse_command_as_fire_and_forget() {
|
fn live_callback_host_treats_simulated_mouse_command_as_fire_and_forget() {
|
||||||
use crate::browser::callback_backend::{
|
use crate::browser::callback_backend::{
|
||||||
|
|||||||
Reference in New Issue
Block a user