mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
webdriver: Add handle any user prompts
step for all commands (#38035)
- Add `handler any user prompt` step for all commands. - Enable webdriver tests which were blocked by `handle any user prompt` step. --------- Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
This commit is contained in:
parent
18d1a62add
commit
345733a5c5
66 changed files with 859 additions and 472 deletions
|
@ -21,7 +21,7 @@ use servo::{
|
|||
AllowOrDenyRequest, AuthenticationRequest, FilterPattern, FormControl, GamepadHapticEffectType,
|
||||
KeyboardEvent, LoadStatus, PermissionRequest, Servo, ServoDelegate, ServoError, SimpleDialog,
|
||||
TraversalId, WebDriverCommandMsg, WebDriverJSResult, WebDriverJSValue, WebDriverLoadStatus,
|
||||
WebView, WebViewBuilder, WebViewDelegate,
|
||||
WebDriverUserPrompt, WebView, WebViewBuilder, WebViewDelegate,
|
||||
};
|
||||
use url::Url;
|
||||
|
||||
|
@ -340,13 +340,23 @@ impl RunningAppState {
|
|||
}
|
||||
|
||||
pub(crate) fn webview_has_active_dialog(&self, webview_id: WebViewId) -> bool {
|
||||
let inner = self.inner();
|
||||
inner
|
||||
self.inner()
|
||||
.dialogs
|
||||
.get(&webview_id)
|
||||
.is_some_and(|dialogs| !dialogs.is_empty())
|
||||
}
|
||||
|
||||
pub(crate) fn get_current_active_dialog_webdriver_type(
|
||||
&self,
|
||||
webview_id: WebViewId,
|
||||
) -> Option<WebDriverUserPrompt> {
|
||||
self.inner()
|
||||
.dialogs
|
||||
.get(&webview_id)
|
||||
.and_then(|dialogs| dialogs.last())
|
||||
.map(|dialog| dialog.webdriver_diaglog_type())
|
||||
}
|
||||
|
||||
pub(crate) fn accept_active_dialogs(&self, webview_id: WebViewId) {
|
||||
if let Some(dialogs) = self.inner_mut().dialogs.get_mut(&webview_id) {
|
||||
dialogs.drain(..).for_each(|dialog| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue