Skip to content

Commit

Permalink
fix(bench): update bench tests to latest wry window handle changes (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir authored Apr 15, 2024
1 parent f0e82d3 commit 6d7ce3c
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 6 deletions.
22 changes: 21 additions & 1 deletion bench/tests/src/cpu_intensive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,27 @@ fn main() -> wry::Result<()> {
exit(0);
}
};
let _webview = WebViewBuilder::new(&window)
#[cfg(any(
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "android"
))]
let builder = WebViewBuilder::new(&window);

#[cfg(not(any(
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "android"
)))]
let builder = {
use tao::platform::unix::WindowExtUnix;
use wry::WebViewBuilderExtUnix;
let vbox = window.default_vbox().unwrap();
WebViewBuilder::new_gtk(vbox)
};
let _webview = builder
.with_custom_protocol("wrybench".into(), move |request| {
let path = request.uri().to_string();
let requested_asset_path = path.strip_prefix("wrybench://localhost").unwrap();
Expand Down
22 changes: 21 additions & 1 deletion bench/tests/src/custom_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,27 @@ fn main() -> wry::Result<()> {
exit(0);
}
};
let _webview = WebViewBuilder::new(&window)
#[cfg(any(
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "android"
))]
let builder = WebViewBuilder::new(&window);

#[cfg(not(any(
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "android"
)))]
let builder = {
use tao::platform::unix::WindowExtUnix;
use wry::WebViewBuilderExtUnix;
let vbox = window.default_vbox().unwrap();
WebViewBuilder::new_gtk(vbox)
};
let _webview = builder
.with_ipc_handler(handler)
.with_custom_protocol("wrybench".into(), move |_request| {
Response::builder()
Expand Down
26 changes: 22 additions & 4 deletions bench/tests/src/hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,28 @@ fn main() -> wry::Result<()> {
exit(0);
}
};
let _webview = WebViewBuilder::new(&window)
.with_url(url)
.with_ipc_handler(handler)
.build()?;

#[cfg(any(
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "android"
))]
let builder = WebViewBuilder::new(&window);

#[cfg(not(any(
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "android"
)))]
let builder = {
use tao::platform::unix::WindowExtUnix;
use wry::WebViewBuilderExtUnix;
let vbox = window.default_vbox().unwrap();
WebViewBuilder::new_gtk(vbox)
};
let _webview = builder.with_url(url).with_ipc_handler(handler).build()?;

event_loop.run(move |event, _, control_flow| {
*control_flow = ControlFlow::Wait;
Expand Down

0 comments on commit 6d7ce3c

Please sign in to comment.