Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust
Rust ai-agentsai-toolsbrowserbrowser-automationcloud-browserheadlessheadless-browserkitesurfplaywrightpuppeteerrustservoweb-crawlerweb-crawlingweb-scraperweb-scraping
refactor(automation): name semantic commands and renderer CDP calls
ldm0eb2d679e4468
diff --git a/moli-core/src/lib.rs b/moli-core/src/lib.rsindex 732ce1c39..b73e6175f 100644--- a/moli-core/src/lib.rs+++ b/moli-core/src/lib.rs@@ -21,8 +21,8 @@ pub use moli_page_types::{LayoutPolicy, OptionalResourceFetchMask};pub use moli_renderer_v8::ProcessEnvironmentOwner;pub use moli_renderer_v8::renderer_output_transport_channel;pub use moli_renderer_v8::{- PageId, RendererBrowserContextRuntimeId, RendererDocumentLifecycleIdentity,- RendererDocumentTitleChanged, RendererNativeCommand, RendererNativeCommandReadyResponse,+ PageId, RendererBrowserContextRuntimeId, RendererCdpCall, RendererDocumentLifecycleIdentity,+ RendererDocumentTitleChanged, RendererNativeCommandReadyResponse,RendererNativeCommandResponseGuard, RendererNativeCommandTerminal, RendererNativeOperation,RendererNativeOperationStep, RendererNativeProtocolError, RendererNativeProtocolNotification,RendererNativeProtocolResponse, RendererNativeProtocolStateUpdate, RendererOutputCursor,diff --git a/moli-core/src/page/renderer_command_support.rs b/moli-core/src/page/renderer_command_support.rsindex 7162b76f3..a59c9d9f7 100644--- a/moli-core/src/page/renderer_command_support.rs+++ b/moli-core/src/page/renderer_command_support.rs@@ -1733,7 +1733,7 @@ impl Page {/// Admit a frontend terminal, distinct from an internal renderer query./// The returned guard must live with the adapter continuation until the/// producer has settled; dropping it earlier cancels the publication.- pub fn start_native_frontend_command(+ pub fn start_cdp_call(&self,command_id: u64,frontend_session_id: Option<&str>,@@ -1745,7 +1745,7 @@ impl Page {let attachment = self.renderer_agent_attachment_id.ok_or_else(|| {anyhow::anyhow!("native frontend command requires a renderer attachment")})?;- let (command, guard) = crate::RendererNativeCommand::new(+ let (command, guard) = crate::RendererCdpCall::new(moli_page_types::FrontendCommandId::new(command_id),moli_page_types::DevToolsSessionKey::from_wire_session_id(frontend_session_id),attachment,diff --git a/moli-protocol-server/src/cdp_scheduler.rs b/moli-protocol-server/src/cdp_scheduler.rsindex 1b2542126..a5932898c 100644--- a/moli-protocol-server/src/cdp_scheduler.rs+++ b/moli-protocol-server/src/cdp_scheduler.rs@@ -21,10 +21,8 @@ use moli_protocol::{PageScreencastSubscriptionStatus, ParsedCdpCommand, PendingCdpCommandDispatch,PendingDeferredMainDocumentLoadCompletion, PendingPageScreencastCapture,ProtocolSchedulerWorkKind, RuntimeCommandOutputBarriers,+ automation::{AutomationCommand, AutomationResult, DevToolsError, DevToolsNavigationWait},conn::{RuntimeInspectorResponseReady, RuntimeInspectorResponseReadySender},- devtools_runtime::{- DevToolsCommand, DevToolsCommandResult, DevToolsError, DevToolsNavigationWait,- },};use serde_json::Value;use tokio::sync::mpsc;@@ -87,13 +85,13 @@ pub(crate) enum CommandTaskStep {Complete(Box<CommandTurnOutput>),}-pub(crate) struct DevToolsCommandExecution {- pub(crate) result: Result<DevToolsCommandResult, DevToolsError>,+pub(crate) struct AutomationExecution {+ pub(crate) result: Result<AutomationResult, DevToolsError>,pub(crate) protocol_output: ProtocolOutputSequence,}-pub(crate) struct DevToolsPageCommandExecution {- pub(crate) execution: DevToolsCommandExecution,+pub(crate) struct AutomationPageExecution {+ pub(crate) execution: AutomationExecution,pub(crate) page_residence: Option<DevToolsPageResidenceIdentity>,}@@ -128,7 +126,7 @@ enum DefaultTargetRuntimeInitialization {impl CdpScheduler {pub(crate) fn page_residence_identity_for_devtools_context(&mut self,- context: &moli_protocol::devtools_runtime::DevToolsCommandContext,+ context: &moli_protocol::automation::AutomationContext,) -> Option<DevToolsPageResidenceIdentity> {self.conn.page_residence_identity_for_devtools_context(context)@@ -944,26 +942,26 @@ impl CdpScheduler {self.conn.snapshot_profile_backed_cookies()}- pub(crate) async fn execute_devtools_command_with_protocol_messages(+ pub(crate) async fn execute_automation_command_with_protocol_messages(&mut self,- command: DevToolsCommand,- ) -> DevToolsCommandExecution {- self.execute_devtools_command_with_protocol_messages_inner(None, command, true, None)+ command: AutomationCommand,+ ) -> AutomationExecution {+ self.execute_automation_command_with_protocol_messages_inner(None, command, true, None).await}- async fn execute_devtools_command_with_protocol_messages_inner(+ async fn execute_automation_command_with_protocol_messages_inner(&mut self,receivers: Option<&mut CdpSchedulerEventReceivers>,- command: DevToolsCommand,+ command: AutomationCommand,drain_load_completion: bool,background_command_id: Option<u64>,- ) -> DevToolsCommandExecution {+ ) -> AutomationExecution {let navigation_wait = devtools_navigation_wait(&command);let navigation_context = command.context().clone();let outcome = self.conn- .execute_devtools_command_with_protocol_events_with_background_command_id(+ .execute_automation_command_with_protocol_events_with_background_command_id(command,background_command_id,)@@ -998,7 +996,7 @@ impl CdpScheduler {);} else {result = Err(DevToolsError::new(- moli_protocol::devtools_runtime::DevToolsErrorKind::Internal,+ moli_protocol::automation::DevToolsErrorKind::Internal,"DevTools command produced renderer output without an ingress receiver",));}@@ -1014,7 +1012,7 @@ impl CdpScheduler {.await,);}- DevToolsCommandExecution {+ AutomationExecution {result,protocol_output,}@@ -1105,37 +1103,37 @@ impl CdpScheduler {self.conn.replace_root_target_discovery_enabled(enabled)}- pub(crate) async fn execute_devtools_command_with_external_load_wait(+ pub(crate) async fn execute_automation_command_with_external_load_wait(&mut self,receivers: &mut CdpSchedulerEventReceivers,- command: DevToolsCommand,- ) -> Result<DevToolsCommandResult, DevToolsError> {- self.execute_devtools_command_with_external_load_wait_and_protocol_messages(+ command: AutomationCommand,+ ) -> Result<AutomationResult, DevToolsError> {+ self.execute_automation_command_with_external_load_wait_and_protocol_messages(receivers, command,).await.result}- pub(crate) async fn execute_devtools_command_with_external_load_wait_and_protocol_messages(+ pub(crate) async fn execute_automation_command_with_external_load_wait_and_protocol_messages(&mut self,receivers: &mut CdpSchedulerEventReceivers,- command: DevToolsCommand,- ) -> DevToolsCommandExecution {- self.execute_devtools_command_with_external_load_wait_and_protocol_messages_inner(+ command: AutomationCommand,+ ) -> AutomationExecution {+ self.execute_automation_command_with_external_load_wait_and_protocol_messages_inner(receivers, command, None, None, None,).await.execution}- pub(crate) async fn execute_devtools_command_with_external_load_wait_and_protocol_messages_background_command_id(+ pub(crate) async fn execute_automation_command_with_external_load_wait_and_protocol_messages_background_command_id(&mut self,receivers: &mut CdpSchedulerEventReceivers,- command: DevToolsCommand,+ command: AutomationCommand,background_command_id: Option<u64>,- ) -> DevToolsCommandExecution {- self.execute_devtools_command_with_external_load_wait_and_protocol_messages_inner(+ ) -> AutomationExecution {+ self.execute_automation_command_with_external_load_wait_and_protocol_messages_inner(receivers,command,None,@@ -1146,14 +1144,14 @@ impl CdpScheduler {.execution}- pub(crate) async fn execute_devtools_command_with_external_load_wait_and_page_residence(+ pub(crate) async fn execute_automation_command_with_external_load_wait_and_page_residence(&mut self,receivers: &mut CdpSchedulerEventReceivers,- command: DevToolsCommand,+ command: AutomationCommand,timeout: Option<std::time::Duration>,expected_page: Option<&DevToolsPageResidenceIdentity>,- ) -> DevToolsPageCommandExecution {- self.execute_devtools_command_with_external_load_wait_and_protocol_messages_inner(+ ) -> AutomationPageExecution {+ self.execute_automation_command_with_external_load_wait_and_protocol_messages_inner(receivers,command,timeout,@@ -1163,14 +1161,14 @@ impl CdpScheduler {.await}- async fn execute_devtools_command_with_external_load_wait_and_protocol_messages_inner(+ async fn execute_automation_command_with_external_load_wait_and_protocol_messages_inner(&mut self,receivers: &mut CdpSchedulerEventReceivers,- command: DevToolsCommand,+ command: AutomationCommand,timeout: Option<std::time::Duration>,background_command_id: Option<u64>,expected_page: Option<&DevToolsPageResidenceIdentity>,- ) -> DevToolsPageCommandExecution {+ ) -> AutomationPageExecution {let navigation_wait = devtools_navigation_wait(&command);let navigation_lifecycle_milestone =devtools_navigation_lifecycle_milestone(navigation_wait);@@ -1191,8 +1189,8 @@ impl CdpScheduler {Ok(output) => output,Err(failure) => {let (protocol_output, error) = failure.into_parts();- return DevToolsPageCommandExecution {- execution: DevToolsCommandExecution {+ return AutomationPageExecution {+ execution: AutomationExecution {result: Err(error),protocol_output,},@@ -1206,10 +1204,10 @@ impl CdpScheduler {// dispatched to the replacement Page.let page_residence = self.page_residence_identity_for_devtools_context(&navigation_context);if expected_page.is_some_and(|expected| page_residence.as_ref() != Some(expected)) {- return DevToolsPageCommandExecution {- execution: DevToolsCommandExecution {+ return AutomationPageExecution {+ execution: AutomationExecution {result: Err(DevToolsError::new(- moli_protocol::devtools_runtime::DevToolsErrorKind::NoSuchNode,+ moli_protocol::automation::DevToolsErrorKind::NoSuchNode,"DOM reference belongs to a replaced Page",)),protocol_output,@@ -1219,7 +1217,7 @@ impl CdpScheduler {}let navigation_command_output_start = protocol_output.len();let mut execution =- if runtime_dispatch::devtools_command_uses_interleaved_runtime_dispatch(&command) {+ if runtime_dispatch::automation_command_uses_interleaved_runtime_dispatch(&command) {match timeout {Some(timeout) => {self.execute_devtools_runtime_command_with_interleaved_progress_timeout(@@ -1239,7 +1237,7 @@ impl CdpScheduler {Some(timeout) => {match tokio::time::timeout(timeout,- self.execute_devtools_command_with_protocol_messages_inner(+ self.execute_automation_command_with_protocol_messages_inner(Some(&mut *receivers),command,false,@@ -1249,9 +1247,9 @@ impl CdpScheduler {.await{Ok(execution) => execution,- Err(_) => DevToolsCommandExecution {+ Err(_) => AutomationExecution {result: Err(DevToolsError::new(- moli_protocol::devtools_runtime::DevToolsErrorKind::Timeout,+ moli_protocol::automation::DevToolsErrorKind::Timeout,"script timed out",)),protocol_output: ProtocolOutputSequence::empty(),@@ -1259,7 +1257,7 @@ impl CdpScheduler {}}None => {- self.execute_devtools_command_with_protocol_messages_inner(+ self.execute_automation_command_with_protocol_messages_inner(Some(&mut *receivers),command,false,@@ -1402,7 +1400,7 @@ impl CdpScheduler {.devtools_context_routes_to_top_level_target(&navigation_context){execution.result = Err(DevToolsError::new(- moli_protocol::devtools_runtime::DevToolsErrorKind::NoSuchTarget,+ moli_protocol::automation::DevToolsErrorKind::NoSuchTarget,"Target closed before navigation load",));}@@ -1415,7 +1413,7 @@ impl CdpScheduler {execution.protocol_output.append(foreground_navigation_network_barrier.finish());- DevToolsPageCommandExecution {+ AutomationPageExecution {execution,page_residence,}@@ -1424,7 +1422,7 @@ impl CdpScheduler {async fn drain_inflight_background_navigation_before_internal_command(&mut self,receivers: &mut CdpSchedulerEventReceivers,- context: &moli_protocol::devtools_runtime::DevToolsCommandContext,+ context: &moli_protocol::automation::AutomationContext,) -> Result<ProtocolOutputSequence, RendererOutputTransportFailure> {let mut out = ProtocolOutputSequence::empty();while self@@ -1451,7 +1449,7 @@ impl CdpScheduler {async fn wait_for_document_lifecycle_observer(&mut self,receivers: &mut CdpSchedulerEventReceivers,- context: &moli_protocol::devtools_runtime::DevToolsCommandContext,+ context: &moli_protocol::automation::AutomationContext,key: &moli_protocol::DevToolsDocumentLifecycleWaitKey,) -> Result<ProtocolOutputSequence, RendererOutputTransportFailure> {let mut out = ProtocolOutputSequence::empty();@@ -1487,11 +1485,11 @@ impl CdpScheduler {pub(crate) async fn wait_for_devtools_context_document_lifecycle(&mut self,receivers: &mut CdpSchedulerEventReceivers,- context: &moli_protocol::devtools_runtime::DevToolsCommandContext,+ context: &moli_protocol::automation::AutomationContext,milestone: RendererDocumentLifecycleMilestone,timeout: Option<std::time::Duration>,- ) -> DevToolsCommandExecution {- use moli_protocol::devtools_runtime::DevToolsErrorKind;+ ) -> AutomationExecution {+ use moli_protocol::automation::DevToolsErrorKind;use moli_protocol::{DevToolsDocumentLifecycleWaitState, DevToolsDocumentNavigationState};let started = Instant::now();@@ -1503,7 +1501,7 @@ impl CdpScheduler {.devtools_context_document_navigation_state(context);let loader_id = match navigation_state.clone() {DevToolsDocumentNavigationState::Unavailable => {- return DevToolsCommandExecution {+ return AutomationExecution {result: Err(DevToolsError::new(DevToolsErrorKind::NoSuchTarget,"Target closed while waiting for document navigation",@@ -1536,7 +1534,7 @@ impl CdpScheduler {Err(failure) => {let (progress, error) = failure.into_parts();protocol_output.append(progress);- return DevToolsCommandExecution {+ return AutomationExecution {result: Err(error),protocol_output,};@@ -1580,7 +1578,7 @@ impl CdpScheduler {Err(failure) => {let (progress, error) = failure.into_parts();protocol_output.append(progress);- return DevToolsCommandExecution {+ return AutomationExecution {result: Err(error),protocol_output,};@@ -1597,8 +1595,8 @@ impl CdpScheduler {DevToolsDocumentLifecycleWaitState::Reached => {self.conn.release_devtools_document_lifecycle_wait_key(context, &key);- return DevToolsCommandExecution {- result: Ok(DevToolsCommandResult::Empty),+ return AutomationExecution {+ result: Ok(AutomationResult::Empty),protocol_output,};}@@ -1611,7 +1609,7 @@ impl CdpScheduler {| DevToolsDocumentLifecycleWaitState::Unavailable => {self.conn.release_devtools_document_lifecycle_wait_key(context, &key);- return DevToolsCommandExecution {+ return AutomationExecution {result: Err(devtools_document_lifecycle_wait_error(wait_state, milestone,)@@ -1647,7 +1645,7 @@ impl CdpScheduler {protocol_output.append(progress);self.conn.release_devtools_document_lifecycle_wait_key(context, &key);- return DevToolsCommandExecution {+ return AutomationExecution {result: Err(error),protocol_output,};@@ -1663,7 +1661,7 @@ impl CdpScheduler {started: Instant,timeout: Option<std::time::Duration>,) -> Result<ProtocolOutputSequence, RendererOutputTransportFailure> {- use moli_protocol::devtools_runtime::DevToolsErrorKind;+ use moli_protocol::automation::DevToolsErrorKind;let input = match timeout {Some(timeout) => {@@ -1698,7 +1696,7 @@ impl CdpScheduler {async fn drain_deferred_main_document_load_completion_for_wait(&mut self,- context: &moli_protocol::devtools_runtime::DevToolsCommandContext,+ context: &moli_protocol::automation::AutomationContext,) -> ProtocolOutputSequence {let mut out = ProtocolOutputSequence::empty();loop {@@ -1740,7 +1738,7 @@ impl CdpScheduler {async fn drain_deferred_main_document_load_completion_until_complete(&mut self,receivers: &mut CdpSchedulerEventReceivers,- context: &moli_protocol::devtools_runtime::DevToolsCommandContext,+ context: &moli_protocol::automation::AutomationContext,) -> Result<ProtocolOutputSequence, RendererOutputTransportFailure> {let mut out = ProtocolOutputSequence::empty();loop {@@ -2023,7 +2021,7 @@ impl CdpScheduler {fn front_protocol_residence_is_main_document_load_action_for_context(&self,- context: &moli_protocol::devtools_runtime::DevToolsCommandContext,+ context: &moli_protocol::automation::AutomationContext,) -> bool {matches!(self.queues.protocol_residences.front(),@@ -2035,7 +2033,7 @@ impl CdpScheduler {fn has_deferred_main_document_load_completion_for_devtools_context(&self,- context: &moli_protocol::devtools_runtime::DevToolsCommandContext,+ context: &moli_protocol::automation::AutomationContext,) -> bool {self.queues.protocol_residences.iter().any(|residence| {matches!(@@ -2875,16 +2873,16 @@ fn renderer_output_transport_terminal_error("closed"};DevToolsError::new(- moli_protocol::devtools_runtime::DevToolsErrorKind::Internal,+ moli_protocol::automation::DevToolsErrorKind::Internal,format!("Renderer output transport {reason} before {boundary}"),)}-fn devtools_navigation_wait(command: &DevToolsCommand) -> Option<DevToolsNavigationWait> {+fn devtools_navigation_wait(command: &AutomationCommand) -> Option<DevToolsNavigationWait> {match command {- DevToolsCommand::Navigate(command) => Some(command.wait),- DevToolsCommand::Reload(command) => Some(command.wait),- DevToolsCommand::TraverseHistory(command) => Some(command.wait),+ AutomationCommand::Navigate(command) => Some(command.wait),+ AutomationCommand::Reload(command) => Some(command.wait),+ AutomationCommand::TraverseHistory(command) => Some(command.wait),_ => None,}}@@ -2902,9 +2900,9 @@ fn devtools_navigation_lifecycle_milestone(}fn devtools_navigation_result_loader_id(- result: &Result<DevToolsCommandResult, DevToolsError>,+ result: &Result<AutomationResult, DevToolsError>,) -> Option<String> {- let Ok(DevToolsCommandResult::Navigate(result)) = result else {+ let Ok(AutomationResult::Navigate(result)) = result else {return None;};result@@ -2925,7 +2923,7 @@ fn devtools_document_lifecycle_wait_error(milestone: RendererDocumentLifecycleMilestone,) -> Option<DevToolsError> {use moli_protocol::DevToolsDocumentLifecycleWaitState;- use moli_protocol::devtools_runtime::DevToolsErrorKind;+ use moli_protocol::automation::DevToolsErrorKind;let milestone_name = match milestone {RendererDocumentLifecycleMilestone::DomContentLoaded => "DOMContentLoaded",diff --git a/moli-protocol-server/src/cdp_scheduler/runtime_dispatch.rs b/moli-protocol-server/src/cdp_scheduler/runtime_dispatch.rsindex fa078314e..1b57a0ed4 100644--- a/moli-protocol-server/src/cdp_scheduler/runtime_dispatch.rs+++ b/moli-protocol-server/src/cdp_scheduler/runtime_dispatch.rs@@ -3,11 +3,11 @@ use std::{future, time::Duration};use moli_protocol::{CompletedDevToolsRuntimeCommandDispatch, DevToolsRuntimeCommandTaskStep,PendingDevToolsRuntimeCommandDispatch,+ automation::{AutomationCommand, DevToolsError, DevToolsErrorKind},conn::{BackgroundProtocolEvent, RuntimeInspectorAsyncCompletionReceiver,RuntimeInspectorResponseReady,},- devtools_runtime::{DevToolsCommand, DevToolsError, DevToolsErrorKind},};use tokio::{sync::mpsc,@@ -16,8 +16,8 @@ use tokio::{};use super::{- CdpScheduler, CdpSchedulerEventReceivers, CdpSchedulerInterleavedInput,- DevToolsCommandExecution, ProtocolOutputSequence, RendererOutputTransportFailure,+ AutomationExecution, CdpScheduler, CdpSchedulerEventReceivers, CdpSchedulerInterleavedInput,+ ProtocolOutputSequence, RendererOutputTransportFailure,};pub(crate) struct PendingDevToolsRuntimeDeferredReplyExecution {@@ -27,24 +27,24 @@ pub(crate) struct PendingDevToolsRuntimeDeferredReplyExecution {}pub(crate) enum DevToolsRuntimeCommandProgress {- Complete(Box<DevToolsCommandExecution>),+ Complete(Box<AutomationExecution>),PendingDeferredReply {pending: Box<PendingDevToolsRuntimeDeferredReplyExecution>,protocol_output: ProtocolOutputSequence,},}-pub(super) fn devtools_command_uses_interleaved_runtime_dispatch(- command: &DevToolsCommand,+pub(super) fn automation_command_uses_interleaved_runtime_dispatch(+ command: &AutomationCommand,) -> bool {matches!(command,- DevToolsCommand::GetRealms(_)- | DevToolsCommand::EvaluateScript(_)- | DevToolsCommand::CallFunction(_)- | DevToolsCommand::TerminateExecution(_)- | DevToolsCommand::LocateNodes(_)- | DevToolsCommand::ReleaseObjects(_)+ AutomationCommand::GetRealms(_)+ | AutomationCommand::EvaluateScript(_)+ | AutomationCommand::CallFunction(_)+ | AutomationCommand::TerminateExecution(_)+ | AutomationCommand::LocateNodes(_)+ | AutomationCommand::ReleaseObjects(_))}@@ -62,8 +62,8 @@ impl CdpScheduler {pub(super) async fn execute_devtools_runtime_command_with_interleaved_progress(&mut self,receivers: &mut CdpSchedulerEventReceivers,- command: DevToolsCommand,- ) -> DevToolsCommandExecution {+ command: AutomationCommand,+ ) -> AutomationExecution {self.execute_devtools_runtime_command_with_interleaved_progress_until(receivers, command, None,)@@ -73,9 +73,9 @@ impl CdpScheduler {pub(crate) async fn execute_devtools_runtime_command_with_interleaved_progress_timeout(&mut self,receivers: &mut CdpSchedulerEventReceivers,- command: DevToolsCommand,+ command: AutomationCommand,timeout: Duration,- ) -> DevToolsCommandExecution {+ ) -> AutomationExecution {self.execute_devtools_runtime_command_with_interleaved_progress_until(receivers,command,@@ -87,9 +87,9 @@ impl CdpScheduler {async fn execute_devtools_runtime_command_with_interleaved_progress_until(&mut self,receivers: &mut CdpSchedulerEventReceivers,- command: DevToolsCommand,+ command: AutomationCommand,deadline: Option<TokioInstant>,- ) -> DevToolsCommandExecution {+ ) -> AutomationExecution {let mut protocol_output = ProtocolOutputSequence::empty();let mut step = self.conn@@ -112,7 +112,7 @@ impl CdpScheduler {Err(failure) => {let (output, error) = failure.into_parts();protocol_output.append(output);- return DevToolsCommandExecution {+ return AutomationExecution {result: Err(error),protocol_output,};@@ -123,7 +123,7 @@ impl CdpScheduler {protocol_events,));self.apply_scheduler_events(scheduler_events);- return DevToolsCommandExecution {+ return AutomationExecution {result,protocol_output,};@@ -142,7 +142,7 @@ impl CdpScheduler {{Ok(Some(completed)) => completed,Ok(None) => {- return DevToolsCommandExecution {+ return AutomationExecution {result: Err(DevToolsError::new(DevToolsErrorKind::Internal,"SchedulerInputClosed",@@ -151,7 +151,7 @@ impl CdpScheduler {};}Err(error) => {- return DevToolsCommandExecution {+ return AutomationExecution {result: Err(error),protocol_output,};@@ -170,7 +170,7 @@ impl CdpScheduler {&mut self,receivers: &mut CdpSchedulerEventReceivers,runtime_response_ready_tx: &mpsc::UnboundedSender<RuntimeInspectorResponseReady>,- command: DevToolsCommand,+ command: AutomationCommand,) -> DevToolsRuntimeCommandProgress {let protocol_output = ProtocolOutputSequence::empty();let step = self@@ -258,7 +258,7 @@ impl CdpScheduler {let (output, error) = failure.into_parts();protocol_output.append(output);return DevToolsRuntimeCommandProgress::Complete(Box::new(- DevToolsCommandExecution {+ AutomationExecution {result: Err(error),protocol_output,},@@ -271,7 +271,7 @@ impl CdpScheduler {));self.apply_scheduler_events(scheduler_events);return DevToolsRuntimeCommandProgress::Complete(Box::new(- DevToolsCommandExecution {+ AutomationExecution {result,protocol_output,},@@ -333,7 +333,7 @@ impl CdpScheduler {Ok(Some(completed)) => completed,Ok(None) => {return DevToolsRuntimeCommandProgress::Complete(Box::new(- DevToolsCommandExecution {+ AutomationExecution {result: Err(DevToolsError::new(DevToolsErrorKind::Internal,"SchedulerInputClosed",@@ -344,7 +344,7 @@ impl CdpScheduler {}Err(error) => {return DevToolsRuntimeCommandProgress::Complete(Box::new(- DevToolsCommandExecution {+ AutomationExecution {result: Err(error),protocol_output,},@@ -630,7 +630,7 @@ fn complete_devtools_runtime_deferred_reply_with_loose_response_error(protocol_output: ProtocolOutputSequence,) -> DevToolsRuntimeCommandProgress {drop(pending);- DevToolsRuntimeCommandProgress::Complete(Box::new(DevToolsCommandExecution {+ DevToolsRuntimeCommandProgress::Complete(Box::new(AutomationExecution {result: Err(DevToolsError::new(DevToolsErrorKind::Internal,"RuntimeDeferredReplyLooseProtocolResponse",@@ -693,7 +693,7 @@ fn runtime_command_timeout_error() -> DevToolsError {mod tests {use moli_protocol::{BackgroundProtocolEvent,- devtools_runtime::{AutomationEvent, DevToolsFrameId, PageFileChooserOpenedEvent},+ automation::{AutomationEvent, DevToolsFrameId, PageFileChooserOpenedEvent},};use serde_json::json;diff --git a/moli-protocol-server/src/cdp_scheduler/tests.rs b/moli-protocol-server/src/cdp_scheduler/tests.rsindex bd8ed3dc0..ccebb9674 100644--- a/moli-protocol-server/src/cdp_scheduler/tests.rs+++ b/moli-protocol-server/src/cdp_scheduler/tests.rs@@ -15,14 +15,14 @@ use moli_protocol::{DeferredMainDocumentLoadCompletionOutputAction,DeferredMainDocumentLoadCompletionOutputInterest, DeferredMainDocumentLoadPredecessorCandidate,ProtocolSchedulerWork,- conn::RuntimeInspectorResponseReady,- devtools_runtime::{- AutomationEvent, BrowserDownloadWillBeginEvent, DevToolsCommand, DevToolsCommandContext,- DevToolsCommandResult, DevToolsCreateTargetCommand, DevToolsFrameId, DevToolsLoaderId,- DevToolsNavigationWait, DevToolsNetworkResourceType, DevToolsProtocol, DevToolsRequestId,- DevToolsSessionId, DevToolsTargetId, NavigationFrameEvent, NavigationFrameEventKind,- NetworkRequestEvent,+ automation::{+ AutomationCommand, AutomationContext, AutomationEvent, AutomationResult,+ BrowserDownloadWillBeginEvent, DevToolsCreateTargetCommand, DevToolsFrameId,+ DevToolsLoaderId, DevToolsNavigationWait, DevToolsNetworkResourceType, DevToolsRequestId,+ DevToolsSessionId, DevToolsTargetId, FrontendProtocol, NavigationFrameEvent,+ NavigationFrameEventKind, NetworkRequestEvent,},+ conn::RuntimeInspectorResponseReady,test_support::{arm_background_navigation_request, arm_background_navigation_request_for_target,deferred_main_document_load_observation_id, deferred_main_document_load_output_interest,@@ -1031,7 +1031,7 @@ async fn closed_renderer_transport_fails_an_unprojected_command_fence() {assert!(output.is_empty());assert_eq!(error.kind,- moli_protocol::devtools_runtime::DevToolsErrorKind::Internal+ moli_protocol::automation::DevToolsErrorKind::Internal);assert!(error.message.contains("closed"));}@@ -1389,14 +1389,14 @@ fn scheduler_defers_subresource_network_events_until_background_navigation_gate_async fn target_a_navigation_does_not_defer_target_b_network_events() {let mut conn = CdpConnection::new();conn.install_default_browser_target();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-test")),target_id: None,browser_context_id: None,};- let create_target = |context: DevToolsCommandContext| {- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ let create_target = |context: AutomationContext| {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context,url: "about:blank".to_owned(),browser_context_id: None,@@ -1404,18 +1404,20 @@ async fn target_a_navigation_does_not_defer_target_b_network_events() {})};let first_create = conn- .execute_devtools_command(create_target(context.clone()))+ .execute_automation_command(create_target(context.clone())).await;let (first_result, _) = first_create.into_parts();- let DevToolsCommandResult::CreateTarget(first_result) =+ let AutomationResult::CreateTarget(first_result) =first_result.expect("first target should be created")else {panic!("expected create-target result")};let first_target_id = first_result.target_id.into_string();- let second_create = conn.execute_devtools_command(create_target(context)).await;+ let second_create = conn+ .execute_automation_command(create_target(context))+ .await;let (second_result, _) = second_create.into_parts();- let DevToolsCommandResult::CreateTarget(second_result) =+ let AutomationResult::CreateTarget(second_result) =second_result.expect("second target should be created")else {panic!("expected create-target result")diff --git a/moli-protocol-server/src/protocol_server/tests/bidi/extracted/sessions_and_subscriptions.rs b/moli-protocol-server/src/protocol_server/tests/bidi/extracted/sessions_and_subscriptions.rsindex 98eb8a069..704f8452f 100644--- a/moli-protocol-server/src/protocol_server/tests/bidi/extracted/sessions_and_subscriptions.rs+++ b/moli-protocol-server/src/protocol_server/tests/bidi/extracted/sessions_and_subscriptions.rs@@ -2569,7 +2569,7 @@ async fn websocket_bidi_session_unsubscribe_browsing_context_module_stops_navigaprotocol_server.abort();}#[tokio::test]-async fn websocket_bidi_bound_devtools_command_executes_target_commands() {+async fn websocket_bidi_bound_automation_command_executes_target_commands() {let (cdp_addr, protocol_server) = spawn_test_protocol_server().await;let (mut socket, _) = connect_async(format!("ws://{cdp_addr}/session")).awaitdiff --git a/moli-protocol-server/src/protocol_server/webdriver_bidi.rs b/moli-protocol-server/src/protocol_server/webdriver_bidi.rsindex eb7179e52..cf35b0c90 100644--- a/moli-protocol-server/src/protocol_server/webdriver_bidi.rs+++ b/moli-protocol-server/src/protocol_server/webdriver_bidi.rs@@ -17,18 +17,18 @@ use moli_cookie_jar::StoredCookie;use moli_core::{RendererOutputTransportMessage, runtime::NavigationRuntimeConfig};use moli_protocol::{BackgroundCommandResponsePayload, BackgroundProtocolEvent, CdpInitialStoragePartition,- conn::RuntimeInspectorResponseReady,- devtools_runtime::{- AutomationEvent, DevToolsCommand, DevToolsCommandContext, DevToolsCommandResult,+ automation::{+ AutomationCommand, AutomationContext, AutomationEvent, AutomationResult,DevToolsDomObjectReferenceCommand, DevToolsDomObjectReferenceOperation, DevToolsError,DevToolsErrorKind, DevToolsFrameId, DevToolsGetBrowserContextsCommand,DevToolsGetFrameTreesCommand, DevToolsGetLayoutMetricsCommand, DevToolsGetRealmsCommand,- DevToolsGetTargetInfoCommand, DevToolsNavigationWait, DevToolsProtocol,- DevToolsRemoteHandleId, DevToolsSessionId, DevToolsSetFileInputFilesCommand,- DevToolsTargetId, DevToolsTargetInfo, DevToolsTargetKind, NavigationFrameEvent,- NavigationFrameEventKind, NavigationLifecycleEvent, TargetLifecycleEvent,+ DevToolsGetTargetInfoCommand, DevToolsNavigationWait, DevToolsRemoteHandleId,+ DevToolsSessionId, DevToolsSetFileInputFilesCommand, DevToolsTargetId, DevToolsTargetInfo,+ DevToolsTargetKind, FrontendProtocol, NavigationFrameEvent, NavigationFrameEventKind,+ NavigationLifecycleEvent, TargetLifecycleEvent,webdriver_bidi_navigation_id_from_loader_id,},+ conn::RuntimeInspectorResponseReady,};use moli_protocol_webdriver_bidi::{BidiCommandOutcome, BidiConnectionState, BidiDevToolsCommandDispatch, BidiErrorCode,@@ -656,7 +656,7 @@ async fn handle_bidi_socket_message(session_id: bidi.session_id().map(ToOwned::to_owned),channel: None,close_connection: false,- devtools_command: None,+ automation_command: None,input_command: None,};(outcome, command_method, command_params, None, None)@@ -688,7 +688,7 @@ async fn handle_bidi_socket_message(session_id: bidi.session_id().map(ToOwned::to_owned),channel: command_channel.clone(),close_connection: false,- devtools_command: None,+ automation_command: None,input_command: None,}}@@ -717,7 +717,7 @@ async fn handle_bidi_socket_message(session_id: bidi.session_id().map(ToOwned::to_owned),channel: None,close_connection: false,- devtools_command: None,+ automation_command: None,input_command: None,},None,@@ -730,15 +730,15 @@ async fn handle_bidi_socket_message(response,channel: command_channel,close_connection,- devtools_command,+ automation_command,input_command,..} = outcome;- let pending_navigation_candidate = devtools_command.as_ref().and_then(|dispatch| {+ let pending_navigation_candidate = automation_command.as_ref().and_then(|dispatch| {pending_navigation_response_for_dispatch(dispatch, command_channel.as_deref())});let command_start = if pending_runtime_command.is_some()- && (devtools_command.is_some() || input_command.is_some())+ && (automation_command.is_some() || input_command.is_some()){BidiDevToolsCommandStart::Complete(BidiDevToolsCommandOutput {response: error_response(@@ -752,12 +752,12 @@ async fn handle_bidi_socket_message(event_context: None,})} else {- match (devtools_command, input_command) {+ match (automation_command, input_command) {(Some(dispatch), None) => {let observe_context_created = bidi.subscribed_contexts_for_bidi_event("browsingContext.contextCreated").is_some();- start_bidi_devtools_command(+ start_bidi_automation_command(scheduler,receivers,runtime_response_ready_tx,@@ -840,7 +840,7 @@ async fn handle_bidi_socket_message();let defer_current_response = pending_navigation_candidate.is_some()&& pending_navigation_response.is_none()- && bidi_response_is_missing_devtools_command_result(&command_output.response)+ && bidi_response_is_missing_automation_command_result(&command_output.response)&& sources_include_auth_required_pause(&command_output.event_sources);if defer_current_response {*pending_navigation_response = pending_navigation_candidate;@@ -1009,7 +1009,7 @@ async fn complete_and_send_bidi_pending_runtime_command(bidi: &mut BidiConnectionState,pending_navigation_response: &mut Option<BidiPendingNavigationResponse>,pending: BidiPendingRuntimeCommand,- execution: crate::cdp_scheduler::DevToolsCommandExecution,+ execution: crate::cdp_scheduler::AutomationExecution,) -> bool {let BidiPendingRuntimeCommand {command_method,@@ -1020,7 +1020,8 @@ async fn complete_and_send_bidi_pending_runtime_command(completion,} = pending;let mut command_output =- complete_bidi_devtools_command_execution(scheduler, receivers, completion, execution).await;+ complete_bidi_automation_command_execution(scheduler, receivers, completion, execution)+ .await;let renderer_output_transport_terminal = receivers.renderer_publication_rx.is_closed();command_output.response =bidi_message_with_channel(command_output.response, command_channel.as_deref());@@ -1031,7 +1032,7 @@ async fn complete_and_send_bidi_pending_runtime_command();let defer_current_response = pending_navigation_candidate.is_some()&& pending_navigation_response.is_none()- && bidi_response_is_missing_devtools_command_result(&command_output.response)+ && bidi_response_is_missing_automation_command_result(&command_output.response)&& sources_include_auth_required_pause(&command_output.event_sources);if defer_current_response {*pending_navigation_response = pending_navigation_candidate;@@ -1496,8 +1497,7 @@ struct BidiDevToolsCommandCompletion {event_sources: BidiDevToolsEventSources,event_context: Option<String>,close_target_event: Option<TargetLifecycleEvent>,- create_target_browser_context_id:- Option<moli_protocol::devtools_runtime::DevToolsBrowserContextId>,+ create_target_browser_context_id: Option<moli_protocol::automation::DevToolsBrowserContextId>,observe_browsing_context_load: bool,script_may_create_targets: bool,previous_target_discovery: Option<bool>,@@ -1658,7 +1658,7 @@ fn pending_navigation_response_for_dispatch(dispatch: &BidiDevToolsCommandDispatch,channel: Option<&str>,) -> Option<BidiPendingNavigationResponse> {- let DevToolsCommand::Navigate(command) = &dispatch.command else {+ let AutomationCommand::Navigate(command) = &dispatch.command else {return None;};if command.wait == DevToolsNavigationWait::None {@@ -1672,7 +1672,7 @@ fn pending_navigation_response_for_dispatch(})}-fn bidi_response_is_missing_devtools_command_result(response: &serde_json::Value) -> bool {+fn bidi_response_is_missing_automation_command_result(response: &serde_json::Value) -> bool {response["type"] == json!("error")&& response["message"].as_str() == Some("MissingDevToolsCommandResult")}@@ -2042,9 +2042,9 @@ async fn replay_existing_bidi_realm_created_events_for_context(session_id: &str,context_id: Option<String>,) -> Vec<serde_json::Value> {- let command = DevToolsCommand::GetRealms(DevToolsGetRealmsCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let command = AutomationCommand::GetRealms(DevToolsGetRealmsCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from(session_id)),target_id: context_id.as_deref().map(DevToolsTargetId::from),browser_context_id: None,@@ -2052,9 +2052,9 @@ async fn replay_existing_bidi_realm_created_events_for_context(realm_type: None,});let execution = scheduler- .execute_devtools_command_with_protocol_messages(command)+ .execute_automation_command_with_protocol_messages(command).await;- let Ok(DevToolsCommandResult::Realms(result)) = execution.result else {+ let Ok(AutomationResult::Realms(result)) = execution.result else {return Vec::new();};result@@ -2064,7 +2064,7 @@ async fn replay_existing_bidi_realm_created_events_for_context(.collect()}-async fn start_bidi_devtools_command(+async fn start_bidi_automation_command(scheduler: &mut CdpScheduler,receivers: &mut CdpSchedulerEventReceivers,runtime_response_ready_tx: &mpsc::UnboundedSender<RuntimeInspectorResponseReady>,@@ -2079,14 +2079,14 @@ async fn start_bidi_devtools_command(.set_webdriver_bidi_file_prompt_handler_for_script_command(bidi.file_prompt_handler_for_script_commands(),);- let event_context = bidi_event_context_from_devtools_command(&dispatch.command);+ let event_context = bidi_event_context_from_automation_command(&dispatch.command);let close_target_id = match &dispatch.command {- DevToolsCommand::CloseTarget(command) => Some(command.target_id.as_str().to_owned()),+ AutomationCommand::CloseTarget(command) => Some(command.target_id.as_str().to_owned()),_ => None,};let script_may_create_targets = matches!(&dispatch.command,- DevToolsCommand::EvaluateScript(_) | DevToolsCommand::CallFunction(_)+ AutomationCommand::EvaluateScript(_) | AutomationCommand::CallFunction(_));let mut event_sources =match drain_bidi_background_navigation_before_command(scheduler, receivers).await {@@ -2128,7 +2128,7 @@ async fn start_bidi_devtools_command(&& script_may_create_targets).then(|| scheduler.replace_target_discovery_enabled(true));let create_target_browser_context_id = match &dispatch.command {- DevToolsCommand::CreateTarget(command) => command.browser_context_id.clone(),+ AutomationCommand::CreateTarget(command) => command.browser_context_id.clone(),_ => None,};let completion = BidiDevToolsCommandCompletion {@@ -2142,7 +2142,7 @@ async fn start_bidi_devtools_command(script_may_create_targets,previous_target_discovery,};- if bidi_devtools_command_uses_deferred_runtime_progress(&dispatch.command) {+ if bidi_automation_command_uses_deferred_runtime_progress(&dispatch.command) {return match scheduler.start_devtools_runtime_command_with_deferred_reply_progress(receivers,@@ -2153,7 +2153,7 @@ async fn start_bidi_devtools_command({DevToolsRuntimeCommandProgress::Complete(execution) => {BidiDevToolsCommandStart::Complete(- complete_bidi_devtools_command_execution(+ complete_bidi_automation_command_execution(scheduler, receivers, completion, *execution,).await,@@ -2179,22 +2179,23 @@ async fn start_bidi_devtools_command(};}let execution = scheduler- .execute_devtools_command_with_external_load_wait_and_protocol_messages_background_command_id(+ .execute_automation_command_with_external_load_wait_and_protocol_messages_background_command_id(receivers,dispatch.command,background_command_id,).await;BidiDevToolsCommandStart::Complete(- complete_bidi_devtools_command_execution(scheduler, receivers, completion, execution).await,+ complete_bidi_automation_command_execution(scheduler, receivers, completion, execution)+ .await,)}-async fn complete_bidi_devtools_command_execution(+async fn complete_bidi_automation_command_execution(scheduler: &mut CdpScheduler,receivers: &mut CdpSchedulerEventReceivers,completion: BidiDevToolsCommandCompletion,- execution: crate::cdp_scheduler::DevToolsCommandExecution,+ execution: crate::cdp_scheduler::AutomationExecution,) -> BidiDevToolsCommandOutput {let BidiDevToolsCommandCompletion {id,@@ -2223,12 +2224,10 @@ async fn complete_bidi_devtools_command_execution(}}let created_target_id = match &execution.result {- Ok(DevToolsCommandResult::CreateTarget(result)) => {- Some(result.target_id.as_str().to_owned())- }+ Ok(AutomationResult::CreateTarget(result)) => Some(result.target_id.as_str().to_owned()),_ => None,};- let close_succeeded = matches!(&execution.result, Ok(DevToolsCommandResult::CloseTarget(_)));+ let close_succeeded = matches!(&execution.result, Ok(AutomationResult::CloseTarget(_)));if let Some(target_id) = created_target_id.as_deref() {let mut event =match bidi_target_lifecycle_event_for_target(scheduler, &session_id, target_id).await {@@ -2295,14 +2294,14 @@ async fn complete_bidi_devtools_command_execution(}}-fn bidi_devtools_command_uses_deferred_runtime_progress(command: &DevToolsCommand) -> bool {+fn bidi_automation_command_uses_deferred_runtime_progress(command: &AutomationCommand) -> bool {matches!(command,- DevToolsCommand::GetRealms(_)- | DevToolsCommand::EvaluateScript(_)- | DevToolsCommand::CallFunction(_)- | DevToolsCommand::LocateNodes(_)- | DevToolsCommand::ReleaseObjects(_)+ AutomationCommand::GetRealms(_)+ | AutomationCommand::EvaluateScript(_)+ | AutomationCommand::CallFunction(_)+ | AutomationCommand::LocateNodes(_)+ | AutomationCommand::ReleaseObjects(_))}@@ -2345,7 +2344,7 @@ async fn execute_bidi_input_command(}let context = ClassicDevToolsCommandContext::with_protocol_and_target_id(- DevToolsProtocol::WebDriverBidi,+ FrontendProtocol::WebDriverBidi,&dispatch.session_id,&dispatch.context,);@@ -2446,13 +2445,13 @@ async fn execute_bidi_input_command(for tick in ticks {for command in tick.commands {let execution = scheduler- .execute_devtools_command_with_external_load_wait_and_protocol_messages(+ .execute_automation_command_with_external_load_wait_and_protocol_messages(receivers, command,).await;event_sources.extend_protocol_output(execution.protocol_output);match execution.result {- Ok(DevToolsCommandResult::Empty) => {}+ Ok(AutomationResult::Empty) => {}Ok(_) => {return BidiDevToolsCommandOutput {response: bidi_response_from_devtools_error(@@ -2541,9 +2540,9 @@ async fn execute_bidi_set_files_command(};}};- let command = DevToolsCommand::SetFileInputFiles(DevToolsSetFileInputFilesCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let command = AutomationCommand::SetFileInputFiles(DevToolsSetFileInputFilesCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from(dispatch.session_id.as_str())),target_id: Some(DevToolsTargetId::from(dispatch.context.as_str())),browser_context_id: None,@@ -2553,11 +2552,13 @@ async fn execute_bidi_set_files_command(append: false,});let execution = scheduler- .execute_devtools_command_with_external_load_wait_and_protocol_messages(receivers, command)+ .execute_automation_command_with_external_load_wait_and_protocol_messages(+ receivers, command,+ ).await;event_sources.extend_protocol_output(execution.protocol_output);let response = match execution.result {- Ok(DevToolsCommandResult::Empty) => success_response(dispatch.id, json!({})),+ Ok(AutomationResult::Empty) => success_response(dispatch.id, json!({})),Ok(_) => bidi_response_from_devtools_error(dispatch.id,DevToolsError::new(@@ -2709,9 +2710,9 @@ async fn bidi_input_element_origin_viewport_point(shared_id: &str,event_sources: &mut BidiDevToolsEventSources,) -> Result<moli_protocol_webdriver_classic::ClassicViewportPoint, BidiInputPreparationError> {- let command = DevToolsCommand::DomObjectReference(DevToolsDomObjectReferenceCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let command = AutomationCommand::DomObjectReference(DevToolsDomObjectReferenceCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from(session_id)),target_id: Some(DevToolsTargetId::from(context_id)),browser_context_id: None,@@ -2720,11 +2721,13 @@ async fn bidi_input_element_origin_viewport_point(operation: DevToolsDomObjectReferenceOperation::GetBoxModel,});let execution = scheduler- .execute_devtools_command_with_external_load_wait_and_protocol_messages(receivers, command)+ .execute_automation_command_with_external_load_wait_and_protocol_messages(+ receivers, command,+ ).await;event_sources.extend_protocol_output(execution.protocol_output);match execution.result {- Ok(DevToolsCommandResult::DomGeometry(geometry)) => {+ Ok(AutomationResult::DomGeometry(geometry)) => {element_center_from_geometry(&geometry).map_err(BidiInputPreparationError::Classic)}Ok(_) => Err(BidiInputPreparationError::DevTools(DevToolsError::new(@@ -2914,19 +2917,19 @@ async fn bidi_existing_user_context_ids(session_id: &str,) -> BTreeSet<String> {let mut user_contexts = BTreeSet::from(["default".to_owned()]);- let command = DevToolsCommand::GetBrowserContexts(DevToolsGetBrowserContextsCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let command = AutomationCommand::GetBrowserContexts(DevToolsGetBrowserContextsCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from(session_id)),target_id: None,browser_context_id: None,},});let result = scheduler- .execute_devtools_command_with_protocol_messages(command)+ .execute_automation_command_with_protocol_messages(command).await.result;- if let Ok(DevToolsCommandResult::GetBrowserContexts(result)) = result {+ if let Ok(AutomationResult::GetBrowserContexts(result)) = result {user_contexts.extend(result.browser_context_ids@@ -2942,20 +2945,20 @@ async fn bidi_input_viewport_bounds(session_id: &str,context_id: &str,) -> Result<ClassicViewportBounds, DevToolsError> {- let command = DevToolsCommand::GetLayoutMetrics(DevToolsGetLayoutMetricsCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let command = AutomationCommand::GetLayoutMetrics(DevToolsGetLayoutMetricsCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from(session_id)),target_id: Some(DevToolsTargetId::from(context_id)),browser_context_id: None,},});match scheduler- .execute_devtools_command_with_protocol_messages(command)+ .execute_automation_command_with_protocol_messages(command).await.result{- Ok(DevToolsCommandResult::LayoutMetrics(result)) => Ok(ClassicViewportBounds::new(+ Ok(AutomationResult::LayoutMetrics(result)) => Ok(ClassicViewportBounds::new(result.layout_viewport_width,result.layout_viewport_height,)),@@ -3000,13 +3003,13 @@ fn bidi_response_from_classic_input_error(id: u64, error: ClassicError) -> serdeasync fn validate_bidi_top_level_context_command(scheduler: &mut CdpScheduler,session_id: &str,- command: &DevToolsCommand,+ command: &AutomationCommand,) -> Option<DevToolsError> {let target_id = match command {- DevToolsCommand::CreateTarget(command) => command.context.target_id.as_ref()?,- DevToolsCommand::CloseTarget(command) => &command.target_id,- DevToolsCommand::ActivateTarget(command) => &command.target_id,- DevToolsCommand::TraverseHistory(command) => command.context.target_id.as_ref()?,+ AutomationCommand::CreateTarget(command) => command.context.target_id.as_ref()?,+ AutomationCommand::CloseTarget(command) => &command.target_id,+ AutomationCommand::ActivateTarget(command) => &command.target_id,+ AutomationCommand::TraverseHistory(command) => command.context.target_id.as_ref()?,_ => return None,};let target_info = bidi_target_info_for_target(scheduler, session_id, target_id.as_str()).await;@@ -3046,9 +3049,9 @@ async fn bidi_top_level_context_for_frame_tree_context(session_id: &str,target_id: &str,) -> Option<String> {- let command = DevToolsCommand::GetFrameTrees(DevToolsGetFrameTreesCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let command = AutomationCommand::GetFrameTrees(DevToolsGetFrameTreesCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from(session_id)),target_id: None,browser_context_id: None,@@ -3056,9 +3059,9 @@ async fn bidi_top_level_context_for_frame_tree_context(max_depth: None,});let execution = scheduler- .execute_devtools_command_with_protocol_messages(command)+ .execute_automation_command_with_protocol_messages(command).await;- let Ok(DevToolsCommandResult::GetFrameTrees(result)) = execution.result else {+ let Ok(AutomationResult::GetFrameTrees(result)) = execution.result else {return None;};result@@ -3109,9 +3112,9 @@ async fn bidi_target_info_for_target(session_id: &str,target_id: &str,) -> Option<DevToolsTargetInfo> {- let command = DevToolsCommand::GetTargetInfo(DevToolsGetTargetInfoCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let command = AutomationCommand::GetTargetInfo(DevToolsGetTargetInfoCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from(session_id)),target_id: Some(DevToolsTargetId::from(target_id)),browser_context_id: None,@@ -3119,9 +3122,9 @@ async fn bidi_target_info_for_target(target_id: Some(DevToolsTargetId::from(target_id)),});let execution = scheduler- .execute_devtools_command_with_protocol_messages(command)+ .execute_automation_command_with_protocol_messages(command).await;- let Ok(DevToolsCommandResult::GetTargetInfo(result)) = execution.result else {+ let Ok(AutomationResult::GetTargetInfo(result)) = execution.result else {return None;};Some(result.target_info)@@ -3140,13 +3143,13 @@ fn target_lifecycle_event_from_target_info(})}-fn bidi_event_context_from_devtools_command(command: &DevToolsCommand) -> Option<String> {+fn bidi_event_context_from_automation_command(command: &AutomationCommand) -> Option<String> {match command {- DevToolsCommand::Navigate(command) => command.context.target_id.as_ref(),- DevToolsCommand::Reload(command) => command.context.target_id.as_ref(),- DevToolsCommand::EvaluateScript(command) => command.context.target_id.as_ref(),- DevToolsCommand::CallFunction(command) => command.context.target_id.as_ref(),- DevToolsCommand::GetRealms(command) => command.context.target_id.as_ref(),+ AutomationCommand::Navigate(command) => command.context.target_id.as_ref(),+ AutomationCommand::Reload(command) => command.context.target_id.as_ref(),+ AutomationCommand::EvaluateScript(command) => command.context.target_id.as_ref(),+ AutomationCommand::CallFunction(command) => command.context.target_id.as_ref(),+ AutomationCommand::GetRealms(command) => command.context.target_id.as_ref(),_ => None,}.map(|target_id| target_id.as_str().to_owned())@@ -3232,7 +3235,7 @@ impl SharedBidiSessionRegistry {#[cfg(test)]mod tests {- use moli_protocol::devtools_runtime::RuntimeConsoleEvent;+ use moli_protocol::automation::RuntimeConsoleEvent;use serde_json::json;use super::*;diff --git a/moli-protocol-server/src/protocol_server/webdriver_classic.rs b/moli-protocol-server/src/protocol_server/webdriver_classic.rsindex f282a7886..5529ed4da 100644--- a/moli-protocol-server/src/protocol_server/webdriver_classic.rs+++ b/moli-protocol-server/src/protocol_server/webdriver_classic.rs@@ -18,18 +18,18 @@ use moli_core::page::{use moli_html_input_type::InputType;use moli_protocol::{DevToolsPageResidenceIdentity,- devtools_runtime::{- DevToolsCommand, DevToolsCommandContext, DevToolsCommandResult, DevToolsDomGeometryResult,+ automation::{+ AutomationCommand, AutomationContext, AutomationResult, DevToolsDomGeometryResult,DevToolsDomNodeReference, DevToolsDownloadBehaviorSetting, DevToolsElementClickCommand,DevToolsElementClickOperation, DevToolsError, DevToolsErrorKind, DevToolsFrameId,DevToolsGetFrameOwnerCommand, DevToolsGetFrameOwnerResult, DevToolsGetRealmsCommand,DevToolsGetRealmsResult, DevToolsGetServiceWorkerLogsCommand,DevToolsGetServiceWorkerLogsResult, DevToolsGetTargetsCommand, DevToolsGetTargetsResult,- DevToolsLayoutMetricsResult, DevToolsLocateNodesResult, DevToolsProtocol,- DevToolsQuerySelectorResult, DevToolsRemoteHandleId, DevToolsRemoteValue,- DevToolsScriptException, DevToolsScriptResult, DevToolsSessionId,- DevToolsSetDownloadBehaviorCommand, DevToolsSetFileInputFilesCommand, DevToolsTargetId,- DevToolsTargetInfo, DevToolsTargetKind, RuntimeConsoleEvent, RuntimeExecutionContextEvent,+ DevToolsLayoutMetricsResult, DevToolsLocateNodesResult, DevToolsQuerySelectorResult,+ DevToolsRemoteHandleId, DevToolsRemoteValue, DevToolsScriptException, DevToolsScriptResult,+ DevToolsSessionId, DevToolsSetDownloadBehaviorCommand, DevToolsSetFileInputFilesCommand,+ DevToolsTargetId, DevToolsTargetInfo, DevToolsTargetKind, FrontendProtocol,+ RuntimeConsoleEvent, RuntimeExecutionContextEvent,},version,};@@ -138,9 +138,9 @@ fn classic_top_level_context(binding: &ClassicSessionBinding) -> ClassicDevToolsClassicDevToolsCommandContext::with_target_id(&binding.session_id, &binding.target_id)}-fn classic_top_level_devtools_context(binding: &ClassicSessionBinding) -> DevToolsCommandContext {- DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+fn classic_top_level_devtools_context(binding: &ClassicSessionBinding) -> AutomationContext {+ AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from(binding.session_id.as_str())),target_id: Some(DevToolsTargetId::from(binding.target_id.as_str())),browser_context_id: None,@@ -240,7 +240,7 @@ async fn classic_handle_unhandled_prompt(context: &ClassicDevToolsCommandContext,) -> Result<(), ClassicError> {let dialog = match binding.runtime.execute(alert_text_command(context)).await {- Ok(DevToolsCommandResult::JavaScriptDialog(dialog)) => dialog,+ Ok(AutomationResult::JavaScriptDialog(dialog)) => dialog,Ok(_) => {return Err(ClassicError::new(ClassicErrorCode::UnknownError,@@ -262,7 +262,7 @@ async fn classic_handle_unhandled_prompt(.execute(alert_handle_command(context, accept)).await{- Ok(DevToolsCommandResult::Empty) => {+ Ok(AutomationResult::Empty) => {if notify {Err(classic_unexpected_alert_open_error(&dialog.message))} else {@@ -312,7 +312,7 @@ async fn ensure_classic_top_level_browsing_context_exists(.execute(window_handles_command(&context)).await{- Ok(DevToolsCommandResult::GetTargets(result)) => {+ Ok(AutomationResult::GetTargets(result)) => {if window_handles_from_targets(result).iter().any(|target_id| target_id == &binding.target_id)@@ -358,7 +358,7 @@ async fn ensure_classic_frame_switch_target_ready(.execute(page_source_command(&frame_context)).await{- Ok(DevToolsCommandResult::GetOuterHtml(_)) => Ok(()),+ Ok(AutomationResult::GetOuterHtml(_)) => Ok(()),Ok(_) => Err(ClassicError::new(ClassicErrorCode::UnknownError,"frame readiness probe returned an unexpected result",@@ -562,7 +562,7 @@ async fn resolve_classic_element_remote_object_from_reference(.execute_on_page(resolve, page_residence.clone()).await{- Ok(DevToolsCommandResult::ResolveNode(result)) => result+ Ok(AutomationResult::ResolveNode(result)) => result.object.get("objectId").and_then(Value::as_str)@@ -634,7 +634,7 @@ async fn resolve_classic_shadow_root_remote_object_from_reference(.execute_on_page(resolve, page_residence.clone()).await{- Ok(DevToolsCommandResult::ResolveNode(result)) => result+ Ok(AutomationResult::ResolveNode(result)) => result.object.get("objectId").and_then(Value::as_str)@@ -664,15 +664,15 @@ async fn classic_frame_owner_dom_reference(binding: &ClassicSessionBinding,frame_id: &str,) -> Result<ClassicPageBoundDomReference, ClassicError> {- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from(binding.session_id.as_str())),target_id: Some(DevToolsTargetId::from(binding.target_id.as_str())),browser_context_id: None,};match binding.runtime- .execute_with_page_residence(DevToolsCommand::GetFrameOwner(+ .execute_with_page_residence(AutomationCommand::GetFrameOwner(DevToolsGetFrameOwnerCommand {context,frame_id: DevToolsFrameId::from(frame_id),@@ -680,7 +680,7 @@ async fn classic_frame_owner_dom_reference()).await{- Ok((DevToolsCommandResult::GetFrameOwner(owner), page_residence)) => {+ Ok((AutomationResult::GetFrameOwner(owner), page_residence)) => {Ok(ClassicPageBoundDomReference {page_residence,reference: classic_dom_reference_from_frame_owner_result(owner),@@ -722,9 +722,9 @@ async fn classic_default_execution_context_id(page_residence: &DevToolsPageResidenceIdentity,label: &str,) -> Result<i64, ClassicError> {- let command = DevToolsCommand::GetRealms(DevToolsGetRealmsCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ let command = AutomationCommand::GetRealms(DevToolsGetRealmsCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from(context.session_id.as_str())),target_id: context.target_id.as_deref().map(DevToolsTargetId::from),browser_context_id: None,@@ -736,7 +736,7 @@ async fn classic_default_execution_context_id(.execute_on_page(command, page_residence.clone()).await{- Ok(DevToolsCommandResult::Realms(result)) => result+ Ok(AutomationResult::Realms(result)) => result.realms.iter().find(|realm| realm.is_default == Some(true) && realm.context_id.is_some())@@ -1113,10 +1113,10 @@ fn classic_script_reference_id<'a>(}fn apply_classic_script_argument_handles(- command: &mut DevToolsCommand,+ command: &mut AutomationCommand,handles: &ClassicScriptArgumentHandles,) {- let DevToolsCommand::CallFunction(command) = command else {+ let AutomationCommand::CallFunction(command) = command else {return;};let user_function = command.function_declaration.clone();@@ -1133,10 +1133,10 @@ fn apply_classic_script_argument_handles(async fn execute_classic_script_with_argument_page(binding: &ClassicSessionBinding,- command: DevToolsCommand,+ command: AutomationCommand,timeout: Option<Duration>,expected_page: Option<DevToolsPageResidenceIdentity>,-) -> Result<(DevToolsCommandResult, DevToolsPageResidenceIdentity), DevToolsError> {+) -> Result<(AutomationResult, DevToolsPageResidenceIdentity), DevToolsError> {match expected_page {Some(expected_page) => binding.runtime@@ -1444,7 +1444,7 @@ async fn classic_script_dom_references_by_node_id().await{- Ok(DevToolsCommandResult::DescribeNode(result)) => {+ Ok(AutomationResult::DescribeNode(result)) => {classic_script_canonical_dom_reference_from_described_node(&result.node, node_id)}Ok(_) => {@@ -1510,7 +1510,7 @@ async fn classic_script_frame_owner_dom_reference().await{- Ok(DevToolsCommandResult::DescribeNode(result)) => Ok(ClassicPageBoundDomReference {+ Ok(AutomationResult::DescribeNode(result)) => Ok(ClassicPageBoundDomReference {page_residence: page_residence.clone(),reference: classic_script_frame_owner_dom_reference_from_described_node(owner_reference,@@ -1676,7 +1676,7 @@ pub(super) async fn webdriver_classic_new_session(.execute(create_initial_target_command(&create_context)).await{- Ok(DevToolsCommandResult::CreateTarget(result)) => result.target_id.into_string(),+ Ok(AutomationResult::CreateTarget(result)) => result.target_id.into_string(),Ok(_) => {state.classic_session_registry@@ -1715,7 +1715,7 @@ pub(super) async fn webdriver_classic_new_session(let download_behavior =selenium_download_behavior_command(&session.session_id, directory.as_path());match runtime.execute(download_behavior).await {- Ok(DevToolsCommandResult::Empty) => {}+ Ok(AutomationResult::Empty) => {}Ok(_) => {state.classic_session_registry@@ -1921,15 +1921,15 @@ pub(super) async fn webdriver_classic_get_service_workers(Ok(binding) => binding,Err(error) => return classic_error_into_response(error),};- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from(binding.session_id.as_str())),target_id: None,browser_context_id: None,};let targets = match binding.runtime- .execute(DevToolsCommand::GetTargets(DevToolsGetTargetsCommand {+ .execute(AutomationCommand::GetTargets(DevToolsGetTargetsCommand {context: context.clone(),root: None,max_depth: None,@@ -1937,7 +1937,7 @@ pub(super) async fn webdriver_classic_get_service_workers(})).await{- Ok(DevToolsCommandResult::GetTargets(result)) => result,+ Ok(AutomationResult::GetTargets(result)) => result,Ok(_) => {return classic_error_into_response(ClassicError::new(ClassicErrorCode::UnknownError,@@ -1948,13 +1948,13 @@ pub(super) async fn webdriver_classic_get_service_workers(};let realms = match binding.runtime- .execute(DevToolsCommand::GetRealms(DevToolsGetRealmsCommand {+ .execute(AutomationCommand::GetRealms(DevToolsGetRealmsCommand {context: context.clone(),realm_type: Some("service-worker".to_owned()),})).await{- Ok(DevToolsCommandResult::Realms(result)) => result,+ Ok(AutomationResult::Realms(result)) => result,Ok(_) => {return classic_error_into_response(ClassicError::new(ClassicErrorCode::UnknownError,@@ -1965,7 +1965,7 @@ pub(super) async fn webdriver_classic_get_service_workers(};let logs = match binding.runtime- .execute(DevToolsCommand::GetServiceWorkerLogs(+ .execute(AutomationCommand::GetServiceWorkerLogs(DevToolsGetServiceWorkerLogsCommand {context,target_id: None,@@ -1973,7 +1973,7 @@ pub(super) async fn webdriver_classic_get_service_workers()).await{- Ok(DevToolsCommandResult::ServiceWorkerLogs(result)) => result,+ Ok(AutomationResult::ServiceWorkerLogs(result)) => result,Ok(_) => {return classic_error_into_response(ClassicError::new(ClassicErrorCode::UnknownError,@@ -2087,7 +2087,7 @@ pub(super) async fn webdriver_classic_navigate(Err(error) => return classic_error_into_response(error),};match webdriver_classic_execute_page_load_command(&binding, command).await {- Ok(DevToolsCommandResult::Navigate(_)) => {+ Ok(AutomationResult::Navigate(_)) => {classic_reset_to_top_level_browsing_context(&state, &session_id);classic_success_into_response(Value::Null)}@@ -2109,7 +2109,7 @@ pub(super) async fn webdriver_classic_get_url(};let context = classic_top_level_context(&binding);match binding.runtime.execute(current_url_command(&context)).await {- Ok(DevToolsCommandResult::GetTargets(result)) => {+ Ok(AutomationResult::GetTargets(result)) => {let Some(target) = result.targets.into_iter().next() else {return classic_error_into_response(ClassicError::new(ClassicErrorCode::NoSuchWindow,@@ -2200,7 +2200,7 @@ pub(super) async fn webdriver_classic_get_source(};let context = classic_browsing_context(&binding);match binding.runtime.execute(page_source_command(&context)).await {- Ok(DevToolsCommandResult::GetOuterHtml(result)) => {+ Ok(AutomationResult::GetOuterHtml(result)) => {classic_success_into_response(json!(result.outer_html))}Ok(_) => classic_error_into_response(ClassicError::new(@@ -2221,7 +2221,7 @@ pub(super) async fn webdriver_classic_take_screenshot(};let context = classic_top_level_context(&binding);match binding.runtime.execute(screenshot_command(&context)).await {- Ok(DevToolsCommandResult::CaptureScreenshot(result)) => {+ Ok(AutomationResult::CaptureScreenshot(result)) => {classic_success_into_response(json!(BASE64_STANDARD.encode(result.bytes.as_ref())))}Ok(_) => classic_error_into_response(ClassicError::new(@@ -2262,7 +2262,7 @@ pub(super) async fn webdriver_classic_print_page(async fn webdriver_classic_evaluate_string_command(session_id: String,state: AppState,- build_command: impl FnOnce(&ClassicDevToolsCommandContext) -> DevToolsCommand,+ build_command: impl FnOnce(&ClassicDevToolsCommandContext) -> AutomationCommand,label: &'static str,) -> Response {let binding = match classic_top_level_browsing_context_binding(&state, &session_id).await {@@ -2279,7 +2279,7 @@ async fn webdriver_classic_evaluate_string_command().await{- Ok(DevToolsCommandResult::Script(result)) => match *result {+ Ok(AutomationResult::Script(result)) => match *result {DevToolsScriptResult::Value(value) => {if !value.value.is_string() {return classic_error_into_response(ClassicError::new(@@ -2315,7 +2315,7 @@ fn classic_webdriver_title(title: &str) -> String {async fn classic_current_url(binding: &ClassicSessionBinding) -> Result<String, ClassicError> {let context = classic_top_level_context(binding);match binding.runtime.execute(current_url_command(&context)).await {- Ok(DevToolsCommandResult::GetTargets(result)) => {+ Ok(AutomationResult::GetTargets(result)) => {let Some(target) = result.targets.into_iter().next() else {return Err(ClassicError::new(ClassicErrorCode::NoSuchWindow,@@ -2526,12 +2526,10 @@ async fn classic_popup_window_handles_by_id_for_script_result(.execute(window_handles_command(&context)).await{- Ok(DevToolsCommandResult::GetTargets(result)) => Ok(result+ Ok(AutomationResult::GetTargets(result)) => Ok(result.targets.into_iter()- .filter(|target| {- target.kind == moli_protocol::devtools_runtime::DevToolsTargetKind::Page- })+ .filter(|target| target.kind == moli_protocol::automation::DevToolsTargetKind::Page).filter_map(|target| {let popup_id = target.moli_popup_id?;let target_id = target.target_id?.into_string();@@ -2561,7 +2559,7 @@ pub(super) async fn webdriver_classic_refresh().await{- Ok(DevToolsCommandResult::Navigate(_)) => {+ Ok(AutomationResult::Navigate(_)) => {classic_reset_to_top_level_browsing_context(&state, &session_id);classic_success_into_response(Value::Null)}@@ -2602,7 +2600,7 @@ async fn webdriver_classic_traverse_history(.execute(navigation_history_command(&context)).await{- Ok(DevToolsCommandResult::GetNavigationHistory(history)) => history,+ Ok(AutomationResult::GetNavigationHistory(history)) => history,Ok(_) => {return classic_error_into_response(ClassicError::new(ClassicErrorCode::UnknownError,@@ -2625,13 +2623,13 @@ async fn webdriver_classic_traverse_history().await{- Ok(DevToolsCommandResult::TraverseHistory(result)) => {+ Ok(AutomationResult::TraverseHistory(result)) => {if !result.same_document {classic_reset_to_top_level_browsing_context(&state, &session_id);}classic_success_into_response(Value::Null)}- Ok(DevToolsCommandResult::Empty) => classic_success_into_response(Value::Null),+ Ok(AutomationResult::Empty) => classic_success_into_response(Value::Null),Ok(_) => classic_error_into_response(ClassicError::new(ClassicErrorCode::UnknownError,"history traversal returned an unexpected result",@@ -2642,8 +2640,8 @@ async fn webdriver_classic_traverse_history(async fn webdriver_classic_execute_page_load_command(binding: &ClassicSessionBinding,- command: DevToolsCommand,-) -> Result<DevToolsCommandResult, ClassicError> {+ command: AutomationCommand,+) -> Result<AutomationResult, ClassicError> {match binding.runtime.execute_inner(@@ -2707,7 +2705,7 @@ pub(super) async fn webdriver_classic_execute_sync().await;match result {- Ok((DevToolsCommandResult::Script(result), page_residence)) => match *result {+ Ok((AutomationResult::Script(result), page_residence)) => match *result {DevToolsScriptResult::Value(value) => {match classic_webdriver_script_result_value(&state,@@ -2788,7 +2786,7 @@ pub(super) async fn webdriver_classic_execute_async().await;match result {- Ok((DevToolsCommandResult::Script(result), page_residence)) => match *result {+ Ok((AutomationResult::Script(result), page_residence)) => match *result {DevToolsScriptResult::Value(value) => {match classic_webdriver_script_result_value(&state,@@ -2898,7 +2896,7 @@ pub(super) async fn webdriver_classic_get_element_shadow_root().await;match result {- Ok(DevToolsCommandResult::DescribeNode(result)) => {+ Ok(AutomationResult::DescribeNode(result)) => {let Some((node_id, reference)) =classic_author_shadow_root_reference_from_described_node(&result.node)else {@@ -2961,7 +2959,7 @@ async fn verify_classic_element_attached().await;match result {- Ok(DevToolsCommandResult::Script(result)) => match *result {+ Ok(AutomationResult::Script(result)) => match *result {DevToolsScriptResult::Value(_) => Ok(()),DevToolsScriptResult::Exception(exception) => {Err(classic_webdriver_command_exception_error(exception))@@ -3185,11 +3183,11 @@ async fn verify_classic_shadow_root_remote_object_attached(}fn verify_classic_shadow_root_attached_result(- result: Result<DevToolsCommandResult, DevToolsError>,+ result: Result<AutomationResult, DevToolsError>,label: &str,) -> Result<(), ClassicError> {match result {- Ok(DevToolsCommandResult::Script(result)) => match *result {+ Ok(AutomationResult::Script(result)) => match *result {DevToolsScriptResult::Value(value) if value.value.as_bool().unwrap_or(false) => Ok(()),DevToolsScriptResult::Value(_) | DevToolsScriptResult::Exception(_) => {Err(ClassicError::new(@@ -3211,7 +3209,7 @@ fn verify_classic_shadow_root_attached_result(async fn webdriver_classic_execute_find_element_command(binding: &ClassicSessionBinding,- command: DevToolsCommand,+ command: AutomationCommand,multiple: bool,expected_page: Option<DevToolsPageResidenceIdentity>,) -> Result<ClassicFindElementExecution, DevToolsError> {@@ -3232,24 +3230,24 @@ async fn webdriver_classic_execute_find_element_command(}};match execution {- Ok((DevToolsCommandResult::QuerySelector(result), page_residence)) => {+ Ok((AutomationResult::QuerySelector(result), page_residence)) => {if !result.node_ids.is_empty()|| implicit_wait.is_zero()|| started.elapsed() >= implicit_wait{return Ok(ClassicFindElementExecution {- result: DevToolsCommandResult::QuerySelector(result),+ result: AutomationResult::QuerySelector(result),page_residence: Some(page_residence),});}}- Ok((DevToolsCommandResult::LocateNodes(result), page_residence)) => {+ Ok((AutomationResult::LocateNodes(result), page_residence)) => {if !result.node_ids.is_empty()|| implicit_wait.is_zero()|| started.elapsed() >= implicit_wait{return Ok(ClassicFindElementExecution {- result: DevToolsCommandResult::LocateNodes(result),+ result: AutomationResult::LocateNodes(result),page_residence: Some(page_residence),});}@@ -3279,7 +3277,7 @@ async fn webdriver_classic_execute_find_element_command(}struct ClassicFindElementExecution {- result: DevToolsCommandResult,+ result: AutomationResult,page_residence: Option<DevToolsPageResidenceIdentity>,}@@ -3295,7 +3293,7 @@ async fn webdriver_classic_find_element_result_response(page_residence,} = execution;match result {- DevToolsCommandResult::QuerySelector(result) if multiple => {+ AutomationResult::QuerySelector(result) if multiple => {if result.node_ids.is_empty() {return classic_success_into_response(json!([]));}@@ -3322,7 +3320,7 @@ async fn webdriver_classic_find_element_result_response()))}- DevToolsCommandResult::LocateNodes(result) if multiple => {+ AutomationResult::LocateNodes(result) if multiple => {if result.node_ids.is_empty() {return classic_success_into_response(json!([]));}@@ -3349,7 +3347,7 @@ async fn webdriver_classic_find_element_result_response()))}- DevToolsCommandResult::QuerySelector(result) => {+ AutomationResult::QuerySelector(result) => {let Some(frontend_node_id) = result.node_ids.first().copied() else {return classic_error_into_response(ClassicError::new(ClassicErrorCode::NoSuchElement,@@ -3379,7 +3377,7 @@ async fn webdriver_classic_find_element_result_response(reference.reference,))}- DevToolsCommandResult::LocateNodes(result) => {+ AutomationResult::LocateNodes(result) => {let Some(frontend_node_id) = result.node_ids.first().copied() else {return classic_error_into_response(ClassicError::new(ClassicErrorCode::NoSuchElement,@@ -3458,7 +3456,7 @@ async fn classic_find_canonical_dom_reference_for_frontend_node_id().await{- Ok(DevToolsCommandResult::DescribeNode(result)) => {+ Ok(AutomationResult::DescribeNode(result)) => {Ok(classic_script_canonical_dom_reference_from_described_node(&result.node,frontend_node_id,@@ -3473,17 +3471,17 @@ async fn classic_find_canonical_dom_reference_for_frontend_node_id(}fn empty_classic_find_result_for_command(- command: &DevToolsCommand,+ command: &AutomationCommand,multiple: bool,-) -> DevToolsCommandResult {+) -> AutomationResult {match command {- DevToolsCommand::LocateNodes(_) => {- DevToolsCommandResult::LocateNodes(DevToolsLocateNodesResult {+ AutomationCommand::LocateNodes(_) => {+ AutomationResult::LocateNodes(DevToolsLocateNodesResult {nodes: Vec::new(),node_ids: Vec::new(),})}- _ => DevToolsCommandResult::QuerySelector(DevToolsQuerySelectorResult {+ _ => AutomationResult::QuerySelector(DevToolsQuerySelectorResult {node_ids: Vec::new(),multiple,}),@@ -3513,7 +3511,7 @@ pub(super) async fn webdriver_classic_get_element_attribute(.execute_on_page(command, reference.page_residence).await{- Ok(DevToolsCommandResult::GetAttributes(result)) => {+ Ok(AutomationResult::GetAttributes(result)) => {classic_success_into_response(json!(classic_attribute_value(result, &name)))}Ok(_) => classic_error_into_response(ClassicError::new(@@ -3565,7 +3563,7 @@ pub(super) async fn webdriver_classic_get_element_text(release_classic_page_bound_remote_object(&binding, &context, object_id, "get element text").await;match result {- Ok(DevToolsCommandResult::Script(result)) => match *result {+ Ok(AutomationResult::Script(result)) => match *result {DevToolsScriptResult::Value(value) => {classic_success_into_response(json!(value.value.as_str().unwrap_or_default()))}@@ -3597,7 +3595,7 @@ async fn webdriver_classic_get_element_text_from_dom(.execute_on_page(command, reference.page_residence).await{- Ok(DevToolsCommandResult::GetText(result)) => {+ Ok(AutomationResult::GetText(result)) => {classic_success_into_response(json!(classic_text_value(result)))}Ok(_) => classic_error_into_response(ClassicError::new(@@ -3635,7 +3633,7 @@ pub(super) async fn webdriver_classic_get_element_tag_name(.execute_on_page(command, reference.page_residence).await{- Ok(DevToolsCommandResult::GetProperty(result)) => {+ Ok(AutomationResult::GetProperty(result)) => {classic_success_into_response(classic_property_value(result))}Ok(_) => classic_error_into_response(ClassicError::new(@@ -3660,7 +3658,7 @@ pub(super) async fn webdriver_classic_get_active_element(.execute_with_page_residence(active_element_command(&context)).await{- Ok((DevToolsCommandResult::Script(result), page_residence)) => match *result {+ Ok((AutomationResult::Script(result), page_residence)) => match *result {DevToolsScriptResult::Value(value) => {let Some(node_id) = value.node_id else {return classic_error_into_response(ClassicError::new(@@ -3738,7 +3736,7 @@ async fn classic_element_live_identity(.execute_on_page(command, reference.page_residence).await{- Ok(DevToolsCommandResult::DescribeNode(result)) => {+ Ok(AutomationResult::DescribeNode(result)) => {classic_element_live_identity_from_described_node(&result.node).ok_or_else(|| {ClassicError::new(ClassicErrorCode::NoSuchElement,@@ -3803,7 +3801,7 @@ pub(super) async fn webdriver_classic_is_element_enabled(release_classic_page_bound_remote_object(&binding, &context, object_id, "is element enabled").await;match result {- Ok(DevToolsCommandResult::Script(result)) => match *result {+ Ok(AutomationResult::Script(result)) => match *result {DevToolsScriptResult::Value(value) => {classic_success_into_response(json!(value.value.as_bool().unwrap_or(false)))}@@ -3911,8 +3909,7 @@ pub(super) async fn webdriver_classic_get_element_rect(.execute_on_page(command, reference.page_residence).await{- Ok(DevToolsCommandResult::DomGeometry(result)) => match classic_rect_from_geometry(&result)- {+ Ok(AutomationResult::DomGeometry(result)) => match classic_rect_from_geometry(&result) {Ok(rect) => classic_success_into_response(rect),Err(error) => classic_error_into_response(error),},@@ -4000,7 +3997,7 @@ pub(super) async fn webdriver_classic_get_element_css_value().await;match result {- Ok(DevToolsCommandResult::Script(result)) => match *result {+ Ok(AutomationResult::Script(result)) => match *result {DevToolsScriptResult::Value(value) => {classic_success_into_response(json!(value.value.as_str().unwrap_or_default()))}@@ -4067,7 +4064,7 @@ impl ClassicComputedElementValue {self,context: &ClassicDevToolsCommandContext,object_id: String,- ) -> DevToolsCommand {+ ) -> AutomationCommand {match self {Self::Label => get_element_computed_label_command(context, object_id),Self::Role => get_element_computed_role_command(context, object_id),@@ -4108,7 +4105,7 @@ async fn webdriver_classic_get_element_computed_value(.await;release_classic_page_bound_remote_object(&binding, &context, object_id, kind.label()).await;match result {- Ok(DevToolsCommandResult::Script(result)) => match *result {+ Ok(AutomationResult::Script(result)) => match *result {DevToolsScriptResult::Value(value) => {classic_success_into_response(json!(value.value.as_str().unwrap_or_default()))}@@ -4154,7 +4151,7 @@ pub(super) async fn webdriver_classic_is_element_displayed(release_classic_page_bound_remote_object(&binding, &context, object_id, "is element displayed").await;match result {- Ok(DevToolsCommandResult::Script(result)) => match *result {+ Ok(AutomationResult::Script(result)) => match *result {DevToolsScriptResult::Value(value) => {classic_success_into_response(json!(value.value.as_bool().unwrap_or(false)))}@@ -4185,7 +4182,7 @@ async fn webdriver_classic_element_property_value(.execute_on_page(command, reference.page_residence).await{- Ok(DevToolsCommandResult::GetProperty(result)) => Ok(classic_property_value(result)),+ Ok(AutomationResult::GetProperty(result)) => Ok(classic_property_value(result)),Ok(_) => Err(ClassicError::new(ClassicErrorCode::UnknownError,format!("{label} returned an unexpected result"),@@ -4242,7 +4239,7 @@ pub(super) async fn webdriver_classic_get_element_property().await;match result {- Ok((DevToolsCommandResult::Script(result), page_residence)) => match *result {+ Ok((AutomationResult::Script(result), page_residence)) => match *result {DevToolsScriptResult::Value(value) => {match classic_webdriver_script_result_value(&state,@@ -4309,7 +4306,7 @@ pub(super) async fn webdriver_classic_clear_element(.await;release_classic_page_bound_remote_object(&binding, &context, object_id, "clear element").await;match result {- Ok(DevToolsCommandResult::Script(result)) => match *result {+ Ok(AutomationResult::Script(result)) => match *result {DevToolsScriptResult::Value(value) => match classic_clear_element_result(value.value) {Ok(()) => classic_success_into_response(Value::Null),Err(error) => classic_error_into_response(error),@@ -4500,7 +4497,7 @@ async fn webdriver_classic_prepare_text_control_for_send_keys().await;match result {- Ok(DevToolsCommandResult::Script(result)) => match *result {+ Ok(AutomationResult::Script(result)) => match *result {DevToolsScriptResult::Value(value) => match value.value.as_str() {Some("text-control") => Ok(ClassicSendKeysPreflight::TextControl),Some("value-set") => Ok(ClassicSendKeysPreflight::ValueSet),@@ -4567,7 +4564,7 @@ async fn webdriver_classic_activate_element_by_handle(let prepared = binding.runtime.execute_on_page(- DevToolsCommand::ElementClick(DevToolsElementClickCommand {+ AutomationCommand::ElementClick(DevToolsElementClickCommand {context: classic_top_level_devtools_context(binding),operation: DevToolsElementClickOperation::Prepare {object_id: object_id.object_id.clone().into(),@@ -4577,7 +4574,7 @@ async fn webdriver_classic_activate_element_by_handle().await;let preparation = match prepared {- Ok(DevToolsCommandResult::ElementClickPreparation(result)) => {+ Ok(AutomationResult::ElementClickPreparation(result)) => {result.map_err(classic_error_from_click_preparation)}Ok(_) => Err(ClassicError::new(@@ -4610,7 +4607,7 @@ async fn webdriver_classic_activate_element_by_handle(let result = binding.runtime.execute_on_page(- DevToolsCommand::ElementClick(DevToolsElementClickCommand {+ AutomationCommand::ElementClick(DevToolsElementClickCommand {context: classic_top_level_devtools_context(binding),operation: DevToolsElementClickOperation::Dispatch(click),}),@@ -4618,7 +4615,7 @@ async fn webdriver_classic_activate_element_by_handle().await;match result {- Ok(DevToolsCommandResult::ElementClickDispatch(Err(error))) => {+ Ok(AutomationResult::ElementClickDispatch(Err(error))) => {Err(classic_error_from_click_preparation(error))}result => Ok(result),@@ -4631,7 +4628,7 @@ async fn webdriver_classic_activate_element_by_handle(let result = operation?;let post_click_navigation = classic_wait_for_current_document(binding).await;match result {- Ok(DevToolsCommandResult::Empty | DevToolsCommandResult::ElementClickDispatch(Ok(()))) => {+ Ok(AutomationResult::Empty | AutomationResult::ElementClickDispatch(Ok(()))) => {post_click_navigation?;if binding.current_frame_id.is_some()&& let Err(error) = ensure_classic_current_browsing_context_exists(binding).await@@ -4649,7 +4646,7 @@ async fn webdriver_classic_activate_element_by_handle(}Ok(())}- Ok(DevToolsCommandResult::Script(result)) => {+ Ok(AutomationResult::Script(result)) => {post_click_navigation?;match *result {DevToolsScriptResult::Value(value) => {@@ -4771,9 +4768,9 @@ async fn webdriver_classic_send_file_input_keys(let result = binding.runtime.execute_on_page(- DevToolsCommand::SetFileInputFiles(DevToolsSetFileInputFilesCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ AutomationCommand::SetFileInputFiles(DevToolsSetFileInputFilesCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from(context.session_id.as_str())),target_id: context.target_id.as_deref().map(DevToolsTargetId::from),browser_context_id: None,@@ -4788,7 +4785,7 @@ async fn webdriver_classic_send_file_input_keys(release_classic_page_bound_remote_object(binding, context, object_id, "element file upload").await;match result {- Ok(DevToolsCommandResult::Empty) => Ok(()),+ Ok(AutomationResult::Empty) => Ok(()),Ok(_) => Err(ClassicError::new(ClassicErrorCode::UnknownError,"element file upload returned an unexpected result",@@ -4834,8 +4831,8 @@ async fn webdriver_classic_element_geometry(.execute_on_page(command, page_residence.clone()).await{- Ok(DevToolsCommandResult::Empty) => {}- Ok(DevToolsCommandResult::DomGeometry(result)) => geometry = Some(result),+ Ok(AutomationResult::Empty) => {}+ Ok(AutomationResult::DomGeometry(result)) => geometry = Some(result),Ok(_) => {return Err(ClassicError::new(ClassicErrorCode::UnknownError,@@ -4879,7 +4876,7 @@ async fn webdriver_classic_viewport_bounds(.execute(layout_metrics_command(context)).await{- Ok(DevToolsCommandResult::LayoutMetrics(metrics)) => Ok(classic_viewport_bounds(metrics)),+ Ok(AutomationResult::LayoutMetrics(metrics)) => Ok(classic_viewport_bounds(metrics)),Ok(_) => Err(ClassicError::new(ClassicErrorCode::UnknownError,"layout metrics returned an unexpected result",@@ -4897,7 +4894,7 @@ fn classic_viewport_bounds(metrics: DevToolsLayoutMetricsResult) -> ClassicViewpasync fn webdriver_classic_execute_empty_commands(binding: &ClassicSessionBinding,- commands: Vec<DevToolsCommand>,+ commands: Vec<AutomationCommand>,unexpected_result_message: &str,) -> Result<(), ClassicError> {for command in commands {@@ -4910,11 +4907,11 @@ async fn webdriver_classic_execute_empty_commands(}fn webdriver_classic_expect_empty_result(- result: Result<DevToolsCommandResult, DevToolsError>,+ result: Result<AutomationResult, DevToolsError>,unexpected_result_message: &str,) -> Result<(), ClassicError> {match result {- Ok(DevToolsCommandResult::Empty) => Ok(()),+ Ok(AutomationResult::Empty) => Ok(()),Ok(_) => Err(ClassicError::new(ClassicErrorCode::UnknownError,unexpected_result_message,@@ -5047,10 +5044,10 @@ fn downloads_enabled_capability_value(value: &Value) -> Result<bool, ClassicErro})}-fn selenium_download_behavior_command(session_id: &str, directory: &FsPath) -> DevToolsCommand {- DevToolsCommand::SetDownloadBehavior(DevToolsSetDownloadBehaviorCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+fn selenium_download_behavior_command(session_id: &str, directory: &FsPath) -> AutomationCommand {+ AutomationCommand::SetDownloadBehavior(DevToolsSetDownloadBehaviorCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from(session_id)),target_id: None,browser_context_id: None,diff --git a/moli-protocol-server/src/protocol_server/webdriver_classic/alerts.rs b/moli-protocol-server/src/protocol_server/webdriver_classic/alerts.rsindex 715f3375d..1e907156c 100644--- a/moli-protocol-server/src/protocol_server/webdriver_classic/alerts.rs+++ b/moli-protocol-server/src/protocol_server/webdriver_classic/alerts.rs@@ -3,7 +3,7 @@ use axum::{extract::{Path, State},response::Response,};-use moli_protocol::devtools_runtime::DevToolsCommandResult;+use moli_protocol::automation::AutomationResult;use moli_protocol_webdriver_classic::{ClassicError, ClassicErrorCode, alert_handle_command, alert_send_text_command,alert_text_command, classic_error_from_devtools_error,@@ -91,7 +91,7 @@ pub(in crate::protocol_server) async fn webdriver_classic_send_alert_text(Err(error) => return classic_error_into_response(error),};match binding.runtime.execute(command).await {- Ok(DevToolsCommandResult::Empty) => classic_success_into_response(Value::Null),+ Ok(AutomationResult::Empty) => classic_success_into_response(Value::Null),Ok(_) => classic_error_into_response(ClassicError::new(ClassicErrorCode::UnknownError,"send alert text returned an unexpected result",@@ -120,7 +120,7 @@ async fn handle_alert(session_id: String, state: AppState, accept: bool) -> Resp.execute(alert_handle_command(&context, accept)).await{- Ok(DevToolsCommandResult::Empty) => classic_success_into_response(Value::Null),+ Ok(AutomationResult::Empty) => classic_success_into_response(Value::Null),Ok(_) => classic_error_into_response(ClassicError::new(ClassicErrorCode::UnknownError,"handle alert returned an unexpected result",@@ -139,7 +139,7 @@ async fn get_alert_dialog() -> Result<ClassicAlertDialog, ClassicError> {let context = classic_browsing_context(binding);match binding.runtime.execute(alert_text_command(&context)).await {- Ok(DevToolsCommandResult::JavaScriptDialog(result)) => Ok(ClassicAlertDialog {+ Ok(AutomationResult::JavaScriptDialog(result)) => Ok(ClassicAlertDialog {dialog_type: result.dialog_type,message: result.message,}),diff --git a/moli-protocol-server/src/protocol_server/webdriver_classic/cookies.rs b/moli-protocol-server/src/protocol_server/webdriver_classic/cookies.rsindex f97f2805e..9b9211207 100644--- a/moli-protocol-server/src/protocol_server/webdriver_classic/cookies.rs+++ b/moli-protocol-server/src/protocol_server/webdriver_classic/cookies.rs@@ -3,7 +3,7 @@ use axum::{extract::{Path, State},response::Response,};-use moli_protocol::devtools_runtime::DevToolsCommandResult;+use moli_protocol::automation::AutomationResult;use moli_protocol_webdriver_classic::{ClassicDevToolsCommandContext, ClassicError, ClassicErrorCode, add_cookie_command,classic_cookie_by_name, classic_cookies_from_devtools, classic_error_from_devtools_error,@@ -36,7 +36,7 @@ pub(in crate::protocol_server) async fn webdriver_classic_get_cookies(.execute(get_cookies_command(&context, current_url)).await{- Ok(DevToolsCommandResult::GetCookies(result)) => {+ Ok(AutomationResult::GetCookies(result)) => {classic_success_into_response(json!(classic_cookies_from_devtools(result)))}Ok(_) => classic_error_into_response(ClassicError::new(@@ -66,12 +66,10 @@ pub(in crate::protocol_server) async fn webdriver_classic_get_named_cookie(.execute(get_cookies_command(&context, current_url)).await{- Ok(DevToolsCommandResult::GetCookies(result)) => {- match classic_cookie_by_name(result, &name) {- Ok(cookie) => classic_success_into_response(cookie),- Err(error) => classic_error_into_response(error),- }- }+ Ok(AutomationResult::GetCookies(result)) => match classic_cookie_by_name(result, &name) {+ Ok(cookie) => classic_success_into_response(cookie),+ Err(error) => classic_error_into_response(error),+ },Ok(_) => classic_error_into_response(ClassicError::new(ClassicErrorCode::UnknownError,"get cookie returned an unexpected result",@@ -104,10 +102,10 @@ pub(in crate::protocol_server) async fn webdriver_classic_add_cookie(Err(error) => return classic_error_into_response(error),};match binding.runtime.execute(command).await {- Ok(DevToolsCommandResult::SetCookies(result)) if result.success => {+ Ok(AutomationResult::SetCookies(result)) if result.success => {classic_success_into_response(Value::Null)}- Ok(DevToolsCommandResult::SetCookies(_)) => classic_error_into_response(ClassicError::new(+ Ok(AutomationResult::SetCookies(_)) => classic_error_into_response(ClassicError::new(ClassicErrorCode::InvalidCookieDomain,"cookie could not be set for the current document",)),@@ -138,7 +136,7 @@ pub(in crate::protocol_server) async fn webdriver_classic_delete_all_cookies(.execute(delete_all_cookies_command(&context, current_url)).await{- Ok(DevToolsCommandResult::Empty | DevToolsCommandResult::DeleteCookies(_)) => {+ Ok(AutomationResult::Empty | AutomationResult::DeleteCookies(_)) => {classic_success_into_response(Value::Null)}Ok(_) => classic_error_into_response(ClassicError::new(@@ -168,7 +166,7 @@ pub(in crate::protocol_server) async fn webdriver_classic_delete_cookie(.execute(delete_cookie_command(&context, name, current_url)).await{- Ok(DevToolsCommandResult::Empty | DevToolsCommandResult::DeleteCookies(_)) => {+ Ok(AutomationResult::Empty | AutomationResult::DeleteCookies(_)) => {classic_success_into_response(Value::Null)}Ok(_) => classic_error_into_response(ClassicError::new(diff --git a/moli-protocol-server/src/protocol_server/webdriver_classic/script_refs.rs b/moli-protocol-server/src/protocol_server/webdriver_classic/script_refs.rsindex 14e25b494..475ffd918 100644--- a/moli-protocol-server/src/protocol_server/webdriver_classic/script_refs.rs+++ b/moli-protocol-server/src/protocol_server/webdriver_classic/script_refs.rs@@ -1,6 +1,6 @@use std::collections::BTreeMap;-use moli_protocol::devtools_runtime::DevToolsDomNodeReference;+use moli_protocol::automation::DevToolsDomNodeReference;use serde_json::{Map, Value};use super::{@@ -242,7 +242,7 @@ fn backend_node_id_from_described_node(node: &Value) -> Option<u32> {#[cfg(test)]mod tests {- use moli_protocol::devtools_runtime::DevToolsDomNodeReference;+ use moli_protocol::automation::DevToolsDomNodeReference;use serde_json::json;use super::*;diff --git a/moli-protocol-server/src/protocol_server/webdriver_classic/state.rs b/moli-protocol-server/src/protocol_server/webdriver_classic/state.rsindex 02b7b9bb0..5d449ec60 100644--- a/moli-protocol-server/src/protocol_server/webdriver_classic/state.rs+++ b/moli-protocol-server/src/protocol_server/webdriver_classic/state.rs@@ -11,11 +11,11 @@ use moli_cookie_jar::StoredCookie;use moli_core::{page::RendererDocumentLifecycleMilestone, runtime::NavigationRuntimeConfig};use moli_protocol::{CdpInitialStoragePartition, DevToolsPageResidenceIdentity,- devtools_runtime::{- DevToolsCommand, DevToolsCommandContext, DevToolsCommandResult, DevToolsDomNodeReference,+ automation::{+ AutomationCommand, AutomationContext, AutomationResult, DevToolsDomNodeReference,DevToolsError, DevToolsErrorKind, DevToolsFrameId, DevToolsGetFrameOwnerCommand,- DevToolsGetFrameOwnerResult, DevToolsGetFrameTreeCommand, DevToolsProtocol,- DevToolsSessionId, DevToolsTargetId, DevToolsTerminateExecutionCommand,+ DevToolsGetFrameOwnerResult, DevToolsGetFrameTreeCommand, DevToolsSessionId,+ DevToolsTargetId, DevToolsTerminateExecutionCommand, FrontendProtocol,},};use moli_protocol_webdriver_classic::{@@ -30,8 +30,8 @@ use parking_lot::Mutex;use tokio::sync::{mpsc, oneshot};use crate::cdp_scheduler::{- CdpScheduler, CdpSchedulerEventReceivers, DevToolsCommandExecution,- DevToolsPageCommandExecution, ProtocolAdapterScheduler,+ AutomationExecution, AutomationPageExecution, CdpScheduler, CdpSchedulerEventReceivers,+ ProtocolAdapterScheduler,};use super::super::webdriver_bidi::{@@ -392,7 +392,7 @@ impl ClassicSessionManager {&mut self,session_id: &str,context: &ClassicDevToolsCommandContext,- ) -> Result<Vec<DevToolsCommand>, ClassicError> {+ ) -> Result<Vec<AutomationCommand>, ClassicError> {let Some(action_state) = self.registry.action_state_mut(session_id) else {return Err(ClassicError::new(ClassicErrorCode::InvalidSessionId,@@ -495,33 +495,33 @@ impl ClassicSessionRuntimeHandle {pub(super) async fn execute(&self,- command: DevToolsCommand,- ) -> Result<DevToolsCommandResult, DevToolsError> {+ command: AutomationCommand,+ ) -> Result<AutomationResult, DevToolsError> {self.execute_inner(command, None).await}pub(super) async fn execute_inner(&self,- command: DevToolsCommand,+ command: AutomationCommand,timeout: Option<Duration>,- ) -> Result<DevToolsCommandResult, DevToolsError> {+ ) -> Result<AutomationResult, DevToolsError> {self.execute_with_options(command, timeout, None, false).await}pub(super) async fn execute_with_pending_navigation_wait(&self,- command: DevToolsCommand,+ command: AutomationCommand,timeout: Option<Duration>,pending_navigation_timeout: Option<Duration>,- ) -> Result<DevToolsCommandResult, DevToolsError> {+ ) -> Result<AutomationResult, DevToolsError> {self.execute_with_options(command, timeout, pending_navigation_timeout, false).await}pub(super) async fn wait_for_document_lifecycle(&self,- context: DevToolsCommandContext,+ context: AutomationContext,milestone: RendererDocumentLifecycleMilestone,timeout: Option<Duration>,) -> Result<(), DevToolsError> {@@ -549,11 +549,11 @@ impl ClassicSessionRuntimeHandle {async fn execute_with_options(&self,- command: DevToolsCommand,+ command: AutomationCommand,timeout: Option<Duration>,pending_navigation_timeout: Option<Duration>,terminate_execution_on_timeout: bool,- ) -> Result<DevToolsCommandResult, DevToolsError> {+ ) -> Result<AutomationResult, DevToolsError> {self.execute_request(command,timeout,@@ -567,8 +567,8 @@ impl ClassicSessionRuntimeHandle {pub(super) async fn execute_with_page_residence(&self,- command: DevToolsCommand,- ) -> Result<(DevToolsCommandResult, DevToolsPageResidenceIdentity), DevToolsError> {+ command: AutomationCommand,+ ) -> Result<(AutomationResult, DevToolsPageResidenceIdentity), DevToolsError> {let execution = self.execute_request(command, None, None, false, None).await;let result = execution.result?;let page_residence = execution.page_residence.ok_or_else(|| {@@ -582,9 +582,9 @@ impl ClassicSessionRuntimeHandle {pub(super) async fn execute_script_with_page_residence(&self,- command: DevToolsCommand,+ command: AutomationCommand,timeout: Option<Duration>,- ) -> Result<(DevToolsCommandResult, DevToolsPageResidenceIdentity), DevToolsError> {+ ) -> Result<(AutomationResult, DevToolsPageResidenceIdentity), DevToolsError> {let execution = self.execute_request(command, timeout, None, true, None).await;@@ -600,9 +600,9 @@ impl ClassicSessionRuntimeHandle {pub(super) async fn execute_on_page(&self,- command: DevToolsCommand,+ command: AutomationCommand,expected_page: DevToolsPageResidenceIdentity,- ) -> Result<DevToolsCommandResult, DevToolsError> {+ ) -> Result<AutomationResult, DevToolsError> {self.execute_request(command, None, None, false, Some(expected_page)).await.result@@ -610,10 +610,10 @@ impl ClassicSessionRuntimeHandle {pub(super) async fn execute_script_on_page(&self,- command: DevToolsCommand,+ command: AutomationCommand,timeout: Option<Duration>,expected_page: DevToolsPageResidenceIdentity,- ) -> Result<DevToolsCommandResult, DevToolsError> {+ ) -> Result<AutomationResult, DevToolsError> {self.execute_request(command, timeout, None, true, Some(expected_page)).await.result@@ -621,7 +621,7 @@ impl ClassicSessionRuntimeHandle {async fn execute_request(&self,- command: DevToolsCommand,+ command: AutomationCommand,timeout: Option<Duration>,pending_navigation_timeout: Option<Duration>,terminate_execution_on_timeout: bool,@@ -831,7 +831,7 @@ impl ClassicSessionRuntimeHandle {}struct ClassicSessionRuntimeCommandExecution {- result: Result<DevToolsCommandResult, DevToolsError>,+ result: Result<AutomationResult, DevToolsError>,page_residence: Option<DevToolsPageResidenceIdentity>,}@@ -846,7 +846,7 @@ impl ClassicSessionRuntimeCommandExecution {enum ClassicSessionRuntimeRequest {Execute {- command: Box<DevToolsCommand>,+ command: Box<AutomationCommand>,timeout: Option<Duration>,pending_navigation_timeout: Option<Duration>,terminate_execution_on_timeout: bool,@@ -854,7 +854,7 @@ enum ClassicSessionRuntimeRequest {response_tx: oneshot::Sender<ClassicSessionRuntimeCommandExecution>,},WaitForDocumentLifecycle {- context: DevToolsCommandContext,+ context: AutomationContext,milestone: RendererDocumentLifecycleMilestone,timeout: Option<Duration>,response_tx: oneshot::Sender<Result<(), DevToolsError>>,@@ -956,7 +956,7 @@ async fn handle_classic_session_runtime_request(return ClassicSessionRuntimeRequestOutcome::Continue;}let termination_context = command.context().clone();- let mut execution = execute_classic_devtools_command_with_pending_navigation_retry(+ let mut execution = execute_classic_automation_command_with_pending_navigation_retry(scheduler,receivers,*command,@@ -974,10 +974,10 @@ async fn handle_classic_session_runtime_request(// Finish the IO-side termination before the HTTP handler// releases argument handles or admits the next Classic// command on this session.- let termination = execute_classic_devtools_command_once(+ let termination = execute_classic_automation_command_once(scheduler,receivers,- DevToolsCommand::TerminateExecution(DevToolsTerminateExecutionCommand {+ AutomationCommand::TerminateExecution(DevToolsTerminateExecutionCommand {context: termination_context,}),Some(CLASSIC_SCRIPT_TERMINATION_TIMEOUT),@@ -1181,15 +1181,15 @@ async fn handle_classic_session_runtime_request(}}-async fn execute_classic_devtools_command_with_pending_navigation_retry(+async fn execute_classic_automation_command_with_pending_navigation_retry(scheduler: &mut CdpScheduler,receivers: &mut CdpSchedulerEventReceivers,- command: DevToolsCommand,+ command: AutomationCommand,timeout: Option<Duration>,pending_navigation_timeout: Option<Duration>,expected_page: Option<&DevToolsPageResidenceIdentity>,) -> ClassicDevToolsCommandExecution {- let mut execution = execute_classic_devtools_command_once(+ let mut execution = execute_classic_automation_command_once(scheduler,receivers,command.clone(),@@ -1260,7 +1260,7 @@ async fn execute_classic_devtools_command_with_pending_navigation_retry(}None => None,};- let retry = execute_classic_devtools_command_once(+ let retry = execute_classic_automation_command_once(scheduler,receivers,command.clone(),@@ -1277,18 +1277,18 @@ async fn execute_classic_devtools_command_with_pending_navigation_retry(}}-async fn execute_classic_devtools_command_once(+async fn execute_classic_automation_command_once(scheduler: &mut CdpScheduler,receivers: &mut CdpSchedulerEventReceivers,- command: DevToolsCommand,+ command: AutomationCommand,timeout: Option<Duration>,expected_page: Option<&DevToolsPageResidenceIdentity>,) -> ClassicDevToolsCommandExecution {- let DevToolsPageCommandExecution {+ let AutomationPageExecution {execution,page_residence,} = scheduler- .execute_devtools_command_with_external_load_wait_and_page_residence(+ .execute_automation_command_with_external_load_wait_and_page_residence(receivers,command,timeout,@@ -1302,12 +1302,12 @@ async fn execute_classic_devtools_command_once(}struct ClassicDevToolsCommandExecution {- execution: DevToolsCommandExecution,+ execution: AutomationExecution,page_residence: Option<DevToolsPageResidenceIdentity>,}fn classic_runtime_result_is_navigation_changing_document(- result: &Result<DevToolsCommandResult, DevToolsError>,+ result: &Result<AutomationResult, DevToolsError>,) -> bool {matches!(result,@@ -1636,24 +1636,24 @@ async fn classic_frame_owner_reference_on_page(frame_id: &str,expected_page: &DevToolsPageResidenceIdentity,) -> Result<DevToolsGetFrameOwnerResult, DevToolsError> {- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from(session_id)),target_id: Some(DevToolsTargetId::from(target_id)),browser_context_id: None,};ensure_classic_command_page_is_current(scheduler, &context, expected_page)?;match scheduler- .execute_devtools_command_with_external_load_wait(+ .execute_automation_command_with_external_load_wait(receivers,- DevToolsCommand::GetFrameOwner(DevToolsGetFrameOwnerCommand {+ AutomationCommand::GetFrameOwner(DevToolsGetFrameOwnerCommand {context,frame_id: DevToolsFrameId::new(frame_id),}),).await{- Ok(DevToolsCommandResult::GetFrameOwner(owner)) => Ok(owner),+ Ok(AutomationResult::GetFrameOwner(owner)) => Ok(owner),Ok(_) => Err(DevToolsError::new(DevToolsErrorKind::Internal,"UnexpectedFrameOwnerResult",@@ -1710,23 +1710,23 @@ async fn classic_frame_tree(session_id: &str,target_id: &str,) -> Result<serde_json::Value, DevToolsError> {- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from(session_id)),target_id: Some(DevToolsTargetId::from(target_id)),browser_context_id: None,};match scheduler- .execute_devtools_command_with_external_load_wait(+ .execute_automation_command_with_external_load_wait(receivers,- DevToolsCommand::GetFrameTree(DevToolsGetFrameTreeCommand {+ AutomationCommand::GetFrameTree(DevToolsGetFrameTreeCommand {context,max_depth: None,}),).await{- Ok(DevToolsCommandResult::GetFrameTree(result)) => Ok(result.frame_tree),+ Ok(AutomationResult::GetFrameTree(result)) => Ok(result.frame_tree),Ok(_) => Err(DevToolsError::new(DevToolsErrorKind::Internal,"UnexpectedFrameTreeResult",@@ -1742,24 +1742,24 @@ async fn classic_frame_tree_on_page(target_id: &str,expected_page: &DevToolsPageResidenceIdentity,) -> Result<serde_json::Value, DevToolsError> {- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from(session_id)),target_id: Some(DevToolsTargetId::from(target_id)),browser_context_id: None,};ensure_classic_command_page_is_current(scheduler, &context, expected_page)?;match scheduler- .execute_devtools_command_with_external_load_wait(+ .execute_automation_command_with_external_load_wait(receivers,- DevToolsCommand::GetFrameTree(DevToolsGetFrameTreeCommand {+ AutomationCommand::GetFrameTree(DevToolsGetFrameTreeCommand {context,max_depth: None,}),).await{- Ok(DevToolsCommandResult::GetFrameTree(result)) => Ok(result.frame_tree),+ Ok(AutomationResult::GetFrameTree(result)) => Ok(result.frame_tree),Ok(_) => Err(DevToolsError::new(DevToolsErrorKind::Internal,"UnexpectedFrameTreeResult",@@ -1770,7 +1770,7 @@ async fn classic_frame_tree_on_page(fn ensure_classic_command_page_is_current(scheduler: &mut CdpScheduler,- context: &DevToolsCommandContext,+ context: &AutomationContext,expected_page: &DevToolsPageResidenceIdentity,) -> Result<(), DevToolsError> {if scheduler.page_residence_identity_for_devtools_context(context)diff --git a/moli-protocol-server/src/protocol_server/webdriver_classic/window.rs b/moli-protocol-server/src/protocol_server/webdriver_classic/window.rsindex 34af15ed9..ba4e1b4e6 100644--- a/moli-protocol-server/src/protocol_server/webdriver_classic/window.rs+++ b/moli-protocol-server/src/protocol_server/webdriver_classic/window.rs@@ -3,9 +3,7 @@ use axum::{extract::{Path, State},response::Response,};-use moli_protocol::devtools_runtime::{- DevToolsCommand, DevToolsCommandResult, DevToolsScriptResult,-};+use moli_protocol::automation::{AutomationCommand, AutomationResult, DevToolsScriptResult};use moli_protocol_webdriver_classic::{ClassicDevToolsCommandContext, ClassicError, ClassicErrorCode, ClassicWindowRect,ClassicWindowState, classic_error_from_devtools_error, classic_window_rect_for_state,@@ -125,7 +123,7 @@ pub(in crate::protocol_server) async fn webdriver_classic_get_window_handles(.execute(window_handles_command(&context)).await{- Ok(DevToolsCommandResult::GetTargets(result)) => {+ Ok(AutomationResult::GetTargets(result)) => {classic_success_into_response(json!(window_handles_from_targets(result)))}Ok(_) => classic_error_into_response(ClassicError::new(@@ -159,7 +157,7 @@ pub(in crate::protocol_server) async fn webdriver_classic_switch_window(.and_then(serde_json::Value::as_str).expect("switch_window_command validates handle");match binding.runtime.execute(command).await {- Ok(DevToolsCommandResult::Empty) => {+ Ok(AutomationResult::Empty) => {if !state.classic_session_registry.lock()@@ -206,7 +204,7 @@ pub(in crate::protocol_server) async fn webdriver_classic_new_window(let context =ClassicDevToolsCommandContext::with_target_id(&binding.session_id, &binding.target_id);let target_id = match binding.runtime.execute(new_window_command(&context)).await {- Ok(DevToolsCommandResult::CreateTarget(result)) => result.target_id.into_string(),+ Ok(AutomationResult::CreateTarget(result)) => result.target_id.into_string(),Ok(_) => {return classic_error_into_response(ClassicError::new(ClassicErrorCode::UnknownError,@@ -236,8 +234,8 @@ pub(in crate::protocol_server) async fn webdriver_classic_close_window(Err(error) => return classic_error_into_response(error),};match binding.runtime.execute(command).await {- Ok(DevToolsCommandResult::CloseTarget(result)) if result.success => {}- Ok(DevToolsCommandResult::CloseTarget(_)) => {+ Ok(AutomationResult::CloseTarget(result)) if result.success => {}+ Ok(AutomationResult::CloseTarget(_)) => {return classic_error_into_response(ClassicError::new(ClassicErrorCode::UnknownError,"close window failed",@@ -261,7 +259,7 @@ pub(in crate::protocol_server) async fn webdriver_classic_close_window(.execute(window_handles_command(&context)).await{- Ok(DevToolsCommandResult::GetTargets(result)) => window_handles_from_targets(result),+ Ok(AutomationResult::GetTargets(result)) => window_handles_from_targets(result),Ok(_) => {return classic_error_into_response(ClassicError::new(ClassicErrorCode::UnknownError,@@ -312,7 +310,7 @@ async fn classic_current_window_rect(}),)?;match binding.runtime.execute(command).await {- Ok(DevToolsCommandResult::Script(result)) => match *result {+ Ok(AutomationResult::Script(result)) => match *result {DevToolsScriptResult::Value(value) => {let (width, height): (u32, u32) =serde_json::from_value(value.value).map_err(|error| {@@ -368,11 +366,11 @@ async fn classic_apply_window_rect(state: &AppState,binding: &super::state::ClassicSessionBinding,next: ClassicWindowRect,- commands: Vec<DevToolsCommand>,+ commands: Vec<AutomationCommand>,) -> Result<ClassicWindowRect, ClassicError> {for command in commands {match binding.runtime.execute(command).await {- Ok(DevToolsCommandResult::Empty) => {}+ Ok(AutomationResult::Empty) => {}Ok(_) => {return Err(ClassicError::new(ClassicErrorCode::UnknownError,diff --git a/moli-protocol-server/src/protocol_server/webdriver_files.rs b/moli-protocol-server/src/protocol_server/webdriver_files.rsindex a81c096f8..5e8d0c087 100644--- a/moli-protocol-server/src/protocol_server/webdriver_files.rs+++ b/moli-protocol-server/src/protocol_server/webdriver_files.rs@@ -8,7 +8,7 @@ use std::{use base64::{Engine as _, engine::general_purpose::STANDARD as BASE64_STANDARD};use flate2::read::DeflateDecoder;use moli_core::page::SelectedFile;-use moli_protocol::devtools_runtime::{DevToolsError, DevToolsErrorKind};+use moli_protocol::automation::{DevToolsError, DevToolsErrorKind};const MAX_UPLOAD_BYTES: usize = 50 * 1024 * 1024;const MAX_UPLOAD_ZIP_ARCHIVE_BYTES: usize = MAX_UPLOAD_BYTES + 1024 * 1024;diff --git a/moli-protocol-webdriver-bidi/src/browsing_context.rs b/moli-protocol-webdriver-bidi/src/browsing_context.rsindex 6a62c1bb6..f7becb188 100644--- a/moli-protocol-webdriver-bidi/src/browsing_context.rs+++ b/moli-protocol-webdriver-bidi/src/browsing_context.rs@@ -1,4 +1,4 @@-use moli_protocol::devtools_runtime::{+use moli_protocol::automation::{DevToolsBrowserContextId, DevToolsGetFrameTreeResult, DevToolsTargetId, DevToolsTargetInfo,DevToolsTargetKind, TargetLifecycleEvent,};diff --git a/moli-protocol-webdriver-bidi/src/commands.rs b/moli-protocol-webdriver-bidi/src/commands.rsindex 5763ebf3c..e6232901b 100644--- a/moli-protocol-webdriver-bidi/src/commands.rs+++ b/moli-protocol-webdriver-bidi/src/commands.rs@@ -1,10 +1,10 @@use base64::{Engine as _, engine::general_purpose::STANDARD as BASE64_STANDARD};-use moli_protocol::devtools_runtime::{- DevToolsActivateTargetCommand, DevToolsAddNetworkDataCollectorCommand,+use moli_protocol::automation::{+ AutomationCommand, DevToolsActivateTargetCommand, DevToolsAddNetworkDataCollectorCommand,DevToolsAddNetworkInterceptCommand, DevToolsAddPreloadScriptCommand,DevToolsAuthChallengeAction, DevToolsAuthCredentials, DevToolsBrowserContextId,DevToolsCallFunctionCommand, DevToolsCaptureScreenshotClip, DevToolsCaptureScreenshotCommand,- DevToolsCloseTargetCommand, DevToolsCommand, DevToolsContinueInterceptedRequestCommand,+ DevToolsCloseTargetCommand, DevToolsContinueInterceptedRequestCommand,DevToolsContinueInterceptedResponseCommand, DevToolsContinueWithAuthCommand,DevToolsCreateBrowserContextCommand, DevToolsDevicePixelRatioSetting,DevToolsDisownNetworkDataCommand, DevToolsDownloadBehaviorSetting,@@ -42,34 +42,34 @@ const CENTIMETERS_PER_INCH: f64 = 2.54;const MIN_PRINT_PAGE_SIZE_CM: f64 = CENTIMETERS_PER_INCH / 72.0;const MAX_SAFE_INTEGER: i64 = 9_007_199_254_740_991;-pub fn devtools_command_from_bidi_command(+pub fn automation_command_from_bidi_command(command: &BidiCommand,context: &BidiDevToolsCommandContext,-) -> Result<DevToolsCommand, BidiError> {+) -> Result<AutomationCommand, BidiError> {match command.method.as_str() {- "browser.createUserContext" => Ok(DevToolsCommand::CreateBrowserContext(+ "browser.createUserContext" => Ok(AutomationCommand::CreateBrowserContext(bidi_create_user_context_command(command, context)?,)),- "browser.getUserContexts" => Ok(DevToolsCommand::GetBrowserContexts(+ "browser.getUserContexts" => Ok(AutomationCommand::GetBrowserContexts(DevToolsGetBrowserContextsCommand {context: context.command_context(None),},)),- "browser.getClientWindows" => Ok(DevToolsCommand::GetClientWindows(+ "browser.getClientWindows" => Ok(AutomationCommand::GetClientWindows(DevToolsGetClientWindowsCommand {context: context.command_context(None),},)),- "browser.setClientWindowState" => Ok(DevToolsCommand::SetClientWindowState(+ "browser.setClientWindowState" => Ok(AutomationCommand::SetClientWindowState(bidi_set_client_window_state_command(command, context)?,)),- "browser.removeUserContext" => Ok(DevToolsCommand::RemoveBrowserContext(+ "browser.removeUserContext" => Ok(AutomationCommand::RemoveBrowserContext(bidi_remove_user_context_command(command, context)?,)),- "browser.setDownloadBehavior" => Ok(DevToolsCommand::SetDownloadBehavior(+ "browser.setDownloadBehavior" => Ok(AutomationCommand::SetDownloadBehavior(bidi_set_download_behavior_command(command, context)?,)),- "permissions.setPermission" => Ok(DevToolsCommand::SetPermission(+ "permissions.setPermission" => Ok(AutomationCommand::SetPermission(bidi_set_permission_command(command, context)?,)),"browsingContext.create" => {@@ -88,8 +88,8 @@ pub fn devtools_command_from_bidi_command(context,reference_context.as_ref(),)?;- Ok(DevToolsCommand::CreateTarget(- moli_protocol::devtools_runtime::DevToolsCreateTargetCommand {+ Ok(AutomationCommand::CreateTarget(+ moli_protocol::automation::DevToolsCreateTargetCommand {context: context.command_context_with_browser_context_id(reference_context.clone(),browser_context_id.clone(),@@ -103,14 +103,14 @@ pub fn devtools_command_from_bidi_command("browsingContext.close" => {let target_id = required_string(&command.params, "context")?;validate_optional_bool(&command.params, "promptUnload")?;- Ok(DevToolsCommand::CloseTarget(DevToolsCloseTargetCommand {+ Ok(AutomationCommand::CloseTarget(DevToolsCloseTargetCommand {context: context.command_context(Some(DevToolsTargetId::from(target_id))),target_id: DevToolsTargetId::from(target_id),}))}"browsingContext.activate" => {let target_id = required_string(&command.params, "context")?;- Ok(DevToolsCommand::ActivateTarget(+ Ok(AutomationCommand::ActivateTarget(DevToolsActivateTargetCommand {context: context.command_context(Some(DevToolsTargetId::from(target_id))),target_id: DevToolsTargetId::from(target_id),@@ -118,15 +118,15 @@ pub fn devtools_command_from_bidi_command())}"browsingContext.getTree" => bidi_get_tree_command(command, context),- "browsingContext.locateNodes" => Ok(DevToolsCommand::LocateNodes(+ "browsingContext.locateNodes" => Ok(AutomationCommand::LocateNodes(bidi_locate_nodes_command(command, context)?,)),"browsingContext.navigate" => {let target_id = required_string(&command.params, "context")?;let url = required_string(&command.params, "url")?;validate_bidi_navigation_url(url)?;- Ok(DevToolsCommand::Navigate(- moli_protocol::devtools_runtime::DevToolsNavigateCommand {+ Ok(AutomationCommand::Navigate(+ moli_protocol::automation::DevToolsNavigateCommand {context: context.command_context(Some(DevToolsTargetId::from(target_id))),url: url.to_owned(),referrer: None,@@ -136,107 +136,107 @@ pub fn devtools_command_from_bidi_command(}"browsingContext.reload" => {let target_id = required_string(&command.params, "context")?;- Ok(DevToolsCommand::Reload(DevToolsReloadCommand {+ Ok(AutomationCommand::Reload(DevToolsReloadCommand {context: context.command_context(Some(DevToolsTargetId::from(target_id))),ignore_cache: optional_bool(&command.params, "ignoreCache")?.unwrap_or(false),script_to_evaluate_on_load: None,wait: bidi_navigation_wait(command.params.get("wait"))?,}))}- "browsingContext.traverseHistory" => Ok(DevToolsCommand::TraverseHistory(+ "browsingContext.traverseHistory" => Ok(AutomationCommand::TraverseHistory(bidi_traverse_history_command(command, context)?,)),- "browsingContext.handleUserPrompt" => Ok(DevToolsCommand::HandleJavaScriptDialog(+ "browsingContext.handleUserPrompt" => Ok(AutomationCommand::HandleJavaScriptDialog(bidi_handle_user_prompt_command(command, context)?,)),- "browsingContext.captureScreenshot" => Ok(DevToolsCommand::CaptureScreenshot(+ "browsingContext.captureScreenshot" => Ok(AutomationCommand::CaptureScreenshot(bidi_capture_screenshot_command(command, context)?,)),- "browsingContext.print" => Ok(DevToolsCommand::PrintToPdf(bidi_print_command(+ "browsingContext.print" => Ok(AutomationCommand::PrintToPdf(bidi_print_command(command, context,)?)),- "browsingContext.setViewport" => Ok(DevToolsCommand::SetViewport(+ "browsingContext.setViewport" => Ok(AutomationCommand::SetViewport(bidi_set_viewport_command(command, context)?,)),- "emulation.setUserAgentOverride" => Ok(DevToolsCommand::SetUserAgentOverride(+ "emulation.setUserAgentOverride" => Ok(AutomationCommand::SetUserAgentOverride(bidi_set_user_agent_override_command(command, context)?,)),- "emulation.setLocaleOverride" => Ok(DevToolsCommand::SetLocaleOverride(+ "emulation.setLocaleOverride" => Ok(AutomationCommand::SetLocaleOverride(bidi_set_locale_override_command(command, context)?,)),- "emulation.setTimezoneOverride" => Ok(DevToolsCommand::SetTimezoneOverride(+ "emulation.setTimezoneOverride" => Ok(AutomationCommand::SetTimezoneOverride(bidi_set_timezone_override_command(command, context)?,)),- "emulation.setGeolocationOverride" => Ok(DevToolsCommand::SetGeolocationOverride(+ "emulation.setGeolocationOverride" => Ok(AutomationCommand::SetGeolocationOverride(bidi_set_geolocation_override_command(command, context)?,)),- "emulation.setNetworkConditions" => Ok(DevToolsCommand::SetNetworkConditions(+ "emulation.setNetworkConditions" => Ok(AutomationCommand::SetNetworkConditions(bidi_set_network_conditions_command(command, context)?,)),- "network.addIntercept" => Ok(DevToolsCommand::AddNetworkIntercept(+ "network.addIntercept" => Ok(AutomationCommand::AddNetworkIntercept(bidi_network_add_intercept_command(command, context)?,)),- "network.removeIntercept" => Ok(DevToolsCommand::RemoveNetworkIntercept(+ "network.removeIntercept" => Ok(AutomationCommand::RemoveNetworkIntercept(bidi_network_remove_intercept_command(command, context)?,)),- "network.addDataCollector" => Ok(DevToolsCommand::AddNetworkDataCollector(+ "network.addDataCollector" => Ok(AutomationCommand::AddNetworkDataCollector(bidi_network_add_data_collector_command(command, context)?,)),- "network.removeDataCollector" => Ok(DevToolsCommand::RemoveNetworkDataCollector(+ "network.removeDataCollector" => Ok(AutomationCommand::RemoveNetworkDataCollector(bidi_network_remove_data_collector_command(command, context)?,)),- "network.disownData" => Ok(DevToolsCommand::DisownNetworkData(+ "network.disownData" => Ok(AutomationCommand::DisownNetworkData(bidi_network_disown_data_command(command, context)?,)),- "network.getData" => Ok(DevToolsCommand::GetNetworkData(+ "network.getData" => Ok(AutomationCommand::GetNetworkData(bidi_network_get_data_command(command, context)?,)),- "network.setCacheBehavior" => Ok(DevToolsCommand::SetCacheBehavior(+ "network.setCacheBehavior" => Ok(AutomationCommand::SetCacheBehavior(bidi_network_set_cache_behavior_command(command, context)?,)),- "network.setExtraHeaders" => Ok(DevToolsCommand::SetExtraHeaders(+ "network.setExtraHeaders" => Ok(AutomationCommand::SetExtraHeaders(bidi_network_set_extra_headers_command(command, context)?,)),- "network.continueRequest" => Ok(DevToolsCommand::ContinueInterceptedRequest(+ "network.continueRequest" => Ok(AutomationCommand::ContinueInterceptedRequest(bidi_network_continue_request_command(command, context)?,)),- "network.continueResponse" => Ok(DevToolsCommand::ContinueInterceptedResponse(+ "network.continueResponse" => Ok(AutomationCommand::ContinueInterceptedResponse(bidi_network_continue_response_command(command, context)?,)),- "network.continueWithAuth" => Ok(DevToolsCommand::ContinueWithAuth(+ "network.continueWithAuth" => Ok(AutomationCommand::ContinueWithAuth(bidi_network_continue_with_auth_command(command, context)?,)),- "network.failRequest" => Ok(DevToolsCommand::FailInterceptedRequest(+ "network.failRequest" => Ok(AutomationCommand::FailInterceptedRequest(bidi_network_fail_request_command(command, context)?,)),- "network.provideResponse" => Ok(DevToolsCommand::FulfillInterceptedRequest(+ "network.provideResponse" => Ok(AutomationCommand::FulfillInterceptedRequest(bidi_network_provide_response_command(command, context)?,)),- "storage.getCookies" => Ok(DevToolsCommand::GetCookies(bidi_get_cookies_command(+ "storage.getCookies" => Ok(AutomationCommand::GetCookies(bidi_get_cookies_command(command, context,)?)),- "storage.setCookie" => Ok(DevToolsCommand::SetCookies(bidi_set_cookie_command(+ "storage.setCookie" => Ok(AutomationCommand::SetCookies(bidi_set_cookie_command(command, context,)?)),- "storage.deleteCookies" => Ok(DevToolsCommand::DeleteCookies(bidi_delete_cookies_command(- command, context,- )?)),- "script.evaluate" => Ok(DevToolsCommand::EvaluateScript(+ "storage.deleteCookies" => Ok(AutomationCommand::DeleteCookies(+ bidi_delete_cookies_command(command, context)?,+ )),+ "script.evaluate" => Ok(AutomationCommand::EvaluateScript(bidi_evaluate_script_command(command, context)?,)),- "script.callFunction" => Ok(DevToolsCommand::CallFunction(bidi_call_function_command(+ "script.callFunction" => Ok(AutomationCommand::CallFunction(bidi_call_function_command(command, context,)?)),- "script.getRealms" => Ok(DevToolsCommand::GetRealms(bidi_get_realms_command(+ "script.getRealms" => Ok(AutomationCommand::GetRealms(bidi_get_realms_command(command, context,)?)),- "script.disown" => Ok(DevToolsCommand::ReleaseObjects(bidi_disown_command(+ "script.disown" => Ok(AutomationCommand::ReleaseObjects(bidi_disown_command(command, context,)?)),- "script.addPreloadScript" => Ok(DevToolsCommand::AddPreloadScript(+ "script.addPreloadScript" => Ok(AutomationCommand::AddPreloadScript(bidi_add_preload_script_command(command, context)?,)),- "script.removePreloadScript" => Ok(DevToolsCommand::RemovePreloadScript(+ "script.removePreloadScript" => Ok(AutomationCommand::RemovePreloadScript(bidi_remove_preload_script_command(command, context)?,)),method => Err(BidiError::new(BidiErrorCode::UnknownCommand, method)),@@ -1508,16 +1508,18 @@ fn bidi_create_user_context_browser_context_id(fn bidi_get_tree_command(command: &BidiCommand,context: &BidiDevToolsCommandContext,-) -> Result<DevToolsCommand, BidiError> {+) -> Result<AutomationCommand, BidiError> {let root = optional_nullable_string(&command.params, "root")?.map(DevToolsTargetId::from);let max_depth = bidi_get_tree_max_depth(&command.params)?;if let Some(root) = root {- return Ok(DevToolsCommand::GetFrameTree(DevToolsGetFrameTreeCommand {- context: context.command_context(Some(root)),- max_depth,- }));+ return Ok(AutomationCommand::GetFrameTree(+ DevToolsGetFrameTreeCommand {+ context: context.command_context(Some(root)),+ max_depth,+ },+ ));}- Ok(DevToolsCommand::GetFrameTrees(+ Ok(AutomationCommand::GetFrameTrees(DevToolsGetFrameTreesCommand {context: context.command_context(None),max_depth,diff --git a/moli-protocol-webdriver-bidi/src/events.rs b/moli-protocol-webdriver-bidi/src/events.rsindex 0944eb0a6..b6150884e 100644--- a/moli-protocol-webdriver-bidi/src/events.rs+++ b/moli-protocol-webdriver-bidi/src/events.rs@@ -1,6 +1,6 @@use std::time::{SystemTime, UNIX_EPOCH};-use moli_protocol::devtools_runtime::{+use moli_protocol::automation::{AutomationEvent, DevToolsFrameId, DevToolsRealmId, DevToolsStackTrace, LogEntryEvent,PageFileChooserOpenedEvent, PageJavaScriptDialogOpeningEvent, RuntimeConsoleEvent,RuntimeExecutionContextEvent, RuntimeExecutionContextsClearedEvent, ScriptExceptionEvent,@@ -245,7 +245,7 @@ fn browsing_context_context_event(method: &str, params: Value) -> Value {fn browsing_context_navigation_lifecycle_event(method: &str,- event: &moli_protocol::devtools_runtime::NavigationLifecycleEvent,+ event: &moli_protocol::automation::NavigationLifecycleEvent,) -> Option<Value> {Some(browsing_context_navigation_event(method,diff --git a/moli-protocol-webdriver-bidi/src/lib.rs b/moli-protocol-webdriver-bidi/src/lib.rsindex e1ce51f38..9d6f79152 100644--- a/moli-protocol-webdriver-bidi/src/lib.rs+++ b/moli-protocol-webdriver-bidi/src/lib.rs@@ -1,6 +1,6 @@//! WebDriver BiDi protocol adapter surface.//!-//! This crate serializes protocol-neutral `moli-protocol::devtools_runtime`+//! This crate serializes protocol-neutral `moli-protocol::automation`//! events into WebDriver BiDi wire shapes and keeps the connection-local state//! needed to bridge commands until shared protocol owner state fans out events.@@ -14,7 +14,7 @@ mod script_values;mod storage;mod user_context;-pub use commands::devtools_command_from_bidi_command;+pub use commands::automation_command_from_bidi_command;pub use events::{bidi_event_from_automation_event, bidi_event_from_protocol_message, script_realm_created_event,script_realm_destroyed_event,diff --git a/moli-protocol-webdriver-bidi/src/network.rs b/moli-protocol-webdriver-bidi/src/network.rsindex aeeb55c7d..d719d44c6 100644--- a/moli-protocol-webdriver-bidi/src/network.rs+++ b/moli-protocol-webdriver-bidi/src/network.rs@@ -1,6 +1,6 @@use std::collections::{BTreeMap, BTreeSet, VecDeque};-use moli_protocol::devtools_runtime::{+use moli_protocol::automation::{AutomationEvent, DevToolsNetworkInterceptId, NetworkRedirectResponseEvent, NetworkRequestEvent,webdriver_bidi_navigation_id_from_loader_id,};@@ -1183,7 +1183,7 @@ fn json_number_as_u64(value: &Value) -> Option<u64> {#[cfg(test)]mod tests {- use moli_protocol::devtools_runtime::{+ use moli_protocol::automation::{AutomationEvent, DevToolsFrameId, DevToolsLoaderId, DevToolsNetworkInterceptId,DevToolsNetworkResourceType, DevToolsRequestId, DevToolsTargetId, NetworkRequestEvent,};diff --git a/moli-protocol-webdriver-bidi/src/protocol/connection.rs b/moli-protocol-webdriver-bidi/src/protocol/connection.rsindex 9e76baece..e6af75452 100644--- a/moli-protocol-webdriver-bidi/src/protocol/connection.rs+++ b/moli-protocol-webdriver-bidi/src/protocol/connection.rs@@ -1,10 +1,10 @@use std::collections::{BTreeMap, BTreeSet};-use moli_protocol::devtools_runtime::AutomationEvent;+use moli_protocol::automation::AutomationEvent;use serde_json::{Value, json};use crate::commands::{- devtools_command_from_bidi_command, optional_non_empty_string_array,+ automation_command_from_bidi_command, optional_non_empty_string_array,required_non_empty_string_array, required_supported_event_array, unroll_bidi_events,};use crate::events::{@@ -24,7 +24,7 @@ use super::types::{BidiCommand, BidiCommandOutcome, BidiDevToolsCommandContext, BidiDevToolsCommandDispatch,BidiError, BidiErrorCode, BidiInputCommand, BidiInputCommandDispatch, BidiSessionRegistry,BidiSubscription, bidi_event_subscribed_channels, bidi_message_with_channel,- is_devtools_command, is_event_subscribed_by, is_known_session_command, parse_bidi_command,+ is_automation_command, is_event_subscribed_by, is_known_session_command, parse_bidi_command,};#[derive(Debug, Clone, PartialEq, Eq)]@@ -300,7 +300,7 @@ impl BidiConnectionState {"input.performActions" | "input.releaseActions" | "input.setFiles" => {self.dispatch_input_command(command)}- method if is_devtools_command(method) => self.dispatch_devtools_command(command),+ method if is_automation_command(method) => self.dispatch_automation_command(command),method if is_known_session_command(method) => BidiCommandOutcome::respond(error_response(Some(command.id),@@ -319,7 +319,7 @@ impl BidiConnectionState {outcome}- fn dispatch_devtools_command(&self, command: BidiCommand) -> BidiCommandOutcome {+ fn dispatch_automation_command(&self, command: BidiCommand) -> BidiCommandOutcome {let Some(session_id) = self.session_id.as_deref() else {return BidiCommandOutcome::respond(error_response(@@ -331,8 +331,8 @@ impl BidiConnectionState {);};let context = BidiDevToolsCommandContext::new(session_id);- match devtools_command_from_bidi_command(&command, &context) {- Ok(devtools_command) => BidiCommandOutcome {+ match automation_command_from_bidi_command(&command, &context) {+ Ok(automation_command) => BidiCommandOutcome {response: error_response(Some(command.id),BidiErrorCode::UnsupportedOperation,@@ -341,10 +341,10 @@ impl BidiConnectionState {session_id: self.session_id.clone(),channel: None,close_connection: false,- devtools_command: Some(BidiDevToolsCommandDispatch {+ automation_command: Some(BidiDevToolsCommandDispatch {id: command.id,session_id: session_id.to_owned(),- command: devtools_command,+ command: automation_command,}),input_command: None,},@@ -403,7 +403,7 @@ impl BidiConnectionState {session_id: self.session_id.clone(),channel: None,close_connection: false,- devtools_command: None,+ automation_command: None,input_command: Some(BidiInputCommandDispatch {id: command.id,session_id: session_id.to_owned(),diff --git a/moli-protocol-webdriver-bidi/src/protocol/events.rs b/moli-protocol-webdriver-bidi/src/protocol/events.rsindex ea91e4a08..f4508a0aa 100644--- a/moli-protocol-webdriver-bidi/src/protocol/events.rs+++ b/moli-protocol-webdriver-bidi/src/protocol/events.rs@@ -1,6 +1,6 @@use std::collections::{BTreeMap, BTreeSet};-use moli_protocol::devtools_runtime::{+use moli_protocol::automation::{AutomationEvent, NavigationFrameEventKind, webdriver_bidi_navigation_id_from_loader_id,};use serde_json::{Value, json};diff --git a/moli-protocol-webdriver-bidi/src/protocol/mod.rs b/moli-protocol-webdriver-bidi/src/protocol/mod.rsindex d3e6ace58..287fc7c3c 100644--- a/moli-protocol-webdriver-bidi/src/protocol/mod.rs+++ b/moli-protocol-webdriver-bidi/src/protocol/mod.rs@@ -1,7 +1,7 @@//! WebDriver BiDi protocol adapter surface.//!//! This crate is intentionally thin. It serializes protocol-neutral-//! `moli-protocol::devtools_runtime` events into WebDriver BiDi wire shapes and keeps+//! `moli-protocol::automation` events into WebDriver BiDi wire shapes and keeps//! only the connection-local subscription and protocol bridge state needed until//! the shared typed EventHub owns live fan-out.diff --git a/moli-protocol-webdriver-bidi/src/protocol/types.rs b/moli-protocol-webdriver-bidi/src/protocol/types.rsindex d2b7091d0..9d98a5527 100644--- a/moli-protocol-webdriver-bidi/src/protocol/types.rs+++ b/moli-protocol-webdriver-bidi/src/protocol/types.rs@@ -1,8 +1,8 @@use std::collections::{BTreeMap, BTreeSet};-use moli_protocol::devtools_runtime::{- DevToolsBrowserContextId, DevToolsCommand, DevToolsCommandContext, DevToolsProtocol,- DevToolsSessionId, DevToolsTargetId,+use moli_protocol::automation::{+ AutomationCommand, AutomationContext, DevToolsBrowserContextId, DevToolsSessionId,+ DevToolsTargetId, FrontendProtocol,};use serde_json::{Value, json};@@ -104,10 +104,7 @@ impl BidiDevToolsCommandContext {}}- pub(crate) fn command_context(- &self,- target_id: Option<DevToolsTargetId>,- ) -> DevToolsCommandContext {+ pub(crate) fn command_context(&self, target_id: Option<DevToolsTargetId>) -> AutomationContext {self.command_context_with_browser_context_id(target_id,self.browser_context_id@@ -120,9 +117,9 @@ impl BidiDevToolsCommandContext {&self,target_id: Option<DevToolsTargetId>,browser_context_id: Option<DevToolsBrowserContextId>,- ) -> DevToolsCommandContext {- DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ ) -> AutomationContext {+ AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from(self.session_id.as_str())),target_id,browser_context_id,@@ -134,7 +131,7 @@ impl BidiDevToolsCommandContext {pub struct BidiDevToolsCommandDispatch {pub id: u64,pub session_id: String,- pub command: DevToolsCommand,+ pub command: AutomationCommand,}#[derive(Debug, Clone, PartialEq)]@@ -158,7 +155,7 @@ pub struct BidiCommandOutcome {pub session_id: Option<String>,pub channel: Option<String>,pub close_connection: bool,- pub devtools_command: Option<BidiDevToolsCommandDispatch>,+ pub automation_command: Option<BidiDevToolsCommandDispatch>,pub input_command: Option<BidiInputCommandDispatch>,}@@ -222,7 +219,7 @@ impl BidiCommandOutcome {session_id,channel: None,close_connection: false,- devtools_command: None,+ automation_command: None,input_command: None,}}@@ -436,7 +433,7 @@ pub(super) fn is_known_session_command(method: &str) -> bool {)}-pub(super) fn is_devtools_command(method: &str) -> bool {+pub(super) fn is_automation_command(method: &str) -> bool {matches!(method,"browser.createUserContext"diff --git a/moli-protocol-webdriver-bidi/src/responses.rs b/moli-protocol-webdriver-bidi/src/responses.rsindex 612363916..9094864ba 100644--- a/moli-protocol-webdriver-bidi/src/responses.rs+++ b/moli-protocol-webdriver-bidi/src/responses.rs@@ -1,8 +1,8 @@use std::collections::HashSet;use base64::{Engine as _, engine::general_purpose::STANDARD as BASE64_STANDARD};-use moli_protocol::devtools_runtime::{- DevToolsBrowserContextId, DevToolsCommandResult, DevToolsError, DevToolsErrorKind,+use moli_protocol::automation::{+ AutomationResult, DevToolsBrowserContextId, DevToolsError, DevToolsErrorKind,DevToolsNetworkDataBytesType, DevToolsScriptResult, RuntimeConsoleEvent,};use serde_json::{Value, json};@@ -39,11 +39,10 @@ pub fn error_response(id: Option<u64>, code: BidiErrorCode, message: &str) -> Varesponse}-pub fn bidi_response_from_devtools_result(id: u64, result: DevToolsCommandResult) -> Value {+pub fn bidi_response_from_devtools_result(id: u64, result: AutomationResult) -> Value {if matches!(result,- DevToolsCommandResult::ElementClickPreparation(_)- | DevToolsCommandResult::ElementClickDispatch(_)+ AutomationResult::ElementClickPreparation(_) | AutomationResult::ElementClickDispatch(_)) {return error_response(Some(id),@@ -51,14 +50,14 @@ pub fn bidi_response_from_devtools_result(id: u64, result: DevToolsCommandResult"element click results are internal to WebDriver Classic",);}- if matches!(result, DevToolsCommandResult::GetNodeForLocation(_)) {+ if matches!(result, AutomationResult::GetNodeForLocation(_)) {return error_response(Some(id),BidiErrorCode::UnsupportedOperation,"DOM.getNodeForLocation results are not part of the WebDriver BiDi surface",);}- if let DevToolsCommandResult::SetCookies(result) = &result+ if let AutomationResult::SetCookies(result) = &result&& !result.success{return error_response(@@ -78,21 +77,21 @@ pub fn bidi_response_from_devtools_error(id: u64, error: DevToolsError) -> Value)}-fn bidi_result_payload_from_devtools_result(result: DevToolsCommandResult) -> Value {+fn bidi_result_payload_from_devtools_result(result: AutomationResult) -> Value {match result {- DevToolsCommandResult::ElementClickPreparation(_)- | DevToolsCommandResult::ElementClickDispatch(_) => {+ AutomationResult::ElementClickPreparation(_)+ | AutomationResult::ElementClickDispatch(_) => {unreachable!("element click results have no WebDriver BiDi success projection")}- DevToolsCommandResult::Empty | DevToolsCommandResult::TraverseHistory(_) => json!({}),- DevToolsCommandResult::Navigate(result) => json!({+ AutomationResult::Empty | AutomationResult::TraverseHistory(_) => json!({}),+ AutomationResult::Navigate(result) => json!({"navigation": result.navigation_id.map(|navigation_id| Value::String(navigation_id.into_string())).unwrap_or(Value::Null),"url": result.url,}),- DevToolsCommandResult::GetNavigationHistory(result) => json!({+ AutomationResult::GetNavigationHistory(result) => json!({"currentIndex": result.current_index,"entries": result.entries@@ -107,54 +106,52 @@ fn bidi_result_payload_from_devtools_result(result: DevToolsCommandResult) -> Va}).collect::<Vec<_>>(),}),- DevToolsCommandResult::CreateTarget(result) => json!({+ AutomationResult::CreateTarget(result) => json!({"context": result.target_id.into_string(),}),- DevToolsCommandResult::CloseTarget(_) => json!({}),- DevToolsCommandResult::GetTargets(result) => json!({+ AutomationResult::CloseTarget(_) => json!({}),+ AutomationResult::GetTargets(result) => json!({"contexts": result.targets.into_iter().filter_map(bidi_browsing_context_info).collect::<Vec<_>>(),}),- DevToolsCommandResult::ServiceWorkerLogs(result) => json!({+ AutomationResult::ServiceWorkerLogs(result) => json!({"entries": result.entries.into_iter().map(bidi_service_worker_log_entry).collect::<Vec<_>>(),}),- DevToolsCommandResult::ClientWindows(result) => json!({+ AutomationResult::ClientWindows(result) => json!({"clientWindows": result.client_windows.into_iter().map(bidi_client_window_info).collect::<Vec<_>>(),}),- DevToolsCommandResult::ClientWindow(result) => {- bidi_client_window_info(result.client_window)- }- DevToolsCommandResult::CreateBrowserContext(result) => json!({+ AutomationResult::ClientWindow(result) => bidi_client_window_info(result.client_window),+ AutomationResult::CreateBrowserContext(result) => json!({"userContext": result.browser_context_id.into_string(),}),- DevToolsCommandResult::GetBrowserContexts(result) => json!({+ AutomationResult::GetBrowserContexts(result) => json!({"userContexts": bidi_user_contexts_from_browser_contexts(result.browser_context_ids),}),- DevToolsCommandResult::GetFrameTree(result) => json!({+ AutomationResult::GetFrameTree(result) => json!({"contexts": bidi_browsing_context_infos_from_frame_tree_result(&result),}),- DevToolsCommandResult::GetFrameTrees(result) => json!({+ AutomationResult::GetFrameTrees(result) => json!({"contexts": result.frame_trees.iter().flat_map(bidi_browsing_context_infos_from_frame_tree_result).collect::<Vec<_>>(),}),- DevToolsCommandResult::GetTargetInfo(result) => {+ AutomationResult::GetTargetInfo(result) => {bidi_browsing_context_info(result.target_info).unwrap_or_else(|| json!({}))}- DevToolsCommandResult::GetCookies(result) => json!({+ AutomationResult::GetCookies(result) => json!({"cookies": result.cookies.into_iter()@@ -162,22 +159,22 @@ fn bidi_result_payload_from_devtools_result(result: DevToolsCommandResult) -> Va.collect::<Vec<_>>(),"partitionKey": {},}),- DevToolsCommandResult::DeleteCookies(result) => json!({+ AutomationResult::DeleteCookies(result) => json!({"partitionKey": result.partition_key,}),- DevToolsCommandResult::SetCookies(result) => json!({+ AutomationResult::SetCookies(result) => json!({"partitionKey": result.partition_key,}),- DevToolsCommandResult::AddPreloadScript(result) => json!({+ AutomationResult::AddPreloadScript(result) => json!({"script": result.script_id.into_string(),}),- DevToolsCommandResult::AddNetworkIntercept(result) => json!({+ AutomationResult::AddNetworkIntercept(result) => json!({"intercept": result.intercept_id.into_string(),}),- DevToolsCommandResult::AddNetworkDataCollector(result) => json!({+ AutomationResult::AddNetworkDataCollector(result) => json!({"collector": result.collector_id.into_string(),}),- DevToolsCommandResult::NetworkData(result) => json!({+ AutomationResult::NetworkData(result) => json!({"bytes": {"type": match result.bytes_type {DevToolsNetworkDataBytesType::String => "string",@@ -186,10 +183,10 @@ fn bidi_result_payload_from_devtools_result(result: DevToolsCommandResult) -> Va"value": result.value,},}),- DevToolsCommandResult::Realms(result) => json!({+ AutomationResult::Realms(result) => json!({"realms": bidi_script_realm_infos(result.realms),}),- DevToolsCommandResult::Script(result) => match *result {+ AutomationResult::Script(result) => match *result {DevToolsScriptResult::Value(value) => {let realm = value.realm.clone();let mut payload = json!({@@ -230,28 +227,28 @@ fn bidi_result_payload_from_devtools_result(result: DevToolsCommandResult) -> Vapayload}},- DevToolsCommandResult::LocateNodes(result) => json!({+ AutomationResult::LocateNodes(result) => json!({"nodes": result.nodes.into_iter().map(bidi_remote_value_from_devtools).collect::<Vec<_>>(),}),- DevToolsCommandResult::DescribeNode(result) => json!({+ AutomationResult::DescribeNode(result) => json!({"node": result.node,}),- DevToolsCommandResult::GetFrameOwner(result) => json!({+ AutomationResult::GetFrameOwner(result) => json!({"nodeId": result.node_id,"backendNodeId": result.backend_node_id,}),- DevToolsCommandResult::QuerySelector(result) => json!({+ AutomationResult::QuerySelector(result) => json!({"nodeIds": result.node_ids,"multiple": result.multiple,}),- DevToolsCommandResult::ResolveNode(result) => json!({+ AutomationResult::ResolveNode(result) => json!({"object": result.object,}),- DevToolsCommandResult::GetAttributes(result) => json!({+ AutomationResult::GetAttributes(result) => json!({"attributes": result.attributes.into_iter()@@ -261,25 +258,25 @@ fn bidi_result_payload_from_devtools_result(result: DevToolsCommandResult) -> Va})).collect::<Vec<_>>(),}),- DevToolsCommandResult::GetText(result) => json!({+ AutomationResult::GetText(result) => json!({"text": result.text,}),- DevToolsCommandResult::GetProperty(result) => json!({+ AutomationResult::GetProperty(result) => json!({"value": result.value,}),- DevToolsCommandResult::PushNodesByBackendIds(result) => json!({+ AutomationResult::PushNodesByBackendIds(result) => json!({"nodeIds": result.node_ids,}),- DevToolsCommandResult::GetOuterHtml(result) => json!({+ AutomationResult::GetOuterHtml(result) => json!({"outerHTML": result.outer_html,}),// The public projection rejects this CDP-only variant before reaching// the BiDi success mapper. Keep the arm explicit so adding a BiDi// command cannot silently expose a CDP response shape.- DevToolsCommandResult::GetNodeForLocation(_) => unreachable!(+ AutomationResult::GetNodeForLocation(_) => unreachable!("get-node-for-location results must be rejected before BiDi success projection"),- DevToolsCommandResult::DomGeometry(result) => json!({+ AutomationResult::DomGeometry(result) => json!({"quads": result.quads.into_iter()@@ -288,7 +285,7 @@ fn bidi_result_payload_from_devtools_result(result: DevToolsCommandResult) -> Va"width": result.width,"height": result.height,}),- DevToolsCommandResult::LayoutMetrics(result) => json!({+ AutomationResult::LayoutMetrics(result) => json!({"layoutViewport": {"clientWidth": result.layout_viewport_width,"clientHeight": result.layout_viewport_height,@@ -298,12 +295,12 @@ fn bidi_result_payload_from_devtools_result(result: DevToolsCommandResult) -> Va"height": result.content_height,},}),- DevToolsCommandResult::JavaScriptDialog(result) => json!({+ AutomationResult::JavaScriptDialog(result) => json!({"type": result.dialog_type,"message": result.message,"defaultValue": result.default_prompt,}),- DevToolsCommandResult::CaptureScreenshot(result) => json!({+ AutomationResult::CaptureScreenshot(result) => json!({"data": BASE64_STANDARD.encode(result.bytes.as_ref()),}),}@@ -336,7 +333,7 @@ fn bidi_service_worker_log_entry(entry: RuntimeConsoleEvent) -> Value {}fn bidi_script_realm_infos(- realms: Vec<moli_protocol::devtools_runtime::RuntimeExecutionContextEvent>,+ realms: Vec<moli_protocol::automation::RuntimeExecutionContextEvent>,) -> Vec<Value> {let mut realms = realms.into_iter()@@ -372,9 +369,7 @@ fn bidi_realm_string_field<'a>(realm: &'a Value, field: &str) -> &'a str {realm.get(field).and_then(Value::as_str).unwrap_or("")}-fn bidi_client_window_info(- window: moli_protocol::devtools_runtime::DevToolsClientWindowInfo,-) -> Value {+fn bidi_client_window_info(window: moli_protocol::automation::DevToolsClientWindowInfo) -> Value {json!({"clientWindow": window.client_window.into_string(),"active": window.active,diff --git a/moli-protocol-webdriver-bidi/src/script_values.rs b/moli-protocol-webdriver-bidi/src/script_values.rsindex 9bdcb5b2b..8b1f37dca 100644--- a/moli-protocol-webdriver-bidi/src/script_values.rs+++ b/moli-protocol-webdriver-bidi/src/script_values.rs@@ -1,9 +1,9 @@use serde_json::{Value, json};pub(crate) fn bidi_remote_value_from_devtools(- value: moli_protocol::devtools_runtime::DevToolsRemoteValue,+ value: moli_protocol::automation::DevToolsRemoteValue,) -> Value {- let moli_protocol::devtools_runtime::DevToolsRemoteValue {+ let moli_protocol::automation::DevToolsRemoteValue {value,handle,shared_id,diff --git a/moli-protocol-webdriver-bidi/src/storage.rs b/moli-protocol-webdriver-bidi/src/storage.rsindex f5a2abf13..91c3b7458 100644--- a/moli-protocol-webdriver-bidi/src/storage.rs+++ b/moli-protocol-webdriver-bidi/src/storage.rs@@ -1,4 +1,4 @@-use moli_protocol::devtools_runtime::{+use moli_protocol::automation::{DevToolsBrowserContextId, DevToolsCookieFilter, DevToolsCookieParam,DevToolsDeleteCookiesCommand, DevToolsGetCookiesCommand, DevToolsSetCookiesCommand,DevToolsTargetId,diff --git a/moli-protocol-webdriver-bidi/src/tests.rs b/moli-protocol-webdriver-bidi/src/tests.rsindex 436afef9e..7561b92ea 100644--- a/moli-protocol-webdriver-bidi/src/tests.rs+++ b/moli-protocol-webdriver-bidi/src/tests.rs@@ -1,4 +1,4 @@-use moli_protocol::devtools_runtime::{+use moli_protocol::automation::{AutomationEvent, BrowserDownloadProgressEvent, BrowserDownloadWillBeginEvent,DevToolsBrowserContextId, DevToolsFrameId, DevToolsLoaderId, DevToolsNavigationId,DevToolsNetworkInterceptId, DevToolsNetworkResourceType, DevToolsRealmId, DevToolsRemoteValue,@@ -154,7 +154,7 @@ fn assert_bidi_adapter_invalid(method: &str, params: Value) -> String {.expect("BiDi command");let context = super::BidiDevToolsCommandContext::new("bidi-session-1");- let error = super::devtools_command_from_bidi_command(&command, &context)+ let error = super::automation_command_from_bidi_command(&command, &context).expect_err("command should fail validation");assert_eq!(error.code, super::BidiErrorCode::InvalidArgument);diff --git a/moli-protocol-webdriver-bidi/src/tests/browsing_context_commands.rs b/moli-protocol-webdriver-bidi/src/tests/browsing_context_commands.rsindex b4a509503..1e9915dd2 100644--- a/moli-protocol-webdriver-bidi/src/tests/browsing_context_commands.rs+++ b/moli-protocol-webdriver-bidi/src/tests/browsing_context_commands.rs@@ -13,10 +13,10 @@ fn maps_browsing_context_get_tree_null_root_to_shared_get_frame_trees_command().expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::GetFrameTrees(command) = shared else {+ let moli_protocol::automation::AutomationCommand::GetFrameTrees(command) = shared else {panic!("expected GetFrameTrees command");};assert_eq!(command.max_depth, Some(2));@@ -28,15 +28,15 @@ fn maps_browsing_context_navigate_wait_to_shared_navigation_wait() {for (wait, expected) in [("none",- moli_protocol::devtools_runtime::DevToolsNavigationWait::None,+ moli_protocol::automation::DevToolsNavigationWait::None,),("interactive",- moli_protocol::devtools_runtime::DevToolsNavigationWait::DomContentLoaded,+ moli_protocol::automation::DevToolsNavigationWait::DomContentLoaded,),("complete",- moli_protocol::devtools_runtime::DevToolsNavigationWait::Load,+ moli_protocol::automation::DevToolsNavigationWait::Load,),] {let command = super::super::parse_bidi_command(json!({@@ -51,10 +51,10 @@ fn maps_browsing_context_navigate_wait_to_shared_navigation_wait() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::Navigate(command) = shared else {+ let moli_protocol::automation::AutomationCommand::Navigate(command) = shared else {panic!("expected Navigate command");};assert_eq!(command.url, "https://example.test/");@@ -64,7 +64,7 @@ fn maps_browsing_context_navigate_wait_to_shared_navigation_wait() {.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TARGET-1"));}@@ -84,10 +84,10 @@ fn maps_browsing_context_reload_to_shared_reload_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::Reload(command) = shared else {+ let moli_protocol::automation::AutomationCommand::Reload(command) = shared else {panic!("expected Reload command");};assert_eq!(@@ -95,13 +95,13 @@ fn maps_browsing_context_reload_to_shared_reload_command() {.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TARGET-1"));assert!(command.ignore_cache);assert_eq!(command.wait,- moli_protocol::devtools_runtime::DevToolsNavigationWait::Load+ moli_protocol::automation::DevToolsNavigationWait::Load);}@@ -118,10 +118,10 @@ fn maps_browsing_context_traverse_history_to_shared_delta_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::TraverseHistory(command) = shared else {+ let moli_protocol::automation::AutomationCommand::TraverseHistory(command) = shared else {panic!("expected TraverseHistory command");};assert_eq!(@@ -129,16 +129,16 @@ fn maps_browsing_context_traverse_history_to_shared_delta_command() {.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TARGET-1"));assert_eq!(command.destination,- moli_protocol::devtools_runtime::DevToolsHistoryTraversalDestination::Delta(-2)+ moli_protocol::automation::DevToolsHistoryTraversalDestination::Delta(-2));assert_eq!(command.wait,- moli_protocol::devtools_runtime::DevToolsNavigationWait::Load+ moli_protocol::automation::DevToolsNavigationWait::Load);}@@ -159,37 +159,35 @@ fn maps_script_evaluate_context_target_to_shared_evaluate_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::EvaluateScript(command) = shared else {+ let moli_protocol::automation::AutomationCommand::EvaluateScript(command) = shared else {panic!("expected EvaluateScript command");};assert_eq!(command.expression, "globalThis.answer");assert!(command.await_promise);assert_eq!(command.result_ownership,- moli_protocol::devtools_runtime::DevToolsResultOwnership::Root+ moli_protocol::automation::DevToolsResultOwnership::Root);assert_eq!(command.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TARGET-1"));assert!(command.realm_id.is_none());assert!(command.world_name.is_none());assert_eq!(command.serialization_options,- Some(- moli_protocol::devtools_runtime::DevToolsSerializationOptions {- max_object_depth: Some(2),- max_dom_depth: Some(1),- include_shadow_tree: None,- }- )+ Some(moli_protocol::automation::DevToolsSerializationOptions {+ max_object_depth: Some(2),+ max_dom_depth: Some(1),+ include_shadow_tree: None,+ }));}@@ -209,9 +207,9 @@ fn maps_script_user_activation_to_user_gesture_without_rewriting_source() {})).expect("BiDi evaluate command");- let shared = super::super::devtools_command_from_bidi_command(&evaluate, &context)+ let shared = super::super::automation_command_from_bidi_command(&evaluate, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::EvaluateScript(command) = shared else {+ let moli_protocol::automation::AutomationCommand::EvaluateScript(command) = shared else {panic!("expected EvaluateScript command");};assert_eq!(command.expression, "navigator.userActivation.isActive");@@ -230,9 +228,9 @@ fn maps_script_user_activation_to_user_gesture_without_rewriting_source() {})).expect("BiDi callFunction command");- let shared = super::super::devtools_command_from_bidi_command(&call_function, &context)+ let shared = super::super::automation_command_from_bidi_command(&call_function, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::CallFunction(command) = shared else {+ let moli_protocol::automation::AutomationCommand::CallFunction(command) = shared else {panic!("expected CallFunction command");};assert_eq!(@@ -258,15 +256,15 @@ fn maps_script_evaluate_await_promise_default_ownership_preserves_metadata() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::EvaluateScript(command) = shared else {+ let moli_protocol::automation::AutomationCommand::EvaluateScript(command) = shared else {panic!("expected EvaluateScript command");};assert_eq!(command.result_ownership,- moli_protocol::devtools_runtime::DevToolsResultOwnership::None+ moli_protocol::automation::DevToolsResultOwnership::None);assert!(command.preserve_remote_metadata,@@ -290,10 +288,10 @@ fn maps_script_context_sandbox_to_shared_runtime_world() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::EvaluateScript(command) = shared else {+ let moli_protocol::automation::AutomationCommand::EvaluateScript(command) = shared else {panic!("expected EvaluateScript command");};assert_eq!(@@ -301,7 +299,7 @@ fn maps_script_context_sandbox_to_shared_runtime_world() {.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TARGET-1"));assert!(command.realm_id.is_none());@@ -327,21 +325,19 @@ fn maps_script_serialization_options_to_shared_runtime_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::EvaluateScript(command) = shared else {+ let moli_protocol::automation::AutomationCommand::EvaluateScript(command) = shared else {panic!("expected EvaluateScript command");};assert_eq!(command.serialization_options,- Some(- moli_protocol::devtools_runtime::DevToolsSerializationOptions {- max_object_depth: Some(1),- max_dom_depth: None,- include_shadow_tree: Some("open".to_owned()),- }- )+ Some(moli_protocol::automation::DevToolsSerializationOptions {+ max_object_depth: Some(1),+ max_dom_depth: None,+ include_shadow_tree: Some("open".to_owned()),+ }));assert!(command.preserve_remote_metadata,@@ -365,21 +361,19 @@ fn maps_empty_script_serialization_options_to_unbounded_deep_runtime_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::EvaluateScript(command) = shared else {+ let moli_protocol::automation::AutomationCommand::EvaluateScript(command) = shared else {panic!("expected EvaluateScript command");};assert_eq!(command.serialization_options,- Some(- moli_protocol::devtools_runtime::DevToolsSerializationOptions {- max_object_depth: None,- max_dom_depth: None,- include_shadow_tree: None,- }- )+ Some(moli_protocol::automation::DevToolsSerializationOptions {+ max_object_depth: None,+ max_dom_depth: None,+ include_shadow_tree: None,+ }));}@@ -398,24 +392,24 @@ fn maps_script_evaluate_realm_target_to_shared_evaluate_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::EvaluateScript(command) = shared else {+ let moli_protocol::automation::AutomationCommand::EvaluateScript(command) = shared else {panic!("expected EvaluateScript command");};assert_eq!(command.realm_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsRealmId::as_str),+ .map(moli_protocol::automation::DevToolsRealmId::as_str),Some("REALM-1"));assert!(command.context.target_id.is_none());assert!(command.world_name.is_none());assert_eq!(command.result_ownership,- moli_protocol::devtools_runtime::DevToolsResultOwnership::None+ moli_protocol::automation::DevToolsResultOwnership::None);}@@ -441,10 +435,10 @@ fn maps_script_call_function_to_shared_call_function_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::CallFunction(command) = shared else {+ let moli_protocol::automation::AutomationCommand::CallFunction(command) = shared else {panic!("expected CallFunction command");};assert_eq!(command.function_declaration, "(value) => value");@@ -459,19 +453,17 @@ fn maps_script_call_function_to_shared_call_function_command() {.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TARGET-1"));assert!(command.world_name.is_none());assert_eq!(command.serialization_options,- Some(- moli_protocol::devtools_runtime::DevToolsSerializationOptions {- max_object_depth: Some(2),- max_dom_depth: Some(1),- include_shadow_tree: None,- }- )+ Some(moli_protocol::automation::DevToolsSerializationOptions {+ max_object_depth: Some(2),+ max_dom_depth: Some(1),+ include_shadow_tree: None,+ }));assert!(command.preserve_remote_metadata,@@ -502,10 +494,10 @@ fn maps_browsing_context_locate_nodes_to_shared_runtime_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::LocateNodes(command) = shared else {+ let moli_protocol::automation::AutomationCommand::LocateNodes(command) = shared else {panic!("expected LocateNodes command");};assert_eq!(@@ -513,7 +505,7 @@ fn maps_browsing_context_locate_nodes_to_shared_runtime_command() {.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TARGET-1"));assert_eq!(command.max_node_count, Some(3));@@ -526,10 +518,10 @@ fn maps_browsing_context_locate_nodes_to_shared_runtime_command() {);assert!(matches!(command.locator,- moli_protocol::devtools_runtime::DevToolsLocateNodesLocator::InnerText {+ moli_protocol::automation::DevToolsLocateNodesLocator::InnerText {ref value,ignore_case: true,- match_type: moli_protocol::devtools_runtime::DevToolsLocateNodesTextMatch::Partial,+ match_type: moli_protocol::automation::DevToolsLocateNodesTextMatch::Partial,max_depth: 2,} if value == "Foo"));@@ -553,10 +545,10 @@ fn maps_browsing_context_locate_nodes_context_locator_to_shared_runtime_command(.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::LocateNodes(command) = shared else {+ let moli_protocol::automation::AutomationCommand::LocateNodes(command) = shared else {panic!("expected LocateNodes command");};assert_eq!(@@ -564,12 +556,12 @@ fn maps_browsing_context_locate_nodes_context_locator_to_shared_runtime_command(.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("PARENT-1"));assert!(matches!(command.locator,- moli_protocol::devtools_runtime::DevToolsLocateNodesLocator::Context(ref context)+ moli_protocol::automation::DevToolsLocateNodesLocator::Context(ref context)if context.as_str() == "CHILD-1"));}@@ -596,7 +588,7 @@ fn rejects_browsing_context_locate_nodes_context_locator_start_nodes() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let error = super::super::devtools_command_from_bidi_command(&command, &context)+ let error = super::super::automation_command_from_bidi_command(&command, &context).expect_err("context locator startNodes should fail validation");assert_eq!(error.code, super::super::BidiErrorCode::InvalidArgument);@@ -615,10 +607,10 @@ fn maps_script_get_realms_to_shared_get_realms_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::GetRealms(command) = shared else {+ let moli_protocol::automation::AutomationCommand::GetRealms(command) = shared else {panic!("expected GetRealms command");};assert_eq!(@@ -626,7 +618,7 @@ fn maps_script_get_realms_to_shared_get_realms_command() {.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TARGET-1"));assert_eq!(command.realm_type.as_deref(), Some("window"));@@ -645,10 +637,10 @@ fn maps_script_get_realms_to_service_worker_target_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::GetRealms(command) = shared else {+ let moli_protocol::automation::AutomationCommand::GetRealms(command) = shared else {panic!("expected GetRealms command");};assert_eq!(@@ -656,7 +648,7 @@ fn maps_script_get_realms_to_service_worker_target_command() {.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TID-service-worker"));assert_eq!(command.realm_type.as_deref(), Some("service-worker"));@@ -677,24 +669,24 @@ fn maps_script_disown_to_shared_release_objects_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::ReleaseObjects(command) = shared else {+ let moli_protocol::automation::AutomationCommand::ReleaseObjects(command) = shared else {panic!("expected ReleaseObjects command");};assert_eq!(command.realm_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsRealmId::as_str),+ .map(moli_protocol::automation::DevToolsRealmId::as_str),Some("REALM-1"));assert_eq!(command.handles.iter()- .map(moli_protocol::devtools_runtime::DevToolsRemoteHandleId::as_str)+ .map(moli_protocol::automation::DevToolsRemoteHandleId::as_str).collect::<Vec<_>>(),vec!["HANDLE-1", "HANDLE-2"]);@@ -730,15 +722,15 @@ fn maps_storage_cookie_commands_to_shared_storage_commands() {})).expect("BiDi storage.setCookie command");let shared =- super::super::devtools_command_from_bidi_command(&set, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetCookies(set) = shared else {+ super::super::automation_command_from_bidi_command(&set, &context).expect("shared command");+ let moli_protocol::automation::AutomationCommand::SetCookies(set) = shared else {panic!("expected SetCookies command");};assert_eq!(set.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TARGET-1"));assert_eq!(set.cookies.len(), 1);@@ -773,8 +765,8 @@ fn maps_storage_cookie_commands_to_shared_storage_commands() {})).expect("BiDi storage.getCookies command");let shared =- super::super::devtools_command_from_bidi_command(&get, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::GetCookies(get) = shared else {+ super::super::automation_command_from_bidi_command(&get, &context).expect("shared command");+ let moli_protocol::automation::AutomationCommand::GetCookies(get) = shared else {panic!("expected GetCookies command");};let filter = get.filter.expect("cookie filter");@@ -800,9 +792,9 @@ fn maps_storage_cookie_commands_to_shared_storage_commands() {}})).expect("BiDi storage.deleteCookies command");- let shared = super::super::devtools_command_from_bidi_command(&delete, &context)+ let shared = super::super::automation_command_from_bidi_command(&delete, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::DeleteCookies(delete) = shared else {+ let moli_protocol::automation::AutomationCommand::DeleteCookies(delete) = shared else {panic!("expected DeleteCookies command");};assert_eq!(delete.name.as_deref(), Some("sid"));@@ -839,21 +831,21 @@ fn maps_chromium_wpt_storage_base64_and_partition_descriptors() {})).expect("BiDi storage.setCookie command");let shared =- super::super::devtools_command_from_bidi_command(&set, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetCookies(set) = shared else {+ super::super::automation_command_from_bidi_command(&set, &context).expect("shared command");+ let moli_protocol::automation::AutomationCommand::SetCookies(set) = shared else {panic!("expected SetCookies command");};assert_eq!(set.browser_context_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsBrowserContextId::as_str),+ .map(moli_protocol::automation::DevToolsBrowserContextId::as_str),Some("BID-2"));assert_eq!(set.context.browser_context_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsBrowserContextId::as_str),+ .map(moli_protocol::automation::DevToolsBrowserContextId::as_str),Some("BID-2"));assert_eq!(set.cookies[0].value, "abc");@@ -870,10 +862,9 @@ fn maps_chromium_wpt_storage_base64_and_partition_descriptors() {}})).expect("BiDi storage.getCookies command");- let shared = super::super::devtools_command_from_bidi_command(&default_partition, &context)+ let shared = super::super::automation_command_from_bidi_command(&default_partition, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::GetCookies(default_partition) = shared- else {+ let moli_protocol::automation::AutomationCommand::GetCookies(default_partition) = shared else {panic!("expected GetCookies command");};assert_eq!(default_partition.browser_context_id, None);@@ -891,15 +882,15 @@ fn maps_chromium_wpt_storage_base64_and_partition_descriptors() {})).expect("BiDi storage.getCookies command");let shared =- super::super::devtools_command_from_bidi_command(&get, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::GetCookies(get) = shared else {+ super::super::automation_command_from_bidi_command(&get, &context).expect("shared command");+ let moli_protocol::automation::AutomationCommand::GetCookies(get) = shared else {panic!("expected GetCookies command");};assert_eq!(get.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TARGET-2"));@@ -921,16 +912,16 @@ fn maps_chromium_wpt_storage_base64_and_partition_descriptors() {}})).expect("BiDi storage.deleteCookies command");- let shared = super::super::devtools_command_from_bidi_command(&delete, &context)+ let shared = super::super::automation_command_from_bidi_command(&delete, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::DeleteCookies(delete) = shared else {+ let moli_protocol::automation::AutomationCommand::DeleteCookies(delete) = shared else {panic!("expected DeleteCookies command");};assert_eq!(delete.browser_context_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsBrowserContextId::as_str),+ .map(moli_protocol::automation::DevToolsBrowserContextId::as_str),Some("BID-3"));let filter = delete.filter.expect("delete filter");@@ -953,7 +944,7 @@ fn rejects_script_disown_non_string_handles() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let error = super::super::devtools_command_from_bidi_command(&command, &context)+ let error = super::super::automation_command_from_bidi_command(&command, &context).expect_err("non-string handles should be rejected");assert_eq!(error.code, super::super::BidiErrorCode::InvalidArgument);@@ -964,19 +955,15 @@ fn rejects_script_disown_non_string_handles() {fn serializes_get_realms_result_to_bidi_realm_list() {let response = super::super::bidi_response_from_devtools_result(9,- moli_protocol::devtools_runtime::DevToolsCommandResult::Realms(- moli_protocol::devtools_runtime::DevToolsGetRealmsResult {+ moli_protocol::automation::AutomationResult::Realms(+ moli_protocol::automation::DevToolsGetRealmsResult {realms: vec![RuntimeExecutionContextEvent {- target_id: Some(moli_protocol::devtools_runtime::DevToolsTargetId::from(+ target_id: Some(moli_protocol::automation::DevToolsTargetId::from("TARGET-1",)),context_id: Some(3),- realm_id: Some(moli_protocol::devtools_runtime::DevToolsRealmId::from(- "REALM-1",- )),- frame_id: Some(moli_protocol::devtools_runtime::DevToolsFrameId::from(- "TARGET-1",- )),+ realm_id: Some(moli_protocol::automation::DevToolsRealmId::from("REALM-1")),+ frame_id: Some(moli_protocol::automation::DevToolsFrameId::from("TARGET-1")),origin: Some("https://example.test".to_owned()),name: Some(String::new()),is_default: Some(true),@@ -1008,14 +995,14 @@ fn serializes_get_realms_result_to_bidi_realm_list() {fn serializes_get_realms_result_to_service_worker_bidi_realm() {let response = super::super::bidi_response_from_devtools_result(92,- moli_protocol::devtools_runtime::DevToolsCommandResult::Realms(- moli_protocol::devtools_runtime::DevToolsGetRealmsResult {+ moli_protocol::automation::AutomationResult::Realms(+ moli_protocol::automation::DevToolsGetRealmsResult {realms: vec![RuntimeExecutionContextEvent {- target_id: Some(moli_protocol::devtools_runtime::DevToolsTargetId::from(+ target_id: Some(moli_protocol::automation::DevToolsTargetId::from("TID-service-worker",)),context_id: Some(20_000_007),- realm_id: Some(moli_protocol::devtools_runtime::DevToolsRealmId::from(+ realm_id: Some(moli_protocol::automation::DevToolsRealmId::from("service-worker-TID-service-worker",)),frame_id: None,@@ -1049,18 +1036,18 @@ fn serializes_get_realms_result_to_service_worker_bidi_realm() {fn serializes_get_realms_default_window_realm_before_sandbox_realm() {let response = super::super::bidi_response_from_devtools_result(91,- moli_protocol::devtools_runtime::DevToolsCommandResult::Realms(- moli_protocol::devtools_runtime::DevToolsGetRealmsResult {+ moli_protocol::automation::AutomationResult::Realms(+ moli_protocol::automation::DevToolsGetRealmsResult {realms: vec![RuntimeExecutionContextEvent {- target_id: Some(moli_protocol::devtools_runtime::DevToolsTargetId::from(+ target_id: Some(moli_protocol::automation::DevToolsTargetId::from("TARGET-1",)),context_id: Some(5),- realm_id: Some(moli_protocol::devtools_runtime::DevToolsRealmId::from(+ realm_id: Some(moli_protocol::automation::DevToolsRealmId::from("REALM-SANDBOX",)),- frame_id: Some(moli_protocol::devtools_runtime::DevToolsFrameId::from(+ frame_id: Some(moli_protocol::automation::DevToolsFrameId::from("child-browsing-context-1",)),origin: Some("https://not-web-platform.test:8443".to_owned()),@@ -1070,14 +1057,14 @@ fn serializes_get_realms_default_window_realm_before_sandbox_realm() {grant_universal_access: None,},RuntimeExecutionContextEvent {- target_id: Some(moli_protocol::devtools_runtime::DevToolsTargetId::from(+ target_id: Some(moli_protocol::automation::DevToolsTargetId::from("TARGET-1",)),context_id: Some(4),- realm_id: Some(moli_protocol::devtools_runtime::DevToolsRealmId::from(+ realm_id: Some(moli_protocol::automation::DevToolsRealmId::from("REALM-DEFAULT",)),- frame_id: Some(moli_protocol::devtools_runtime::DevToolsFrameId::from(+ frame_id: Some(moli_protocol::automation::DevToolsFrameId::from("child-browsing-context-1",)),origin: Some("https://not-web-platform.test:8443".to_owned()),@@ -1139,13 +1126,13 @@ fn maps_script_add_preload_script_to_shared_preload_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::AddPreloadScript(command) = shared else {+ let moli_protocol::automation::AutomationCommand::AddPreloadScript(command) = shared else {panic!("expected AddPreloadScript command");};- let moli_protocol::devtools_runtime::DevToolsPreloadScriptSource::FunctionDeclaration {+ let moli_protocol::automation::DevToolsPreloadScriptSource::FunctionDeclaration {function_declaration,arguments,} = command.source@@ -1163,14 +1150,14 @@ fn maps_script_add_preload_script_to_shared_preload_command() {.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TARGET-1"));assert_eq!(command.target_ids.as_ref().map(|target_ids| {target_ids.iter()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str)+ .map(moli_protocol::automation::DevToolsTargetId::as_str).collect::<Vec<_>>()}),Some(vec!["TARGET-1"])@@ -1191,10 +1178,10 @@ fn maps_browsing_context_handle_user_prompt_to_shared_page_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::HandleJavaScriptDialog(command) = shared+ let moli_protocol::automation::AutomationCommand::HandleJavaScriptDialog(command) = sharedelse {panic!("expected HandleJavaScriptDialog command");};@@ -1203,7 +1190,7 @@ fn maps_browsing_context_handle_user_prompt_to_shared_page_command() {.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TARGET-1"));assert!(command.accept);@@ -1233,11 +1220,10 @@ fn maps_browsing_context_capture_screenshot_to_shared_page_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::CaptureScreenshot(command) = shared- else {+ let moli_protocol::automation::AutomationCommand::CaptureScreenshot(command) = shared else {panic!("expected CaptureScreenshot command");};assert_eq!(command.quality, Some(60));@@ -1248,10 +1234,10 @@ fn maps_browsing_context_capture_screenshot_to_shared_page_command() {.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TARGET-1"));- let moli_protocol::devtools_runtime::DevToolsCaptureScreenshotClip::Box(clip) =+ let moli_protocol::automation::DevToolsCaptureScreenshotClip::Box(clip) =command.clip.expect("box clip should map")else {panic!("expected box clip");@@ -1281,14 +1267,13 @@ fn maps_browsing_context_capture_screenshot_element_clip_to_shared_page_command(.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::CaptureScreenshot(command) = shared- else {+ let moli_protocol::automation::AutomationCommand::CaptureScreenshot(command) = shared else {panic!("expected CaptureScreenshot command");};- let moli_protocol::devtools_runtime::DevToolsCaptureScreenshotClip::Element(clip) =+ let moli_protocol::automation::DevToolsCaptureScreenshotClip::Element(clip) =command.clip.expect("element clip should map")else {panic!("expected element clip");@@ -1323,10 +1308,10 @@ fn maps_browsing_context_print_to_shared_page_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::PrintToPdf(command) = shared else {+ let moli_protocol::automation::AutomationCommand::PrintToPdf(command) = shared else {panic!("expected PrintToPdf command");};assert_eq!(@@ -1334,7 +1319,7 @@ fn maps_browsing_context_print_to_shared_page_command() {.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TARGET-1"));assert_eq!(command.landscape, Some(true));@@ -1344,7 +1329,7 @@ fn maps_browsing_context_print_to_shared_page_command() {assert_eq!(command.shrink_to_fit, Some(false));assert_eq!(command.transfer_mode,- Some(moli_protocol::devtools_runtime::DevToolsPrintToPdfTransferMode::ReturnAsBase64)+ Some(moli_protocol::automation::DevToolsPrintToPdfTransferMode::ReturnAsBase64));assert!((command.margin_top.unwrap() - (1.0 / 2.54)).abs() < 1e-12);assert!((command.margin_bottom.unwrap() - (2.0 / 2.54)).abs() < 1e-12);@@ -1358,9 +1343,9 @@ fn maps_browsing_context_print_to_shared_page_command() {fn serializes_network_data_result_to_bidi_bytes_payload() {let response = super::super::bidi_response_from_devtools_result(10,- moli_protocol::devtools_runtime::DevToolsCommandResult::NetworkData(- moli_protocol::devtools_runtime::DevToolsNetworkDataResult {- bytes_type: moli_protocol::devtools_runtime::DevToolsNetworkDataBytesType::String,+ moli_protocol::automation::AutomationResult::NetworkData(+ moli_protocol::automation::DevToolsNetworkDataResult {+ bytes_type: moli_protocol::automation::DevToolsNetworkDataBytesType::String,value: "body text".to_owned(),},),@@ -1382,9 +1367,9 @@ fn serializes_network_data_result_to_bidi_bytes_payload() {let response = super::super::bidi_response_from_devtools_result(11,- moli_protocol::devtools_runtime::DevToolsCommandResult::NetworkData(- moli_protocol::devtools_runtime::DevToolsNetworkDataResult {- bytes_type: moli_protocol::devtools_runtime::DevToolsNetworkDataBytesType::Base64,+ moli_protocol::automation::AutomationResult::NetworkData(+ moli_protocol::automation::DevToolsNetworkDataResult {+ bytes_type: moli_protocol::automation::DevToolsNetworkDataBytesType::Base64,value: "AP8=".to_owned(),},),@@ -1416,10 +1401,10 @@ fn maps_browsing_context_set_viewport_to_shared_emulation_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetViewport(command) = shared else {+ let moli_protocol::automation::AutomationCommand::SetViewport(command) = shared else {panic!("expected SetViewport command");};assert_eq!(@@ -1427,19 +1412,19 @@ fn maps_browsing_context_set_viewport_to_shared_emulation_command() {.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TARGET-1"));assert_eq!(command.viewport,- moli_protocol::devtools_runtime::DevToolsViewportSetting::Dimensions {+ moli_protocol::automation::DevToolsViewportSetting::Dimensions {width: 800,height: 600,});assert_eq!(command.device_pixel_ratio,- moli_protocol::devtools_runtime::DevToolsDevicePixelRatioSetting::Scale(2.0)+ moli_protocol::automation::DevToolsDevicePixelRatioSetting::Scale(2.0));}@@ -1459,10 +1444,10 @@ fn maps_browsing_context_set_viewport_user_contexts_without_id_format_guessing().expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetViewport(command) = shared else {+ let moli_protocol::automation::AutomationCommand::SetViewport(command) = shared else {panic!("expected SetViewport command");};assert_eq!(command.context.target_id, None);@@ -1470,7 +1455,7 @@ fn maps_browsing_context_set_viewport_user_contexts_without_id_format_guessing()command.browser_context_ids.iter()- .map(moli_protocol::devtools_runtime::DevToolsBrowserContextId::as_str)+ .map(moli_protocol::automation::DevToolsBrowserContextId::as_str).collect::<Vec<_>>(),vec!["custom-user-context"]);@@ -1490,19 +1475,19 @@ fn maps_browsing_context_set_viewport_nulls_to_default_settings() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetViewport(command) = shared else {+ let moli_protocol::automation::AutomationCommand::SetViewport(command) = shared else {panic!("expected SetViewport command");};assert_eq!(command.viewport,- moli_protocol::devtools_runtime::DevToolsViewportSetting::Default+ moli_protocol::automation::DevToolsViewportSetting::Default);assert_eq!(command.device_pixel_ratio,- moli_protocol::devtools_runtime::DevToolsDevicePixelRatioSetting::Default+ moli_protocol::automation::DevToolsDevicePixelRatioSetting::Default);}@@ -1518,11 +1503,10 @@ fn maps_emulation_set_user_agent_override_global_to_shared_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetUserAgentOverride(command) = shared- else {+ let moli_protocol::automation::AutomationCommand::SetUserAgentOverride(command) = shared else {panic!("expected SetUserAgentOverride command");};assert!(command.target_ids.is_empty());@@ -1533,7 +1517,7 @@ fn maps_emulation_set_user_agent_override_global_to_shared_command() {.context.session_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsSessionId::as_str),+ .map(moli_protocol::automation::DevToolsSessionId::as_str),Some("bidi-session-1"));}@@ -1551,18 +1535,17 @@ fn maps_emulation_set_user_agent_override_contexts_to_shared_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetUserAgentOverride(command) = shared- else {+ let moli_protocol::automation::AutomationCommand::SetUserAgentOverride(command) = shared else {panic!("expected SetUserAgentOverride command");};assert_eq!(command.target_ids.iter()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str)+ .map(moli_protocol::automation::DevToolsTargetId::as_str).collect::<Vec<_>>(),vec!["TARGET-1", "TARGET-2"]);@@ -1583,11 +1566,10 @@ fn maps_emulation_set_user_agent_override_user_contexts_to_shared_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetUserAgentOverride(command) = shared- else {+ let moli_protocol::automation::AutomationCommand::SetUserAgentOverride(command) = shared else {panic!("expected SetUserAgentOverride command");};assert!(command.target_ids.is_empty());@@ -1595,7 +1577,7 @@ fn maps_emulation_set_user_agent_override_user_contexts_to_shared_command() {command.browser_context_ids.iter()- .map(moli_protocol::devtools_runtime::DevToolsBrowserContextId::as_str)+ .map(moli_protocol::automation::DevToolsBrowserContextId::as_str).collect::<Vec<_>>(),vec!["default", "custom-user-context"]);@@ -1615,18 +1597,17 @@ fn maps_emulation_set_locale_override_contexts_to_shared_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetLocaleOverride(command) = shared- else {+ let moli_protocol::automation::AutomationCommand::SetLocaleOverride(command) = shared else {panic!("expected SetLocaleOverride command");};assert_eq!(command.target_ids.iter()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str)+ .map(moli_protocol::automation::DevToolsTargetId::as_str).collect::<Vec<_>>(),vec!["TARGET-1", "TARGET-2"]);@@ -1647,11 +1628,10 @@ fn maps_emulation_set_locale_override_user_contexts_to_shared_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetLocaleOverride(command) = shared- else {+ let moli_protocol::automation::AutomationCommand::SetLocaleOverride(command) = shared else {panic!("expected SetLocaleOverride command");};assert!(command.target_ids.is_empty());@@ -1659,7 +1639,7 @@ fn maps_emulation_set_locale_override_user_contexts_to_shared_command() {command.browser_context_ids.iter()- .map(moli_protocol::devtools_runtime::DevToolsBrowserContextId::as_str)+ .map(moli_protocol::automation::DevToolsBrowserContextId::as_str).collect::<Vec<_>>(),vec!["default", "custom-user-context"]);@@ -1679,18 +1659,17 @@ fn maps_emulation_set_timezone_override_contexts_to_shared_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetTimezoneOverride(command) = shared- else {+ let moli_protocol::automation::AutomationCommand::SetTimezoneOverride(command) = shared else {panic!("expected SetTimezoneOverride command");};assert_eq!(command.target_ids.iter()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str)+ .map(moli_protocol::automation::DevToolsTargetId::as_str).collect::<Vec<_>>(),vec!["TARGET-1"]);@@ -1711,11 +1690,10 @@ fn maps_emulation_set_timezone_override_user_contexts_to_shared_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetTimezoneOverride(command) = shared- else {+ let moli_protocol::automation::AutomationCommand::SetTimezoneOverride(command) = shared else {panic!("expected SetTimezoneOverride command");};assert!(command.target_ids.is_empty());@@ -1723,7 +1701,7 @@ fn maps_emulation_set_timezone_override_user_contexts_to_shared_command() {command.browser_context_ids.iter()- .map(moli_protocol::devtools_runtime::DevToolsBrowserContextId::as_str)+ .map(moli_protocol::automation::DevToolsBrowserContextId::as_str).collect::<Vec<_>>(),vec!["custom-user-context"]);@@ -1744,18 +1722,17 @@ fn maps_emulation_set_network_conditions_global_to_shared_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetNetworkConditions(command) = shared- else {+ let moli_protocol::automation::AutomationCommand::SetNetworkConditions(command) = shared else {panic!("expected SetNetworkConditions command");};assert!(command.target_ids.is_empty());assert!(command.browser_context_ids.is_empty());assert_eq!(command.network_conditions,- Some(moli_protocol::devtools_runtime::DevToolsNetworkConditions::offline())+ Some(moli_protocol::automation::DevToolsNetworkConditions::offline()));}@@ -1774,25 +1751,24 @@ fn maps_emulation_set_network_conditions_contexts_to_shared_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetNetworkConditions(command) = shared- else {+ let moli_protocol::automation::AutomationCommand::SetNetworkConditions(command) = shared else {panic!("expected SetNetworkConditions command");};assert_eq!(command.target_ids.iter()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str)+ .map(moli_protocol::automation::DevToolsTargetId::as_str).collect::<Vec<_>>(),vec!["TARGET-1", "TARGET-2"]);assert!(command.browser_context_ids.is_empty());assert_eq!(command.network_conditions,- Some(moli_protocol::devtools_runtime::DevToolsNetworkConditions::offline())+ Some(moli_protocol::automation::DevToolsNetworkConditions::offline()));}@@ -1809,11 +1785,10 @@ fn maps_emulation_set_network_conditions_user_contexts_reset_to_shared_command().expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetNetworkConditions(command) = shared- else {+ let moli_protocol::automation::AutomationCommand::SetNetworkConditions(command) = shared else {panic!("expected SetNetworkConditions command");};assert!(command.target_ids.is_empty());@@ -1821,7 +1796,7 @@ fn maps_emulation_set_network_conditions_user_contexts_reset_to_shared_command()command.browser_context_ids.iter()- .map(moli_protocol::devtools_runtime::DevToolsBrowserContextId::as_str)+ .map(moli_protocol::automation::DevToolsBrowserContextId::as_str).collect::<Vec<_>>(),vec!["default", "custom-user-context"]);@@ -1844,10 +1819,10 @@ fn maps_permissions_set_permission_to_shared_browser_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetPermission(command) = shared else {+ let moli_protocol::automation::AutomationCommand::SetPermission(command) = shared else {panic!("expected SetPermission command");};assert_eq!(command.permission, json!({ "name": "storage-access" }));@@ -1861,7 +1836,7 @@ fn maps_permissions_set_permission_to_shared_browser_command() {command.browser_context_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsBrowserContextId::as_str),+ .map(moli_protocol::automation::DevToolsBrowserContextId::as_str),Some("BID-default"));}@@ -1886,10 +1861,10 @@ fn maps_emulation_set_geolocation_override_coordinates_to_shared_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetGeolocationOverride(command) = shared+ let moli_protocol::automation::AutomationCommand::SetGeolocationOverride(command) = sharedelse {panic!("expected SetGeolocationOverride command");};@@ -1897,13 +1872,13 @@ fn maps_emulation_set_geolocation_override_coordinates_to_shared_command() {command.target_ids.iter()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str)+ .map(moli_protocol::automation::DevToolsTargetId::as_str).collect::<Vec<_>>(),vec!["TARGET-1"]);assert!(command.browser_context_ids.is_empty());let override_state = command.override_state.expect("coordinates override");- let moli_protocol::devtools_runtime::DevToolsGeolocationOverrideState::Position(override_state) =+ let moli_protocol::automation::DevToolsGeolocationOverrideState::Position(override_state) =override_stateelse {panic!("expected coordinates override");@@ -1932,9 +1907,7 @@ fn maps_emulation_set_geolocation_override_reset_and_error_to_distinct_shared_st"contexts": ["TARGET-1"],"error": { "type": "positionUnavailable" }}),- Some(- moli_protocol::devtools_runtime::DevToolsGeolocationOverrideState::PositionUnavailable,- ),+ Some(moli_protocol::automation::DevToolsGeolocationOverrideState::PositionUnavailable),),] {let command = super::super::parse_bidi_command(json!({@@ -1945,11 +1918,10 @@ fn maps_emulation_set_geolocation_override_reset_and_error_to_distinct_shared_st.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared =- super::super::devtools_command_from_bidi_command(&command, &context).expect("shared command");+ let shared = super::super::automation_command_from_bidi_command(&command, &context)+ .expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetGeolocationOverride(command) =- shared+ let moli_protocol::automation::AutomationCommand::SetGeolocationOverride(command) = sharedelse {panic!("expected SetGeolocationOverride command");};@@ -1984,9 +1956,9 @@ fn timezone_adapter_defers_name_validation_to_native_environment_controller() {})).expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetTimezoneOverride(command) = shared+ let moli_protocol::automation::AutomationCommand::SetTimezoneOverride(command) = sharedelse {panic!("expected SetTimezoneOverride command");};@@ -2006,11 +1978,10 @@ fn maps_script_remove_preload_script_to_shared_preload_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::RemovePreloadScript(command) = shared- else {+ let moli_protocol::automation::AutomationCommand::RemovePreloadScript(command) = shared else {panic!("expected RemovePreloadScript command");};assert_eq!(command.script_id.as_str(), "SCRIPT-1");@@ -2019,7 +1990,7 @@ fn maps_script_remove_preload_script_to_shared_preload_command() {.context.session_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsSessionId::as_str),+ .map(moli_protocol::automation::DevToolsSessionId::as_str),Some("bidi-session-1"));}@@ -2062,7 +2033,7 @@ fn rejects_chromium_wpt_invalid_emulation_set_user_agent_override_params() {})).expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let error = super::super::devtools_command_from_bidi_command(&command, &context)+ let error = super::super::automation_command_from_bidi_command(&command, &context).expect_err("empty userAgent should fail validation");assert_eq!(error.code,diff --git a/moli-protocol-webdriver-bidi/src/tests/log_and_runtime_events.rs b/moli-protocol-webdriver-bidi/src/tests/log_and_runtime_events.rsindex ab4bbe241..340e5ee05 100644--- a/moli-protocol-webdriver-bidi/src/tests/log_and_runtime_events.rs+++ b/moli-protocol-webdriver-bidi/src/tests/log_and_runtime_events.rs@@ -605,15 +605,13 @@ fn session_unsubscribe_subscription_ids_take_precedence_over_events() {fn serializes_devtools_navigate_result_to_bidi_response() {let response = super::super::bidi_response_from_devtools_result(7,- moli_protocol::devtools_runtime::DevToolsCommandResult::Navigate(- moli_protocol::devtools_runtime::DevToolsNavigateResult {- navigation_id: Some(moli_protocol::devtools_runtime::DevToolsNavigationId::from(+ moli_protocol::automation::AutomationResult::Navigate(+ moli_protocol::automation::DevToolsNavigateResult {+ navigation_id: Some(moli_protocol::automation::DevToolsNavigationId::from("NAV-1",)),- frame_id: Some(moli_protocol::devtools_runtime::DevToolsFrameId::from(- "FRAME-1",- )),- loader_id: Some(moli_protocol::devtools_runtime::DevToolsLoaderId::from(+ frame_id: Some(moli_protocol::automation::DevToolsFrameId::from("FRAME-1")),+ loader_id: Some(moli_protocol::automation::DevToolsLoaderId::from("LOADER-1",)),url: "https://example.test/".to_owned(),@@ -634,8 +632,8 @@ fn serializes_devtools_navigate_result_to_bidi_response() {fn projects_screenshot_bytes_as_bidi_base64_data() {let response = super::super::bidi_response_from_devtools_result(8,- moli_protocol::devtools_runtime::DevToolsCommandResult::CaptureScreenshot(- moli_protocol::devtools_runtime::DevToolsCaptureScreenshotResult {+ moli_protocol::automation::AutomationResult::CaptureScreenshot(+ moli_protocol::automation::DevToolsCaptureScreenshotResult {mime_type: "image/png".to_owned(),width: 1,height: 1,@@ -653,10 +651,10 @@ fn projects_screenshot_bytes_as_bidi_base64_data() {fn rejects_cdp_node_for_location_result_at_bidi_projection_boundary() {let response = super::super::bidi_response_from_devtools_result(9,- moli_protocol::devtools_runtime::DevToolsCommandResult::GetNodeForLocation(- moli_protocol::devtools_runtime::DevToolsGetNodeForLocationResult {+ moli_protocol::automation::AutomationResult::GetNodeForLocation(+ moli_protocol::automation::DevToolsGetNodeForLocationResult {backend_node_id: 42,- frame_id: moli_protocol::devtools_runtime::DevToolsFrameId::from("FRAME-1"),+ frame_id: moli_protocol::automation::DevToolsFrameId::from("FRAME-1"),node_id: Some(7),},),@@ -671,9 +669,9 @@ fn rejects_cdp_node_for_location_result_at_bidi_projection_boundary() {fn serializes_browser_user_context_results_to_bidi_response() {let create = super::super::bidi_response_from_devtools_result(8,- moli_protocol::devtools_runtime::DevToolsCommandResult::CreateBrowserContext(- moli_protocol::devtools_runtime::DevToolsCreateBrowserContextResult {- browser_context_id: moli_protocol::devtools_runtime::DevToolsBrowserContextId::from(+ moli_protocol::automation::AutomationResult::CreateBrowserContext(+ moli_protocol::automation::DevToolsCreateBrowserContextResult {+ browser_context_id: moli_protocol::automation::DevToolsBrowserContextId::from("user-context-1",),},@@ -684,14 +682,12 @@ fn serializes_browser_user_context_results_to_bidi_response() {let get = super::super::bidi_response_from_devtools_result(9,- moli_protocol::devtools_runtime::DevToolsCommandResult::GetBrowserContexts(- moli_protocol::devtools_runtime::DevToolsGetBrowserContextsResult {+ moli_protocol::automation::AutomationResult::GetBrowserContexts(+ moli_protocol::automation::DevToolsGetBrowserContextsResult {browser_context_ids: vec![- moli_protocol::devtools_runtime::DevToolsBrowserContextId::from("BID-default"),- moli_protocol::devtools_runtime::DevToolsBrowserContextId::from("BID-2"),- moli_protocol::devtools_runtime::DevToolsBrowserContextId::from(- "user-context-1",- ),+ moli_protocol::automation::DevToolsBrowserContextId::from("BID-default"),+ moli_protocol::automation::DevToolsBrowserContextId::from("BID-2"),+ moli_protocol::automation::DevToolsBrowserContextId::from("user-context-1"),],},),@@ -709,20 +705,18 @@ fn serializes_browser_user_context_results_to_bidi_response() {fn serializes_devtools_script_value_to_bidi_remote_value() {let response = super::super::bidi_response_from_devtools_result(8,- moli_protocol::devtools_runtime::DevToolsCommandResult::Script(Box::new(- moli_protocol::devtools_runtime::DevToolsScriptResult::Value(- moli_protocol::devtools_runtime::DevToolsRemoteValue {+ moli_protocol::automation::AutomationResult::Script(Box::new(+ moli_protocol::automation::DevToolsScriptResult::Value(+ moli_protocol::automation::DevToolsRemoteValue {value: json!("Moli"),- handle: Some(- moli_protocol::devtools_runtime::DevToolsRemoteHandleId::from("HANDLE-1"),- ),+ handle: Some(moli_protocol::automation::DevToolsRemoteHandleId::from(+ "HANDLE-1",+ )),shared_id: None,node_id: None,backend_node_id: None,window_context: None,- realm: Some(moli_protocol::devtools_runtime::DevToolsRealmId::from(- "REALM-1",- )),+ realm: Some(moli_protocol::automation::DevToolsRealmId::from("REALM-1")),remote_type: None,remote_subtype: None,unserializable_value: None,@@ -748,13 +742,13 @@ fn serializes_devtools_script_value_to_bidi_remote_value() {fn serializes_devtools_deep_serialized_value_to_bidi_remote_value() {let response = super::super::bidi_response_from_devtools_result(9,- moli_protocol::devtools_runtime::DevToolsCommandResult::Script(Box::new(- moli_protocol::devtools_runtime::DevToolsScriptResult::Value(- moli_protocol::devtools_runtime::DevToolsRemoteValue {+ moli_protocol::automation::AutomationResult::Script(Box::new(+ moli_protocol::automation::DevToolsScriptResult::Value(+ moli_protocol::automation::DevToolsRemoteValue {value: json!({}),- handle: Some(- moli_protocol::devtools_runtime::DevToolsRemoteHandleId::from("HANDLE-2"),- ),+ handle: Some(moli_protocol::automation::DevToolsRemoteHandleId::from(+ "HANDLE-2",+ )),shared_id: None,node_id: None,backend_node_id: None,@@ -799,8 +793,8 @@ fn serializes_devtools_deep_serialized_value_to_bidi_remote_value() {fn serializes_storage_cookie_results_to_bidi_cookie_shape() {let response = super::super::bidi_response_from_devtools_result(19,- moli_protocol::devtools_runtime::DevToolsCommandResult::GetCookies(- moli_protocol::devtools_runtime::DevToolsGetCookiesResult {+ moli_protocol::automation::AutomationResult::GetCookies(+ moli_protocol::automation::DevToolsGetCookiesResult {cookies: vec![json!({"name": "sid","value": "abc",@@ -846,8 +840,8 @@ fn serializes_storage_cookie_results_to_bidi_cookie_shape() {fn serializes_failed_storage_set_cookie_to_bidi_error() {let response = super::super::bidi_response_from_devtools_result(20,- moli_protocol::devtools_runtime::DevToolsCommandResult::SetCookies(- moli_protocol::devtools_runtime::DevToolsSetCookiesResult {+ moli_protocol::automation::AutomationResult::SetCookies(+ moli_protocol::automation::DevToolsSetCookiesResult {success: false,cookie_reports: vec![json!({"rejectionReasons": ["DomainMismatch"]@@ -866,9 +860,9 @@ fn serializes_failed_storage_set_cookie_to_bidi_error() {fn serializes_devtools_create_target_result_to_bidi_response() {let response = super::super::bidi_response_from_devtools_result(11,- moli_protocol::devtools_runtime::DevToolsCommandResult::CreateTarget(- moli_protocol::devtools_runtime::DevToolsCreateTargetResult {- target_id: moli_protocol::devtools_runtime::DevToolsTargetId::from("TARGET-1"),+ moli_protocol::automation::AutomationResult::CreateTarget(+ moli_protocol::automation::DevToolsCreateTargetResult {+ target_id: moli_protocol::automation::DevToolsTargetId::from("TARGET-1"),},),);@@ -882,8 +876,8 @@ fn serializes_devtools_create_target_result_to_bidi_response() {fn serializes_devtools_close_target_result_to_empty_bidi_response() {let response = super::super::bidi_response_from_devtools_result(12,- moli_protocol::devtools_runtime::DevToolsCommandResult::CloseTarget(- moli_protocol::devtools_runtime::DevToolsCloseTargetResult { success: true },+ moli_protocol::automation::AutomationResult::CloseTarget(+ moli_protocol::automation::DevToolsCloseTargetResult { success: true },),);@@ -896,30 +890,28 @@ fn serializes_devtools_close_target_result_to_empty_bidi_response() {fn serializes_devtools_get_targets_result_to_bidi_contexts() {let response = super::super::bidi_response_from_devtools_result(14,- moli_protocol::devtools_runtime::DevToolsCommandResult::GetTargets(- moli_protocol::devtools_runtime::DevToolsGetTargetsResult {+ moli_protocol::automation::AutomationResult::GetTargets(+ moli_protocol::automation::DevToolsGetTargetsResult {targets: vec![- moli_protocol::devtools_runtime::DevToolsTargetInfo {- target_id: Some(moli_protocol::devtools_runtime::DevToolsTargetId::from(+ moli_protocol::automation::DevToolsTargetInfo {+ target_id: Some(moli_protocol::automation::DevToolsTargetId::from("TARGET-1",)),- kind: moli_protocol::devtools_runtime::DevToolsTargetKind::Page,+ kind: moli_protocol::automation::DevToolsTargetKind::Page,title: "Title".to_owned(),url: "https://example.test/".to_owned(),attached: true,- opener_id: Some(moli_protocol::devtools_runtime::DevToolsTargetId::from(+ opener_id: Some(moli_protocol::automation::DevToolsTargetId::from("OPENER-1",)),opener_frame_id: None,can_access_opener: true,browser_context_id: Some(- moli_protocol::devtools_runtime::DevToolsBrowserContextId::from(- "BID-1",- ),+ moli_protocol::automation::DevToolsBrowserContextId::from("BID-1"),),moli_popup_id: None,},- moli_protocol::devtools_runtime::DevToolsTargetInfo {+ moli_protocol::automation::DevToolsTargetInfo {target_id: Some(DevToolsTargetId::from("WORKER-1")),kind: DevToolsTargetKind::Worker,title: "dedicated worker".to_owned(),@@ -931,7 +923,7 @@ fn serializes_devtools_get_targets_result_to_bidi_contexts() {browser_context_id: None,moli_popup_id: None,},- moli_protocol::devtools_runtime::DevToolsTargetInfo {+ moli_protocol::automation::DevToolsTargetInfo {target_id: Some(DevToolsTargetId::from("TAB-TARGET-1")),kind: DevToolsTargetKind::Tab,title: String::new(),@@ -1003,26 +995,26 @@ fn serializes_devtools_client_windows_result_to_bidi_response() {// webdriver/tests/bidi/browser/get_client_windows/get_client_windows.py.let response = super::super::bidi_response_from_devtools_result(15,- moli_protocol::devtools_runtime::DevToolsCommandResult::ClientWindows(- moli_protocol::devtools_runtime::DevToolsGetClientWindowsResult {+ moli_protocol::automation::AutomationResult::ClientWindows(+ moli_protocol::automation::DevToolsGetClientWindowsResult {client_windows: vec![- moli_protocol::devtools_runtime::DevToolsClientWindowInfo {- client_window: moli_protocol::devtools_runtime::DevToolsTargetId::from(+ moli_protocol::automation::DevToolsClientWindowInfo {+ client_window: moli_protocol::automation::DevToolsTargetId::from("WINDOW-1",),active: true,- state: moli_protocol::devtools_runtime::DevToolsWindowState::Normal,+ state: moli_protocol::automation::DevToolsWindowState::Normal,width: 800,height: 600,x: 10,y: 20,},- moli_protocol::devtools_runtime::DevToolsClientWindowInfo {- client_window: moli_protocol::devtools_runtime::DevToolsTargetId::from(+ moli_protocol::automation::DevToolsClientWindowInfo {+ client_window: moli_protocol::automation::DevToolsTargetId::from("WINDOW-2",),active: false,- state: moli_protocol::devtools_runtime::DevToolsWindowState::Minimized,+ state: moli_protocol::automation::DevToolsWindowState::Minimized,width: 0,height: 0,x: 0,@@ -1068,13 +1060,13 @@ fn serializes_devtools_client_windows_result_to_bidi_response() {fn serializes_devtools_get_target_info_result_to_single_bidi_context() {let response = super::super::bidi_response_from_devtools_result(15,- moli_protocol::devtools_runtime::DevToolsCommandResult::GetTargetInfo(- moli_protocol::devtools_runtime::DevToolsGetTargetInfoResult {- target_info: moli_protocol::devtools_runtime::DevToolsTargetInfo {- target_id: Some(moli_protocol::devtools_runtime::DevToolsTargetId::from(+ moli_protocol::automation::AutomationResult::GetTargetInfo(+ moli_protocol::automation::DevToolsGetTargetInfoResult {+ target_info: moli_protocol::automation::DevToolsTargetInfo {+ target_id: Some(moli_protocol::automation::DevToolsTargetId::from("TARGET-1",)),- kind: moli_protocol::devtools_runtime::DevToolsTargetKind::Page,+ kind: moli_protocol::automation::DevToolsTargetKind::Page,title: String::new(),url: "https://example.test/".to_owned(),attached: true,@@ -1099,8 +1091,8 @@ fn serializes_devtools_get_target_info_result_to_single_bidi_context() {fn serializes_devtools_get_target_info_result_to_service_worker_bidi_context() {let response = super::super::bidi_response_from_devtools_result(16,- moli_protocol::devtools_runtime::DevToolsCommandResult::GetTargetInfo(- moli_protocol::devtools_runtime::DevToolsGetTargetInfoResult {+ moli_protocol::automation::AutomationResult::GetTargetInfo(+ moli_protocol::automation::DevToolsGetTargetInfoResult {target_info: service_worker_target_info(),},),@@ -1128,8 +1120,8 @@ fn serializes_devtools_get_target_info_result_to_service_worker_bidi_context() {fn serializes_devtools_get_target_info_result_to_shared_worker_bidi_context() {let response = super::super::bidi_response_from_devtools_result(16,- moli_protocol::devtools_runtime::DevToolsCommandResult::GetTargetInfo(- moli_protocol::devtools_runtime::DevToolsGetTargetInfoResult {+ moli_protocol::automation::AutomationResult::GetTargetInfo(+ moli_protocol::automation::DevToolsGetTargetInfoResult {target_info: shared_worker_target_info(),},),@@ -1157,41 +1149,39 @@ fn serializes_devtools_get_target_info_result_to_shared_worker_bidi_context() {fn serializes_devtools_get_frame_trees_result_to_bidi_contexts_with_children() {let response = super::super::bidi_response_from_devtools_result(16,- moli_protocol::devtools_runtime::DevToolsCommandResult::GetFrameTrees(- moli_protocol::devtools_runtime::DevToolsGetFrameTreesResult {- frame_trees: vec![- moli_protocol::devtools_runtime::DevToolsGetFrameTreeResult {- frame_tree: json!({- "frame": {- "id": "TARGET-1",- "url": "https://example.test/"- },- "childFrames": [- {- "frame": {- "id": "IFRAME-1",- "url": "https://example.test/frame.html"- }+ moli_protocol::automation::AutomationResult::GetFrameTrees(+ moli_protocol::automation::DevToolsGetFrameTreesResult {+ frame_trees: vec![moli_protocol::automation::DevToolsGetFrameTreeResult {+ frame_tree: json!({+ "frame": {+ "id": "TARGET-1",+ "url": "https://example.test/"+ },+ "childFrames": [+ {+ "frame": {+ "id": "IFRAME-1",+ "url": "https://example.test/frame.html"}- ]- }),- target_info: Some(moli_protocol::devtools_runtime::DevToolsTargetInfo {- target_id: Some(- moli_protocol::devtools_runtime::DevToolsTargetId::from("TARGET-1"),- ),- kind: moli_protocol::devtools_runtime::DevToolsTargetKind::Page,- title: String::new(),- url: "https://example.test/".to_owned(),- attached: true,- opener_id: None,- opener_frame_id: None,- can_access_opener: false,- browser_context_id: None,- moli_popup_id: None,- }),- max_depth: None,- },- ],+ }+ ]+ }),+ target_info: Some(moli_protocol::automation::DevToolsTargetInfo {+ target_id: Some(moli_protocol::automation::DevToolsTargetId::from(+ "TARGET-1",+ )),+ kind: moli_protocol::automation::DevToolsTargetKind::Page,+ title: String::new(),+ url: "https://example.test/".to_owned(),+ attached: true,+ opener_id: None,+ opener_frame_id: None,+ can_access_opener: false,+ browser_context_id: None,+ moli_popup_id: None,+ }),+ max_depth: None,+ }],},),);@@ -1216,20 +1206,18 @@ fn serializes_devtools_get_frame_trees_result_to_bidi_contexts_with_children() {fn serializes_devtools_get_frame_trees_result_to_service_worker_bidi_context() {let response = super::super::bidi_response_from_devtools_result(17,- moli_protocol::devtools_runtime::DevToolsCommandResult::GetFrameTrees(- moli_protocol::devtools_runtime::DevToolsGetFrameTreesResult {- frame_trees: vec![- moli_protocol::devtools_runtime::DevToolsGetFrameTreeResult {- frame_tree: json!({- "frame": {- "id": "TID-service-worker",- "url": "https://example.test/service-worker.js"- }- }),- target_info: Some(service_worker_target_info()),- max_depth: None,- },- ],+ moli_protocol::automation::AutomationResult::GetFrameTrees(+ moli_protocol::automation::DevToolsGetFrameTreesResult {+ frame_trees: vec![moli_protocol::automation::DevToolsGetFrameTreeResult {+ frame_tree: json!({+ "frame": {+ "id": "TID-service-worker",+ "url": "https://example.test/service-worker.js"+ }+ }),+ target_info: Some(service_worker_target_info()),+ max_depth: None,+ }],},),);@@ -1255,11 +1243,9 @@ fn serializes_devtools_get_frame_trees_result_to_service_worker_bidi_context() {fn serializes_devtools_add_preload_script_result_to_bidi_response() {let response = super::super::bidi_response_from_devtools_result(13,- moli_protocol::devtools_runtime::DevToolsCommandResult::AddPreloadScript(- moli_protocol::devtools_runtime::DevToolsAddPreloadScriptResult {- script_id: moli_protocol::devtools_runtime::DevToolsPreloadScriptId::from(- "SCRIPT-1",- ),+ moli_protocol::automation::AutomationResult::AddPreloadScript(+ moli_protocol::automation::DevToolsAddPreloadScriptResult {+ script_id: moli_protocol::automation::DevToolsPreloadScriptId::from("SCRIPT-1"),},),);@@ -1273,14 +1259,14 @@ fn serializes_devtools_add_preload_script_result_to_bidi_response() {fn serializes_devtools_script_exception_to_bidi_exception_result() {let response = super::super::bidi_response_from_devtools_result(9,- moli_protocol::devtools_runtime::DevToolsCommandResult::Script(Box::new(- moli_protocol::devtools_runtime::DevToolsScriptResult::Exception(- moli_protocol::devtools_runtime::DevToolsScriptException {+ moli_protocol::automation::AutomationResult::Script(Box::new(+ moli_protocol::automation::DevToolsScriptResult::Exception(+ moli_protocol::automation::DevToolsScriptException {exception_id: Some(7),script_id: None,text: "boom".to_owned(),value: Some(- moli_protocol::devtools_runtime::DevToolsRemoteValue::from_json_value(+ moli_protocol::automation::DevToolsRemoteValue::from_json_value(json!({"name": "Error"}),),),@@ -1310,8 +1296,8 @@ fn serializes_devtools_script_exception_to_bidi_exception_result() {fn serializes_devtools_error_to_bidi_error_response() {let response = super::super::bidi_response_from_devtools_error(10,- moli_protocol::devtools_runtime::DevToolsError::new(- moli_protocol::devtools_runtime::DevToolsErrorKind::NoSuchTarget,+ moli_protocol::automation::DevToolsError::new(+ moli_protocol::automation::DevToolsErrorKind::NoSuchTarget,"target not found",),);@@ -1326,8 +1312,8 @@ fn serializes_devtools_error_to_bidi_error_response() {fn serializes_internal_navigation_failure_to_bidi_unknown_error() {let response = super::super::bidi_response_from_devtools_error(18,- moli_protocol::devtools_runtime::DevToolsError::new(- moli_protocol::devtools_runtime::DevToolsErrorKind::Internal,+ moli_protocol::automation::DevToolsError::new(+ moli_protocol::automation::DevToolsErrorKind::Internal,"Navigation to a local file URL requires an explicitly granted browser capability.",),);@@ -1348,8 +1334,8 @@ fn serializes_internal_navigation_failure_to_bidi_unknown_error() {fn serializes_devtools_no_such_handle_to_bidi_error_response() {let response = super::super::bidi_response_from_devtools_error(11,- moli_protocol::devtools_runtime::DevToolsError::new(- moli_protocol::devtools_runtime::DevToolsErrorKind::NoSuchHandle,+ moli_protocol::automation::DevToolsError::new(+ moli_protocol::automation::DevToolsErrorKind::NoSuchHandle,"Cannot find object with given id",),);@@ -1367,8 +1353,8 @@ fn serializes_devtools_no_such_handle_to_bidi_error_response() {fn serializes_devtools_no_such_script_to_bidi_error_response() {let response = super::super::bidi_response_from_devtools_error(12,- moli_protocol::devtools_runtime::DevToolsError::new(- moli_protocol::devtools_runtime::DevToolsErrorKind::NoSuchScript,+ moli_protocol::automation::DevToolsError::new(+ moli_protocol::automation::DevToolsErrorKind::NoSuchScript,"NoSuchScript",),);@@ -1383,8 +1369,8 @@ fn serializes_devtools_no_such_script_to_bidi_error_response() {fn serializes_devtools_no_such_history_entry_to_bidi_error_response() {let response = super::super::bidi_response_from_devtools_error(13,- moli_protocol::devtools_runtime::DevToolsError::new(- moli_protocol::devtools_runtime::DevToolsErrorKind::NoSuchHistoryEntry,+ moli_protocol::automation::DevToolsError::new(+ moli_protocol::automation::DevToolsErrorKind::NoSuchHistoryEntry,"NoSuchHistoryEntry",),);@@ -1399,8 +1385,8 @@ fn serializes_devtools_no_such_history_entry_to_bidi_error_response() {fn serializes_devtools_no_such_request_to_bidi_error_response() {let response = super::super::bidi_response_from_devtools_error(15,- moli_protocol::devtools_runtime::DevToolsError::new(- moli_protocol::devtools_runtime::DevToolsErrorKind::NoSuchRequest,+ moli_protocol::automation::DevToolsError::new(+ moli_protocol::automation::DevToolsErrorKind::NoSuchRequest,"RequestNotFound",),);@@ -1415,8 +1401,8 @@ fn serializes_devtools_no_such_request_to_bidi_error_response() {fn serializes_devtools_network_data_errors_to_bidi_error_response() {let response = super::super::bidi_response_from_devtools_error(16,- moli_protocol::devtools_runtime::DevToolsError::new(- moli_protocol::devtools_runtime::DevToolsErrorKind::NoSuchNetworkData,+ moli_protocol::automation::DevToolsError::new(+ moli_protocol::automation::DevToolsErrorKind::NoSuchNetworkData,"no such network data",),);@@ -1427,8 +1413,8 @@ fn serializes_devtools_network_data_errors_to_bidi_error_response() {let response = super::super::bidi_response_from_devtools_error(17,- moli_protocol::devtools_runtime::DevToolsError::new(- moli_protocol::devtools_runtime::DevToolsErrorKind::NoSuchNetworkCollector,+ moli_protocol::automation::DevToolsError::new(+ moli_protocol::automation::DevToolsErrorKind::NoSuchNetworkCollector,"no such network collector",),);@@ -1442,8 +1428,8 @@ fn serializes_devtools_network_data_errors_to_bidi_error_response() {fn serializes_devtools_unknown_browser_context_to_bidi_no_such_user_context() {let response = super::super::bidi_response_from_devtools_error(14,- moli_protocol::devtools_runtime::DevToolsError::new(- moli_protocol::devtools_runtime::DevToolsErrorKind::NoSuchTarget,+ moli_protocol::automation::DevToolsError::new(+ moli_protocol::automation::DevToolsErrorKind::NoSuchTarget,"UnknownBrowserContextId",),);@@ -1605,7 +1591,7 @@ fn attached_connection_dispatches_without_session_new() {assert_eq!(outcome.response["error"], json!("unsupported operation"));assert_eq!(outcome.session_id.as_deref(), Some("classic-session-1"));let dispatch = outcome- .devtools_command+ .automation_command.expect("attached BiDi command should carry shared DevTools command");assert_eq!(dispatch.session_id, "classic-session-1");}@@ -1643,7 +1629,7 @@ fn session_new_rejects_existing_session() {}#[test]-fn bound_devtools_command_outcome_carries_shared_command() {+fn bound_automation_command_outcome_carries_shared_command() {let mut connection = super::super::BidiConnectionState::new();let _ = connection.handle_message(json!({"id": 1,@@ -1665,22 +1651,21 @@ fn bound_devtools_command_outcome_carries_shared_command() {assert_eq!(outcome.response["error"], json!("unsupported operation"));assert_eq!(outcome.session_id.as_deref(), Some("bidi-session-1"));let dispatch = outcome- .devtools_command+ .automation_command.expect("BiDi command should carry shared DevTools command");assert_eq!(dispatch.id, 2);assert_eq!(dispatch.session_id, "bidi-session-1");- let moli_protocol::devtools_runtime::DevToolsCommand::Navigate(command) = dispatch.command- else {+ let moli_protocol::automation::AutomationCommand::Navigate(command) = dispatch.command else {panic!("expected Navigate command");};assert_eq!(command.context.protocol,- moli_protocol::devtools_runtime::DevToolsProtocol::WebDriverBidi+ moli_protocol::automation::FrontendProtocol::WebDriverBidi);assert_eq!(command.url, "https://example.test/");assert_eq!(command.wait,- moli_protocol::devtools_runtime::DevToolsNavigationWait::DomContentLoaded+ moli_protocol::automation::DevToolsNavigationWait::DomContentLoaded);}@@ -1708,7 +1693,7 @@ fn bound_input_perform_actions_outcome_carries_input_dispatch() {assert_eq!(outcome.response["type"], json!("error"));assert_eq!(outcome.response["error"], json!("unsupported operation"));- assert!(outcome.devtools_command.is_none());+ assert!(outcome.automation_command.is_none());let dispatch = outcome.input_command.expect("BiDi input command should carry input dispatch");@@ -1740,7 +1725,7 @@ fn bound_input_release_actions_outcome_carries_input_dispatch() {assert_eq!(outcome.response["type"], json!("error"));assert_eq!(outcome.response["error"], json!("unsupported operation"));- assert!(outcome.devtools_command.is_none());+ assert!(outcome.automation_command.is_none());let dispatch = outcome.input_command.expect("BiDi input command should carry input dispatch");@@ -1774,7 +1759,7 @@ fn bound_input_set_files_outcome_carries_input_dispatch() {assert_eq!(outcome.response["type"], json!("error"));assert_eq!(outcome.response["error"], json!("unsupported operation"));- assert!(outcome.devtools_command.is_none());+ assert!(outcome.automation_command.is_none());let dispatch = outcome.input_command.expect("BiDi input command should carry input dispatch");@@ -1849,20 +1834,20 @@ fn bound_network_add_intercept_carries_shared_fetch_command() {assert_eq!(outcome.response["type"], json!("error"));assert_eq!(outcome.response["error"], json!("unsupported operation"));let dispatch = outcome- .devtools_command+ .automation_command.expect("network.addIntercept should carry shared Fetch command");- let moli_protocol::devtools_runtime::DevToolsCommand::AddNetworkIntercept(command) =+ let moli_protocol::automation::AutomationCommand::AddNetworkIntercept(command) =dispatch.commandelse {panic!("expected AddNetworkIntercept command");};assert_eq!(command.context.protocol,- moli_protocol::devtools_runtime::DevToolsProtocol::WebDriverBidi+ moli_protocol::automation::FrontendProtocol::WebDriverBidi);assert_eq!(command.phases,- vec![moli_protocol::devtools_runtime::DevToolsNetworkInterceptPhase::BeforeRequestSent]+ vec![moli_protocol::automation::DevToolsNetworkInterceptPhase::BeforeRequestSent]);assert_eq!(command.url_patterns, vec![]);assert_eq!(@@ -1890,9 +1875,9 @@ fn bound_network_add_intercept_keeps_phases_before_subscription() {}));let dispatch = outcome- .devtools_command+ .automation_command.expect("network.addIntercept should carry shared Fetch command");- let moli_protocol::devtools_runtime::DevToolsCommand::AddNetworkIntercept(command) =+ let moli_protocol::automation::AutomationCommand::AddNetworkIntercept(command) =dispatch.commandelse {panic!("expected AddNetworkIntercept command");@@ -1900,8 +1885,8 @@ fn bound_network_add_intercept_keeps_phases_before_subscription() {assert_eq!(command.phases,vec![- moli_protocol::devtools_runtime::DevToolsNetworkInterceptPhase::BeforeRequestSent,- moli_protocol::devtools_runtime::DevToolsNetworkInterceptPhase::AuthRequired+ moli_protocol::automation::DevToolsNetworkInterceptPhase::BeforeRequestSent,+ moli_protocol::automation::DevToolsNetworkInterceptPhase::AuthRequired]);assert_eq!(@@ -1947,16 +1932,16 @@ fn bound_network_add_intercept_keeps_subscribed_auth_required_phase() {}));let dispatch = outcome- .devtools_command+ .automation_command.expect("authRequired intercept should carry shared Fetch command");- let moli_protocol::devtools_runtime::DevToolsCommand::AddNetworkIntercept(command) =+ let moli_protocol::automation::AutomationCommand::AddNetworkIntercept(command) =dispatch.commandelse {panic!("expected AddNetworkIntercept command");};assert_eq!(command.phases,- vec![moli_protocol::devtools_runtime::DevToolsNetworkInterceptPhase::AuthRequired]+ vec![moli_protocol::automation::DevToolsNetworkInterceptPhase::AuthRequired]);assert_eq!(command.url_patterns.len(), 1);}@@ -1990,9 +1975,9 @@ fn bound_network_add_intercept_keeps_context_phases_independent_of_subscription(}}));let dispatch = matching- .devtools_command+ .automation_command.expect("matching context intercept should carry shared Fetch command");- let moli_protocol::devtools_runtime::DevToolsCommand::AddNetworkIntercept(command) =+ let moli_protocol::automation::AutomationCommand::AddNetworkIntercept(command) =dispatch.commandelse {panic!("expected AddNetworkIntercept command");@@ -2000,8 +1985,8 @@ fn bound_network_add_intercept_keeps_context_phases_independent_of_subscription(assert_eq!(command.phases,vec![- moli_protocol::devtools_runtime::DevToolsNetworkInterceptPhase::BeforeRequestSent,- moli_protocol::devtools_runtime::DevToolsNetworkInterceptPhase::ResponseStarted+ moli_protocol::automation::DevToolsNetworkInterceptPhase::BeforeRequestSent,+ moli_protocol::automation::DevToolsNetworkInterceptPhase::ResponseStarted]);@@ -2015,15 +2000,15 @@ fn bound_network_add_intercept_keeps_context_phases_independent_of_subscription(}}));let dispatch = non_matching- .devtools_command+ .automation_command.expect("non-matching context intercept should still carry shared Fetch command");- let moli_protocol::devtools_runtime::DevToolsCommand::AddNetworkIntercept(command) =+ let moli_protocol::automation::AutomationCommand::AddNetworkIntercept(command) =dispatch.commandelse {panic!("expected AddNetworkIntercept command");};assert_eq!(command.phases,- vec![moli_protocol::devtools_runtime::DevToolsNetworkInterceptPhase::BeforeRequestSent]+ vec![moli_protocol::automation::DevToolsNetworkInterceptPhase::BeforeRequestSent]);}diff --git a/moli-protocol-webdriver-bidi/src/tests/script_storage_and_validation.rs b/moli-protocol-webdriver-bidi/src/tests/script_storage_and_validation.rsindex 8ea42dd02..4a56b8ad4 100644--- a/moli-protocol-webdriver-bidi/src/tests/script_storage_and_validation.rs+++ b/moli-protocol-webdriver-bidi/src/tests/script_storage_and_validation.rs@@ -918,7 +918,7 @@ fn rejects_chromium_wpt_invalid_browsing_context_params() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");assert!(- super::super::devtools_command_from_bidi_command(&valid_shape_user_context, &context)+ super::super::automation_command_from_bidi_command(&valid_shape_user_context, &context).is_ok(),"user context existence is checked by the execution layer that owns browser contexts");@@ -2029,7 +2029,7 @@ fn rejects_invalid_bidi_command_adapter_params() {})).expect("BiDi command");assert_eq!(- super::super::devtools_command_from_bidi_command(&invalid_wait, &context)+ super::super::automation_command_from_bidi_command(&invalid_wait, &context).expect_err("invalid wait should fail").code,super::super::BidiErrorCode::InvalidArgument@@ -2046,7 +2046,7 @@ fn rejects_invalid_bidi_command_adapter_params() {})).expect("BiDi command");assert_eq!(- super::super::devtools_command_from_bidi_command(&invalid_wait_type, &context)+ super::super::automation_command_from_bidi_command(&invalid_wait_type, &context).expect_err("non-string wait should fail").code,super::super::BidiErrorCode::InvalidArgument@@ -2061,7 +2061,7 @@ fn rejects_invalid_bidi_command_adapter_params() {})).expect("BiDi command");assert_eq!(- super::super::devtools_command_from_bidi_command(&invalid_get_tree_root_type, &context)+ super::super::automation_command_from_bidi_command(&invalid_get_tree_root_type, &context).expect_err("non-string getTree root should fail").code,super::super::BidiErrorCode::InvalidArgument@@ -2077,7 +2077,7 @@ fn rejects_invalid_bidi_command_adapter_params() {})).expect("BiDi command");assert_eq!(- super::super::devtools_command_from_bidi_command(+ super::super::automation_command_from_bidi_command(&invalid_reload_ignore_cache_type,&context)@@ -2099,7 +2099,7 @@ fn rejects_invalid_bidi_command_adapter_params() {})).expect("BiDi command");assert_eq!(- super::super::devtools_command_from_bidi_command(&invalid_await_promise_type, &context)+ super::super::automation_command_from_bidi_command(&invalid_await_promise_type, &context).expect_err("non-boolean awaitPromise should fail").code,super::super::BidiErrorCode::InvalidArgument@@ -2118,9 +2118,12 @@ fn rejects_invalid_bidi_command_adapter_params() {})).expect("BiDi command");assert_eq!(- super::super::devtools_command_from_bidi_command(&invalid_result_ownership_type, &context)- .expect_err("non-string resultOwnership should fail")- .code,+ super::super::automation_command_from_bidi_command(+ &invalid_result_ownership_type,+ &context+ )+ .expect_err("non-string resultOwnership should fail")+ .code,super::super::BidiErrorCode::InvalidArgument);@@ -2137,7 +2140,7 @@ fn rejects_invalid_bidi_command_adapter_params() {})).expect("BiDi command");assert_eq!(- super::super::devtools_command_from_bidi_command(+ super::super::automation_command_from_bidi_command(&invalid_script_target_sandbox_type,&context)@@ -2159,7 +2162,7 @@ fn rejects_invalid_bidi_command_adapter_params() {})).expect("BiDi command");assert_eq!(- super::super::devtools_command_from_bidi_command(+ super::super::automation_command_from_bidi_command(&invalid_call_function_arguments_type,&context)@@ -2178,7 +2181,7 @@ fn rejects_invalid_bidi_command_adapter_params() {})).expect("BiDi command");assert_eq!(- super::super::devtools_command_from_bidi_command(&invalid_preload_sandbox_type, &context)+ super::super::automation_command_from_bidi_command(&invalid_preload_sandbox_type, &context).expect_err("non-string preload sandbox should fail").code,super::super::BidiErrorCode::InvalidArgument@@ -2197,9 +2200,9 @@ fn rejects_invalid_bidi_command_adapter_params() {})).expect("BiDi command");let shared =- super::super::devtools_command_from_bidi_command(&context_and_realm_target, &context)+ super::super::automation_command_from_bidi_command(&context_and_realm_target, &context).expect("context target should ignore realm");- let moli_protocol::devtools_runtime::DevToolsCommand::EvaluateScript(command) = shared else {+ let moli_protocol::automation::AutomationCommand::EvaluateScript(command) = shared else {panic!("expected EvaluateScript command");};assert_eq!(@@ -2207,7 +2210,7 @@ fn rejects_invalid_bidi_command_adapter_params() {.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TARGET-1"));assert!(command.realm_id.is_none());@@ -2221,7 +2224,7 @@ fn rejects_invalid_bidi_command_adapter_params() {})).expect("BiDi command");assert_eq!(- super::super::devtools_command_from_bidi_command(&invalid_realm_type, &context)+ super::super::automation_command_from_bidi_command(&invalid_realm_type, &context).expect_err("invalid realm type should fail").code,super::super::BidiErrorCode::InvalidArgument@@ -2238,7 +2241,7 @@ fn rejects_invalid_bidi_command_adapter_params() {})).expect("BiDi command");assert_eq!(- super::super::devtools_command_from_bidi_command(&conflicting_preload_targets, &context)+ super::super::automation_command_from_bidi_command(&conflicting_preload_targets, &context).expect_err("conflicting preload targets should fail").code,super::super::BidiErrorCode::InvalidArgument@@ -2254,7 +2257,7 @@ fn rejects_invalid_bidi_command_adapter_params() {})).expect("BiDi command");assert_eq!(- super::super::devtools_command_from_bidi_command(&empty_preload_contexts, &context)+ super::super::automation_command_from_bidi_command(&empty_preload_contexts, &context).expect_err("empty preload contexts should fail").code,super::super::BidiErrorCode::InvalidArgument@@ -2270,9 +2273,12 @@ fn rejects_invalid_bidi_command_adapter_params() {})).expect("BiDi command");assert_eq!(- super::super::devtools_command_from_bidi_command(&invalid_preload_arguments_type, &context)- .expect_err("non-array preload arguments should fail")- .code,+ super::super::automation_command_from_bidi_command(+ &invalid_preload_arguments_type,+ &context+ )+ .expect_err("non-array preload arguments should fail")+ .code,super::super::BidiErrorCode::InvalidArgument);@@ -2286,9 +2292,12 @@ fn rejects_invalid_bidi_command_adapter_params() {})).expect("BiDi command");assert_eq!(- super::super::devtools_command_from_bidi_command(&invalid_preload_argument_entry, &context)- .expect_err("non-object preload argument entries should fail")- .code,+ super::super::automation_command_from_bidi_command(+ &invalid_preload_argument_entry,+ &context+ )+ .expect_err("non-object preload argument entries should fail")+ .code,super::super::BidiErrorCode::InvalidArgument);}@@ -2305,8 +2314,8 @@ fn network_continue_request_preserves_header_bytes() {})).unwrap();let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let moli_protocol::devtools_runtime::DevToolsCommand::ContinueInterceptedRequest(command) =- super::super::devtools_command_from_bidi_command(&command, &context).unwrap()+ let moli_protocol::automation::AutomationCommand::ContinueInterceptedRequest(command) =+ super::super::automation_command_from_bidi_command(&command, &context).unwrap()else {panic!("expected request continuation");};diff --git a/moli-protocol-webdriver-bidi/src/tests/session_and_network_commands.rs b/moli-protocol-webdriver-bidi/src/tests/session_and_network_commands.rsindex fc32de74e..dd85efd55 100644--- a/moli-protocol-webdriver-bidi/src/tests/session_and_network_commands.rs+++ b/moli-protocol-webdriver-bidi/src/tests/session_and_network_commands.rs@@ -29,16 +29,16 @@ fn bound_global_network_add_intercept_keeps_phases_with_scoped_subscriptions() {}));let dispatch = outcome- .devtools_command+ .automation_command.expect("global intercept should carry shared Fetch command");- let moli_protocol::devtools_runtime::DevToolsCommand::AddNetworkIntercept(command) =+ let moli_protocol::automation::AutomationCommand::AddNetworkIntercept(command) =dispatch.commandelse {panic!("expected AddNetworkIntercept command");};assert_eq!(command.phases,- vec![moli_protocol::devtools_runtime::DevToolsNetworkInterceptPhase::BeforeRequestSent]+ vec![moli_protocol::automation::DevToolsNetworkInterceptPhase::BeforeRequestSent]);assert_eq!(command.context.target_id, None);@@ -68,16 +68,16 @@ fn bound_global_network_add_intercept_keeps_phases_with_scoped_subscriptions() {}}));let dispatch = outcome- .devtools_command+ .automation_command.expect("global intercept should carry shared Fetch command");- let moli_protocol::devtools_runtime::DevToolsCommand::AddNetworkIntercept(command) =+ let moli_protocol::automation::AutomationCommand::AddNetworkIntercept(command) =dispatch.commandelse {panic!("expected AddNetworkIntercept command");};assert_eq!(command.phases,- vec![moli_protocol::devtools_runtime::DevToolsNetworkInterceptPhase::BeforeRequestSent]+ vec![moli_protocol::automation::DevToolsNetworkInterceptPhase::BeforeRequestSent]);assert_eq!(command.context.target_id, None);}@@ -102,10 +102,10 @@ fn bound_network_continue_request_carries_shared_fetch_command() {assert_eq!(outcome.response["type"], json!("error"));assert_eq!(outcome.response["error"], json!("unsupported operation"));let dispatch = outcome- .devtools_command+ .automation_command.expect("network.continueRequest should carry shared Fetch command");assert_eq!(dispatch.id, 2);- let moli_protocol::devtools_runtime::DevToolsCommand::ContinueInterceptedRequest(command) =+ let moli_protocol::automation::AutomationCommand::ContinueInterceptedRequest(command) =dispatch.commandelse {panic!("expected ContinueInterceptedRequest command");@@ -113,7 +113,7 @@ fn bound_network_continue_request_carries_shared_fetch_command() {assert_eq!(command.request_id.as_str(), "REQ-1");assert_eq!(command.context.protocol,- moli_protocol::devtools_runtime::DevToolsProtocol::WebDriverBidi+ moli_protocol::automation::FrontendProtocol::WebDriverBidi);}@@ -140,10 +140,9 @@ fn maps_network_add_and_remove_intercept_to_shared_fetch_commands() {}})).expect("BiDi command");- let shared = super::super::devtools_command_from_bidi_command(&add, &context)+ let shared = super::super::automation_command_from_bidi_command(&add, &context).expect("shared addIntercept command");- let moli_protocol::devtools_runtime::DevToolsCommand::AddNetworkIntercept(command) = shared- else {+ let moli_protocol::automation::AutomationCommand::AddNetworkIntercept(command) = shared else {panic!("expected AddNetworkIntercept command");};assert_eq!(@@ -157,9 +156,9 @@ fn maps_network_add_and_remove_intercept_to_shared_fetch_commands() {assert_eq!(command.phases,vec![- moli_protocol::devtools_runtime::DevToolsNetworkInterceptPhase::ResponseStarted,- moli_protocol::devtools_runtime::DevToolsNetworkInterceptPhase::BeforeRequestSent,- moli_protocol::devtools_runtime::DevToolsNetworkInterceptPhase::AuthRequired,+ moli_protocol::automation::DevToolsNetworkInterceptPhase::ResponseStarted,+ moli_protocol::automation::DevToolsNetworkInterceptPhase::BeforeRequestSent,+ moli_protocol::automation::DevToolsNetworkInterceptPhase::AuthRequired,]);assert_eq!(@@ -182,9 +181,9 @@ fn maps_network_add_and_remove_intercept_to_shared_fetch_commands() {}})).expect("BiDi command");- let shared = super::super::devtools_command_from_bidi_command(&remove, &context)+ let shared = super::super::automation_command_from_bidi_command(&remove, &context).expect("shared removeIntercept command");- let moli_protocol::devtools_runtime::DevToolsCommand::RemoveNetworkIntercept(command) = shared+ let moli_protocol::automation::AutomationCommand::RemoveNetworkIntercept(command) = sharedelse {panic!("expected RemoveNetworkIntercept command");};@@ -207,19 +206,19 @@ fn maps_network_get_data_to_shared_network_command() {}})).expect("BiDi command");- let shared = super::super::devtools_command_from_bidi_command(&response_data, &context)+ let shared = super::super::automation_command_from_bidi_command(&response_data, &context).expect("shared getData command");- let moli_protocol::devtools_runtime::DevToolsCommand::GetNetworkData(command) = shared else {+ let moli_protocol::automation::AutomationCommand::GetNetworkData(command) = shared else {panic!("expected GetNetworkData command");};assert_eq!(command.request_id.as_str(), "REQ-response");assert_eq!(command.data_type,- moli_protocol::devtools_runtime::DevToolsNetworkDataType::Response+ moli_protocol::automation::DevToolsNetworkDataType::Response);assert_eq!(command.context.protocol,- moli_protocol::devtools_runtime::DevToolsProtocol::WebDriverBidi+ moli_protocol::automation::FrontendProtocol::WebDriverBidi);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),@@ -239,15 +238,15 @@ fn maps_network_get_data_to_shared_network_command() {}})).expect("BiDi command");- let shared = super::super::devtools_command_from_bidi_command(&request_data, &context)+ let shared = super::super::automation_command_from_bidi_command(&request_data, &context).expect("shared getData command with collector");- let moli_protocol::devtools_runtime::DevToolsCommand::GetNetworkData(command) = shared else {+ let moli_protocol::automation::AutomationCommand::GetNetworkData(command) = shared else {panic!("expected GetNetworkData command");};assert_eq!(command.request_id.as_str(), "REQ-request");assert_eq!(command.data_type,- moli_protocol::devtools_runtime::DevToolsNetworkDataType::Request+ moli_protocol::automation::DevToolsNetworkDataType::Request);assert_eq!(command.collector.as_ref().map(|id| id.as_str()),@@ -271,9 +270,9 @@ fn maps_network_data_collector_commands_to_shared_network_commands() {}})).expect("BiDi command");- let shared = super::super::devtools_command_from_bidi_command(&add, &context)+ let shared = super::super::automation_command_from_bidi_command(&add, &context).expect("shared add collector");- let moli_protocol::devtools_runtime::DevToolsCommand::AddNetworkDataCollector(command) = shared+ let moli_protocol::automation::AutomationCommand::AddNetworkDataCollector(command) = sharedelse {panic!("expected AddNetworkDataCollector command");};@@ -284,8 +283,8 @@ fn maps_network_data_collector_commands_to_shared_network_commands() {assert_eq!(command.data_types,vec![- moli_protocol::devtools_runtime::DevToolsNetworkDataType::Response,- moli_protocol::devtools_runtime::DevToolsNetworkDataType::Request,+ moli_protocol::automation::DevToolsNetworkDataType::Response,+ moli_protocol::automation::DevToolsNetworkDataType::Request,]);assert_eq!(command.max_encoded_data_size, 1000);@@ -293,7 +292,7 @@ fn maps_network_data_collector_commands_to_shared_network_commands() {command.target_ids.iter()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str)+ .map(moli_protocol::automation::DevToolsTargetId::as_str).collect::<Vec<_>>(),vec!["TARGET-1"]);@@ -306,10 +305,9 @@ fn maps_network_data_collector_commands_to_shared_network_commands() {}})).expect("BiDi command");- let shared = super::super::devtools_command_from_bidi_command(&remove, &context)+ let shared = super::super::automation_command_from_bidi_command(&remove, &context).expect("shared remove collector");- let moli_protocol::devtools_runtime::DevToolsCommand::RemoveNetworkDataCollector(command) =- shared+ let moli_protocol::automation::AutomationCommand::RemoveNetworkDataCollector(command) = sharedelse {panic!("expected RemoveNetworkDataCollector command");};@@ -325,16 +323,15 @@ fn maps_network_data_collector_commands_to_shared_network_commands() {}})).expect("BiDi command");- let shared = super::super::devtools_command_from_bidi_command(&disown, &context)+ let shared = super::super::automation_command_from_bidi_command(&disown, &context).expect("shared disown data");- let moli_protocol::devtools_runtime::DevToolsCommand::DisownNetworkData(command) = shared- else {+ let moli_protocol::automation::AutomationCommand::DisownNetworkData(command) = shared else {panic!("expected DisownNetworkData command");};assert_eq!(command.request_id.as_str(), "REQ-1");assert_eq!(command.data_type,- moli_protocol::devtools_runtime::DevToolsNetworkDataType::Response+ moli_protocol::automation::DevToolsNetworkDataType::Response);assert_eq!(command.collector_id.as_str(), "collector-1");}@@ -352,16 +349,16 @@ fn maps_network_set_cache_behavior_to_shared_network_command() {}})).expect("BiDi command");- let shared = super::super::devtools_command_from_bidi_command(&scoped, &context)+ let shared = super::super::automation_command_from_bidi_command(&scoped, &context).expect("shared setCacheBehavior command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetCacheBehavior(command) = shared else {+ let moli_protocol::automation::AutomationCommand::SetCacheBehavior(command) = shared else {panic!("expected SetCacheBehavior command");};assert_eq!(command.target_ids.iter()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str)+ .map(moli_protocol::automation::DevToolsTargetId::as_str).collect::<Vec<_>>(),vec!["TARGET-1", "TARGET-2"]);@@ -379,9 +376,9 @@ fn maps_network_set_cache_behavior_to_shared_network_command() {}})).expect("BiDi command");- let shared = super::super::devtools_command_from_bidi_command(&global, &context)+ let shared = super::super::automation_command_from_bidi_command(&global, &context).expect("shared global setCacheBehavior command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetCacheBehavior(command) = shared else {+ let moli_protocol::automation::AutomationCommand::SetCacheBehavior(command) = shared else {panic!("expected SetCacheBehavior command");};assert!(command.target_ids.is_empty());@@ -405,16 +402,16 @@ fn maps_network_set_extra_headers_to_shared_network_command() {}})).expect("BiDi command");- let shared = super::super::devtools_command_from_bidi_command(&scoped, &context)+ let shared = super::super::automation_command_from_bidi_command(&scoped, &context).expect("shared setExtraHeaders command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetExtraHeaders(command) = shared else {+ let moli_protocol::automation::AutomationCommand::SetExtraHeaders(command) = shared else {panic!("expected SetExtraHeaders command");};assert_eq!(command.target_ids.iter()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str)+ .map(moli_protocol::automation::DevToolsTargetId::as_str).collect::<Vec<_>>(),vec!["TARGET-1"]);@@ -442,9 +439,9 @@ fn maps_network_set_extra_headers_to_shared_network_command() {}})).expect("BiDi command");- let shared = super::super::devtools_command_from_bidi_command(&user_context_scoped, &context)+ let shared = super::super::automation_command_from_bidi_command(&user_context_scoped, &context).expect("shared user-context setExtraHeaders command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetExtraHeaders(command) = shared else {+ let moli_protocol::automation::AutomationCommand::SetExtraHeaders(command) = shared else {panic!("expected SetExtraHeaders command");};assert!(command.target_ids.is_empty());@@ -452,7 +449,7 @@ fn maps_network_set_extra_headers_to_shared_network_command() {command.browser_context_ids.iter()- .map(moli_protocol::devtools_runtime::DevToolsBrowserContextId::as_str)+ .map(moli_protocol::automation::DevToolsBrowserContextId::as_str).collect::<Vec<_>>(),vec!["default", "USER-1"]);@@ -479,12 +476,11 @@ fn bound_network_get_data_outcome_carries_shared_command() {assert_eq!(outcome.response["type"], json!("error"));assert_eq!(outcome.response["error"], json!("unsupported operation"));let dispatch = outcome- .devtools_command+ .automation_command.expect("BiDi network.getData should carry a shared command dispatch");assert_eq!(dispatch.id, 2);assert_eq!(dispatch.session_id, "bidi-session-1");- let moli_protocol::devtools_runtime::DevToolsCommand::GetNetworkData(command) =- dispatch.command+ let moli_protocol::automation::AutomationCommand::GetNetworkData(command) = dispatch.commandelse {panic!("expected GetNetworkData command");};@@ -515,12 +511,11 @@ fn bound_network_set_cache_behavior_outcome_carries_shared_command() {assert_eq!(outcome.response["type"], json!("error"));assert_eq!(outcome.response["error"], json!("unsupported operation"));let dispatch = outcome- .devtools_command+ .automation_command.expect("BiDi network.setCacheBehavior should carry a shared command dispatch");assert_eq!(dispatch.id, 2);assert_eq!(dispatch.session_id, "bidi-session-1");- let moli_protocol::devtools_runtime::DevToolsCommand::SetCacheBehavior(command) =- dispatch.command+ let moli_protocol::automation::AutomationCommand::SetCacheBehavior(command) = dispatch.commandelse {panic!("expected SetCacheBehavior command");};@@ -548,12 +543,11 @@ fn bound_network_set_extra_headers_outcome_carries_shared_command() {assert_eq!(outcome.response["type"], json!("error"));assert_eq!(outcome.response["error"], json!("unsupported operation"));let dispatch = outcome- .devtools_command+ .automation_command.expect("BiDi network.setExtraHeaders should carry a shared command dispatch");assert_eq!(dispatch.id, 2);assert_eq!(dispatch.session_id, "bidi-session-1");- let moli_protocol::devtools_runtime::DevToolsCommand::SetExtraHeaders(command) =- dispatch.command+ let moli_protocol::automation::AutomationCommand::SetExtraHeaders(command) = dispatch.commandelse {panic!("expected SetExtraHeaders command");};@@ -586,11 +580,11 @@ fn bound_network_add_data_collector_outcome_carries_shared_command() {assert_eq!(outcome.response["type"], json!("error"));assert_eq!(outcome.response["error"], json!("unsupported operation"));let dispatch = outcome- .devtools_command+ .automation_command.expect("BiDi network.addDataCollector should carry a shared command dispatch");assert_eq!(dispatch.id, 2);assert_eq!(dispatch.session_id, "bidi-session-1");- let moli_protocol::devtools_runtime::DevToolsCommand::AddNetworkDataCollector(command) =+ let moli_protocol::automation::AutomationCommand::AddNetworkDataCollector(command) =dispatch.commandelse {panic!("expected AddNetworkDataCollector command");@@ -617,9 +611,9 @@ fn maps_network_set_extra_headers_with_opaque_bytes_and_utf8_values() {})).expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared =- super::super::devtools_command_from_bidi_command(&command, &context).expect("byte headers");- let moli_protocol::devtools_runtime::DevToolsCommand::SetExtraHeaders(command) = shared else {+ let shared = super::super::automation_command_from_bidi_command(&command, &context)+ .expect("byte headers");+ let moli_protocol::automation::AutomationCommand::SetExtraHeaders(command) = shared else {panic!("expected SetExtraHeaders");};assert_eq!(@@ -633,7 +627,7 @@ fn maps_network_set_extra_headers_with_opaque_bytes_and_utf8_values() {#[test]fn bidi_cookie_overrides_preserve_opaque_and_utf8_bytes() {- use moli_protocol::devtools_runtime::DevToolsCommand;+ use moli_protocol::automation::AutomationCommand;let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");for method in ["network.continueRequest",@@ -653,14 +647,14 @@ fn bidi_cookie_overrides_preserve_opaque_and_utf8_bytes() {json!({"id": 100, "method": method, "params": params}),).unwrap();- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("non-UTF8 cookie value must be accepted");let headers = match shared {- DevToolsCommand::ContinueInterceptedRequest(command) => command.headers.unwrap(),- DevToolsCommand::ContinueInterceptedResponse(command) => {+ AutomationCommand::ContinueInterceptedRequest(command) => command.headers.unwrap(),+ AutomationCommand::ContinueInterceptedResponse(command) => {moli_header_field::HeaderFields::from_bytes(command.response_headers.unwrap())}- DevToolsCommand::FulfillInterceptedRequest(command) => {+ AutomationCommand::FulfillInterceptedRequest(command) => {moli_header_field::HeaderFields::from_bytes(command.response_headers)}_ => panic!("unexpected cookie dispatch"),@@ -706,10 +700,9 @@ fn maps_network_continue_request_to_shared_fetch_command() {})).expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::ContinueInterceptedRequest(command) =- shared+ let moli_protocol::automation::AutomationCommand::ContinueInterceptedRequest(command) = sharedelse {panic!("expected ContinueInterceptedRequest command");};@@ -757,10 +750,9 @@ fn maps_network_response_controls_to_shared_fetch_commands() {}})).expect("BiDi command");- let shared = super::super::devtools_command_from_bidi_command(&continue_response, &context)+ let shared = super::super::automation_command_from_bidi_command(&continue_response, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::ContinueInterceptedResponse(command) =- shared+ let moli_protocol::automation::AutomationCommand::ContinueInterceptedResponse(command) = sharedelse {panic!("expected ContinueInterceptedResponse command");};@@ -792,10 +784,9 @@ fn maps_network_response_controls_to_shared_fetch_commands() {}})).expect("BiDi command");- let shared = super::super::devtools_command_from_bidi_command(&provide_response, &context)+ let shared = super::super::automation_command_from_bidi_command(&provide_response, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::FulfillInterceptedRequest(command) =- shared+ let moli_protocol::automation::AutomationCommand::FulfillInterceptedRequest(command) = sharedelse {panic!("expected FulfillInterceptedRequest command");};@@ -810,16 +801,16 @@ fn maps_network_response_controls_to_shared_fetch_commands() {"params": {"request": "REQ-10"}})).expect("BiDi command");- let shared = super::super::devtools_command_from_bidi_command(&fail_request, &context)+ let shared = super::super::automation_command_from_bidi_command(&fail_request, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::FailInterceptedRequest(command) = shared+ let moli_protocol::automation::AutomationCommand::FailInterceptedRequest(command) = sharedelse {panic!("expected FailInterceptedRequest command");};assert_eq!(command.request_id.as_str(), "REQ-10");assert_eq!(command.failure,- moli_protocol::devtools_runtime::DevToolsRequestFailure::Failed("Failed".to_owned())+ moli_protocol::automation::DevToolsRequestFailure::Failed("Failed".to_owned()));}@@ -836,15 +827,15 @@ fn maps_network_continue_with_auth_to_shared_fetch_command() {}})).expect("BiDi command");- let shared = super::super::devtools_command_from_bidi_command(&cancel, &context)+ let shared = super::super::automation_command_from_bidi_command(&cancel, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::ContinueWithAuth(command) = shared else {+ let moli_protocol::automation::AutomationCommand::ContinueWithAuth(command) = shared else {panic!("expected ContinueWithAuth command");};assert_eq!(command.request_id.as_str(), "REQ-auth-1");assert_eq!(command.action,- moli_protocol::devtools_runtime::DevToolsAuthChallengeAction::Cancel+ moli_protocol::automation::DevToolsAuthChallengeAction::Cancel);assert_eq!(command.username, None);assert_eq!(command.password, None);@@ -858,15 +849,15 @@ fn maps_network_continue_with_auth_to_shared_fetch_command() {}})).expect("BiDi command");- let shared = super::super::devtools_command_from_bidi_command(&default, &context)+ let shared = super::super::automation_command_from_bidi_command(&default, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::ContinueWithAuth(command) = shared else {+ let moli_protocol::automation::AutomationCommand::ContinueWithAuth(command) = shared else {panic!("expected ContinueWithAuth command");};assert_eq!(command.request_id.as_str(), "");assert_eq!(command.action,- moli_protocol::devtools_runtime::DevToolsAuthChallengeAction::Default+ moli_protocol::automation::DevToolsAuthChallengeAction::Default);let provide = super::super::parse_bidi_command(json!({@@ -883,15 +874,15 @@ fn maps_network_continue_with_auth_to_shared_fetch_command() {}})).expect("BiDi command");- let shared = super::super::devtools_command_from_bidi_command(&provide, &context)+ let shared = super::super::automation_command_from_bidi_command(&provide, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::ContinueWithAuth(command) = shared else {+ let moli_protocol::automation::AutomationCommand::ContinueWithAuth(command) = shared else {panic!("expected ContinueWithAuth command");};assert_eq!(command.request_id.as_str(), "REQ-auth-2");assert_eq!(command.action,- moli_protocol::devtools_runtime::DevToolsAuthChallengeAction::ProvideCredentials+ moli_protocol::automation::DevToolsAuthChallengeAction::ProvideCredentials);assert_eq!(command.username.as_deref(), Some("user"));assert_eq!(command.password.as_deref(), Some("secret"));@@ -1102,7 +1093,7 @@ fn rejects_invalid_network_control_params() {})).expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let error = super::super::devtools_command_from_bidi_command(&command, &context)+ let error = super::super::automation_command_from_bidi_command(&command, &context).expect_err("params should be rejected");assert!(matches!(error.code,@@ -1125,7 +1116,7 @@ fn unbound_session_command_returns_invalid_session() {assert_eq!(outcome.response["type"], json!("error"));assert_eq!(outcome.response["error"], json!("invalid session id"));assert_eq!(outcome.response["message"], json!("session not found"));- assert!(outcome.devtools_command.is_none());+ assert!(outcome.automation_command.is_none());}#[test]@@ -1313,29 +1304,29 @@ fn maps_browsing_context_create_to_shared_create_target_command() {let context =super::super::BidiDevToolsCommandContext::with_browser_context_id("bidi-session-1", "BC-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::CreateTarget(command) = shared else {+ let moli_protocol::automation::AutomationCommand::CreateTarget(command) = shared else {panic!("expected CreateTarget command");};assert_eq!(command.context.protocol,- moli_protocol::devtools_runtime::DevToolsProtocol::WebDriverBidi+ moli_protocol::automation::FrontendProtocol::WebDriverBidi);assert_eq!(command.context.session_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsSessionId::as_str),+ .map(moli_protocol::automation::DevToolsSessionId::as_str),Some("bidi-session-1"));assert_eq!(command.browser_context_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsBrowserContextId::as_str),+ .map(moli_protocol::automation::DevToolsBrowserContextId::as_str),Some("BC-1"));assert_eq!(command.url, "about:blank");@@ -1361,10 +1352,10 @@ fn maps_browsing_context_create_background_true_to_non_activating_target_commandlet context =super::super::BidiDevToolsCommandContext::with_browser_context_id("bidi-session-1", "BC-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::CreateTarget(command) = shared else {+ let moli_protocol::automation::AutomationCommand::CreateTarget(command) = shared else {panic!("expected CreateTarget command");};assert!(@@ -1391,17 +1382,17 @@ fn maps_chromium_wpt_browsing_context_create_user_context_to_shared_target_owner"BID-1",);- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::CreateTarget(command) = shared else {+ let moli_protocol::automation::AutomationCommand::CreateTarget(command) = shared else {panic!("expected CreateTarget command");};assert_eq!(command.browser_context_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsBrowserContextId::as_str),+ .map(moli_protocol::automation::DevToolsBrowserContextId::as_str),Some("BID-CUSTOM"));assert_eq!(@@ -1409,7 +1400,7 @@ fn maps_chromium_wpt_browsing_context_create_user_context_to_shared_target_owner.context.browser_context_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsBrowserContextId::as_str),+ .map(moli_protocol::automation::DevToolsBrowserContextId::as_str),Some("BID-CUSTOM"));}@@ -1439,11 +1430,10 @@ fn maps_browser_create_user_context_to_shared_browser_context_owner() {"BID-1",);- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::CreateBrowserContext(command) = shared- else {+ let moli_protocol::automation::AutomationCommand::CreateBrowserContext(command) = shared else {panic!("expected CreateBrowserContext command");};assert_eq!(command.browser_context_id, None);@@ -1458,7 +1448,7 @@ fn maps_browser_create_user_context_to_shared_browser_context_owner() {assert_eq!(command.persistent_partition_id, None);assert_eq!(command.context.protocol,- moli_protocol::devtools_runtime::DevToolsProtocol::WebDriverBidi+ moli_protocol::automation::FrontendProtocol::WebDriverBidi);}@@ -1480,10 +1470,9 @@ fn maps_browser_create_user_context_proxy_edges_without_dropping_values() {}})).expect("BiDi command");- let shared =- super::super::devtools_command_from_bidi_command(&ipv6, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::CreateBrowserContext(command) = shared- else {+ let shared = super::super::automation_command_from_bidi_command(&ipv6, &context)+ .expect("shared command");+ let moli_protocol::automation::AutomationCommand::CreateBrowserContext(command) = shared else {panic!("expected CreateBrowserContext command");};assert_eq!(command.proxy_server.as_deref(), Some("[::1]:80"));@@ -1500,9 +1489,8 @@ fn maps_browser_create_user_context_proxy_edges_without_dropping_values() {})).expect("BiDi command");let shared =- super::super::devtools_command_from_bidi_command(&pac, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::CreateBrowserContext(command) = shared- else {+ super::super::automation_command_from_bidi_command(&pac, &context).expect("shared command");+ let moli_protocol::automation::AutomationCommand::CreateBrowserContext(command) = shared else {panic!("expected CreateBrowserContext command");};assert_eq!(@@ -1523,10 +1511,9 @@ fn maps_browser_create_user_context_proxy_edges_without_dropping_values() {}})).expect("BiDi command");- let shared =- super::super::devtools_command_from_bidi_command(&socks, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::CreateBrowserContext(command) = shared- else {+ let shared = super::super::automation_command_from_bidi_command(&socks, &context)+ .expect("shared command");+ let moli_protocol::automation::AutomationCommand::CreateBrowserContext(command) = shared else {panic!("expected CreateBrowserContext command");};assert_eq!(@@ -1551,22 +1538,22 @@ fn maps_browser_get_client_windows_to_shared_target_owner() {"BID-1",);- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::GetClientWindows(command) = shared else {+ let moli_protocol::automation::AutomationCommand::GetClientWindows(command) = shared else {panic!("expected GetClientWindows command");};assert_eq!(command.context.protocol,- moli_protocol::devtools_runtime::DevToolsProtocol::WebDriverBidi+ moli_protocol::automation::FrontendProtocol::WebDriverBidi);assert_eq!(command.context.session_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsSessionId::as_str),+ .map(moli_protocol::automation::DevToolsSessionId::as_str),Some("bidi-session-1"));}@@ -1591,29 +1578,28 @@ fn maps_browser_set_client_window_state_to_shared_target_owner() {"BID-1",);- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetClientWindowState(command) = shared- else {+ let moli_protocol::automation::AutomationCommand::SetClientWindowState(command) = shared else {panic!("expected SetClientWindowState command");};assert_eq!(command.context.protocol,- moli_protocol::devtools_runtime::DevToolsProtocol::WebDriverBidi+ moli_protocol::automation::FrontendProtocol::WebDriverBidi);assert_eq!(command.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TID-1"));assert_eq!(command.client_window.as_str(), "TID-1");assert_eq!(command.state,- moli_protocol::devtools_runtime::DevToolsWindowState::Normal+ moli_protocol::automation::DevToolsWindowState::Normal);assert_eq!(command.width, Some(1024));assert_eq!(command.height, Some(768));@@ -1641,7 +1627,7 @@ fn rejects_invalid_browser_set_client_window_state_params() {"params": params})).expect("BiDi command");- let error = super::super::devtools_command_from_bidi_command(&command, &context)+ let error = super::super::automation_command_from_bidi_command(&command, &context).expect_err("invalid setClientWindowState params should fail");assert_eq!(error.code, super::super::BidiErrorCode::InvalidArgument);}@@ -1664,8 +1650,8 @@ fn maps_browser_get_and_remove_user_context_commands() {})).expect("BiDi command");assert!(matches!(- super::super::devtools_command_from_bidi_command(&get, &context).expect("shared command"),- moli_protocol::devtools_runtime::DevToolsCommand::GetBrowserContexts(_)+ super::super::automation_command_from_bidi_command(&get, &context).expect("shared command"),+ moli_protocol::automation::AutomationCommand::GetBrowserContexts(_)));let remove = super::super::parse_bidi_command(json!({@@ -1676,10 +1662,9 @@ fn maps_browser_get_and_remove_user_context_commands() {}})).expect("BiDi command");- let shared = super::super::devtools_command_from_bidi_command(&remove, &context)+ let shared = super::super::automation_command_from_bidi_command(&remove, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::RemoveBrowserContext(command) = shared- else {+ let moli_protocol::automation::AutomationCommand::RemoveBrowserContext(command) = shared else {panic!("expected RemoveBrowserContext command");};assert_eq!(command.browser_context_id.as_str(), "user-context-1");@@ -1707,9 +1692,8 @@ fn maps_browser_set_download_behavior_to_shared_command() {})).expect("BiDi command");let shared =- super::super::devtools_command_from_bidi_command(&set, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetDownloadBehavior(command) = shared- else {+ super::super::automation_command_from_bidi_command(&set, &context).expect("shared command");+ let moli_protocol::automation::AutomationCommand::SetDownloadBehavior(command) = shared else {panic!("expected SetDownloadBehavior command");};let behavior = command.behavior.expect("download behavior");@@ -1736,10 +1720,9 @@ fn maps_browser_set_download_behavior_to_shared_command() {}})).expect("BiDi command");- let shared =- super::super::devtools_command_from_bidi_command(&reset, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::SetDownloadBehavior(command) = shared- else {+ let shared = super::super::automation_command_from_bidi_command(&reset, &context)+ .expect("shared command");+ let moli_protocol::automation::AutomationCommand::SetDownloadBehavior(command) = shared else {panic!("expected SetDownloadBehavior command");};assert!(command.behavior.is_none());@@ -1770,7 +1753,7 @@ fn rejects_chromium_wpt_invalid_browser_set_download_behavior_params() {"params": params,})).expect("BiDi command");- let error = super::super::devtools_command_from_bidi_command(&command, &context)+ let error = super::super::automation_command_from_bidi_command(&command, &context).expect_err("invalid browser.setDownloadBehavior params should fail");assert_eq!(error.code, super::super::BidiErrorCode::InvalidArgument);}@@ -1805,7 +1788,7 @@ fn rejects_chromium_wpt_invalid_browser_user_context_params() {})).expect("BiDi command");assert_eq!(- super::super::devtools_command_from_bidi_command(&command, &context)+ super::super::automation_command_from_bidi_command(&command, &context).expect_err("invalid browser.createUserContext params should fail").code,super::super::BidiErrorCode::InvalidArgument@@ -1828,7 +1811,7 @@ fn rejects_chromium_wpt_invalid_browser_user_context_params() {})).expect("BiDi command");assert_eq!(- super::super::devtools_command_from_bidi_command(&command, &context)+ super::super::automation_command_from_bidi_command(&command, &context).expect_err("invalid browser.removeUserContext params should fail").code,super::super::BidiErrorCode::InvalidArgument@@ -1854,17 +1837,17 @@ fn maps_chromium_wpt_browsing_context_create_default_user_context_to_internal_de"BID-1",);- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::CreateTarget(command) = shared else {+ let moli_protocol::automation::AutomationCommand::CreateTarget(command) = shared else {panic!("expected CreateTarget command");};assert_eq!(command.browser_context_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsBrowserContextId::as_str),+ .map(moli_protocol::automation::DevToolsBrowserContextId::as_str),Some("BID-default"));assert_eq!(@@ -1872,7 +1855,7 @@ fn maps_chromium_wpt_browsing_context_create_default_user_context_to_internal_de.context.browser_context_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsBrowserContextId::as_str),+ .map(moli_protocol::automation::DevToolsBrowserContextId::as_str),Some("BID-default"));}@@ -1895,10 +1878,10 @@ fn maps_bidi_create_reference_context_to_reference_owner() {"BID-default",);- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::CreateTarget(command) = shared else {+ let moli_protocol::automation::AutomationCommand::CreateTarget(command) = shared else {panic!("expected CreateTarget command");};assert_eq!(@@ -1906,7 +1889,7 @@ fn maps_bidi_create_reference_context_to_reference_owner() {.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TID-reference"));assert_eq!(command.browser_context_id, None);@@ -1932,10 +1915,10 @@ fn maps_bidi_create_user_context_overrides_reference_context() {"BID-default",);- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::CreateTarget(command) = shared else {+ let moli_protocol::automation::AutomationCommand::CreateTarget(command) = shared else {panic!("expected CreateTarget command");};assert_eq!(@@ -1943,14 +1926,14 @@ fn maps_bidi_create_user_context_overrides_reference_context() {.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TID-reference"));assert_eq!(command.browser_context_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsBrowserContextId::as_str),+ .map(moli_protocol::automation::DevToolsBrowserContextId::as_str),Some("BID-explicit"));assert_eq!(@@ -1958,7 +1941,7 @@ fn maps_bidi_create_user_context_overrides_reference_context() {.context.browser_context_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsBrowserContextId::as_str),+ .map(moli_protocol::automation::DevToolsBrowserContextId::as_str),Some("BID-explicit"));}@@ -1975,10 +1958,10 @@ fn maps_browsing_context_close_to_shared_close_target_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::CloseTarget(command) = shared else {+ let moli_protocol::automation::AutomationCommand::CloseTarget(command) = shared else {panic!("expected CloseTarget command");};assert_eq!(command.target_id.as_str(), "TARGET-1");@@ -1987,7 +1970,7 @@ fn maps_browsing_context_close_to_shared_close_target_command() {.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TARGET-1"));}@@ -2004,10 +1987,10 @@ fn maps_browsing_context_activate_to_shared_activate_target_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::ActivateTarget(command) = shared else {+ let moli_protocol::automation::AutomationCommand::ActivateTarget(command) = shared else {panic!("expected ActivateTarget command");};assert_eq!(command.target_id.as_str(), "TARGET-1");@@ -2016,7 +1999,7 @@ fn maps_browsing_context_activate_to_shared_activate_target_command() {.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TARGET-1"));}@@ -2034,10 +2017,10 @@ fn maps_browsing_context_get_tree_root_to_shared_get_frame_tree_command() {.expect("BiDi command");let context = super::super::BidiDevToolsCommandContext::new("bidi-session-1");- let shared = super::super::devtools_command_from_bidi_command(&command, &context)+ let shared = super::super::automation_command_from_bidi_command(&command, &context).expect("shared command");- let moli_protocol::devtools_runtime::DevToolsCommand::GetFrameTree(command) = shared else {+ let moli_protocol::automation::AutomationCommand::GetFrameTree(command) = shared else {panic!("expected GetFrameTree command");};assert_eq!(command.max_depth, Some(2));@@ -2046,7 +2029,7 @@ fn maps_browsing_context_get_tree_root_to_shared_get_frame_tree_command() {.context.target_id.as_ref()- .map(moli_protocol::devtools_runtime::DevToolsTargetId::as_str),+ .map(moli_protocol::automation::DevToolsTargetId::as_str),Some("TARGET-1"));}diff --git a/moli-protocol-webdriver-bidi/src/user_context.rs b/moli-protocol-webdriver-bidi/src/user_context.rsindex 68b421e5a..c358e0932 100644--- a/moli-protocol-webdriver-bidi/src/user_context.rs+++ b/moli-protocol-webdriver-bidi/src/user_context.rs@@ -1,4 +1,4 @@-use moli_protocol::devtools_runtime::DevToolsBrowserContextId;+use moli_protocol::automation::DevToolsBrowserContextId;pub(crate) const DEFAULT_BIDI_USER_CONTEXT: &str = "default";pub(crate) const DEFAULT_MOLI_BROWSER_CONTEXT_ID: &str = "BID-default";diff --git a/moli-protocol-webdriver-classic/src/actions.rs b/moli-protocol-webdriver-classic/src/actions.rsindex 955cfec11..eb7f93255 100644--- a/moli-protocol-webdriver-classic/src/actions.rs+++ b/moli-protocol-webdriver-classic/src/actions.rs@@ -3,8 +3,8 @@ use std::{collections::{BTreeMap, BTreeSet},};-use moli_protocol::devtools_runtime::{- DevToolsCallFunctionCommand, DevToolsCommand, DevToolsDispatchKeyEventCommand,+use moli_protocol::automation::{+ AutomationCommand, DevToolsCallFunctionCommand, DevToolsDispatchKeyEventCommand,DevToolsDispatchMouseEventCommand, DevToolsDispatchTouchEventCommand,DevToolsDomGeometryResult, DevToolsKeyEventType, DevToolsMouseEventType, DevToolsPointerType,DevToolsRemoteHandleId, DevToolsResultOwnership, DevToolsTouchEventType, DevToolsTouchPoint,@@ -42,7 +42,7 @@ pub type ClassicElementOriginViewportPoints = BTreeMap<String, ClassicViewportPo#[derive(Debug, Clone, PartialEq)]pub struct ClassicActionTick {- pub commands: Vec<DevToolsCommand>,+ pub commands: Vec<AutomationCommand>,pub duration_ms: u64,}@@ -165,7 +165,7 @@ enum ClassicActionCancel {pub fn element_click_input_commands(context: &ClassicDevToolsCommandContext,point: ClassicViewportPoint,-) -> Vec<DevToolsCommand> {+) -> Vec<AutomationCommand> {vec![dispatch_mouse_event_command(context,@@ -228,7 +228,7 @@ pub fn element_send_keys_text(params: &Value) -> Result<String, ClassicError> {pub fn element_send_keys_input_commands(context: &ClassicDevToolsCommandContext,text: &str,-) -> Vec<DevToolsCommand> {+) -> Vec<AutomationCommand> {let mut commands = Vec::new();let mut pressed_modifiers: Vec<ClassicWebDriverKey> = Vec::new();let mut pressed_modifier_keys: BTreeSet<String> = BTreeSet::new();@@ -301,7 +301,7 @@ pub fn element_send_keys_input_commands(fn element_send_keys_release_modifiers(context: &ClassicDevToolsCommandContext,- commands: &mut Vec<DevToolsCommand>,+ commands: &mut Vec<AutomationCommand>,pressed_modifiers: &mut Vec<ClassicWebDriverKey>,pressed_modifier_keys: &mut BTreeSet<String>,modifiers: &mut u8,@@ -329,8 +329,8 @@ pub fn element_send_keys_prepare_text_control_command(context: &ClassicDevToolsCommandContext,object_id: impl Into<String>,text: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {+) -> AutomationCommand {+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: context.command_context(),realm_id: None,world_name: None,@@ -390,7 +390,7 @@ pub fn element_send_keys_prepare_text_control_command(pub fn perform_actions_commands(context: &ClassicDevToolsCommandContext,params: &Value,-) -> Result<Vec<DevToolsCommand>, ClassicError> {+) -> Result<Vec<AutomationCommand>, ClassicError> {perform_actions_commands_with_element_origins(context,params,@@ -402,7 +402,7 @@ pub fn perform_actions_commands_with_element_origins(context: &ClassicDevToolsCommandContext,params: &Value,element_origins: &ClassicElementOriginViewportPoints,-) -> Result<Vec<DevToolsCommand>, ClassicError> {+) -> Result<Vec<AutomationCommand>, ClassicError> {let mut action_state = ClassicActionState::default();perform_actions_commands_with_state(context, params, element_origins, &mut action_state)}@@ -412,7 +412,7 @@ pub fn perform_actions_commands_with_state(params: &Value,element_origins: &ClassicElementOriginViewportPoints,action_state: &mut ClassicActionState,-) -> Result<Vec<DevToolsCommand>, ClassicError> {+) -> Result<Vec<AutomationCommand>, ClassicError> {perform_actions_commands_with_state_and_viewport(context,params,@@ -428,7 +428,7 @@ pub fn perform_actions_commands_with_state_and_viewport(element_origins: &ClassicElementOriginViewportPoints,viewport_bounds: Option<ClassicViewportBounds>,action_state: &mut ClassicActionState,-) -> Result<Vec<DevToolsCommand>, ClassicError> {+) -> Result<Vec<AutomationCommand>, ClassicError> {Ok(perform_actions_ticks_with_state_and_viewport(context,params,@@ -535,12 +535,14 @@ fn assign_touch_identifiers(}}-fn coalesce_tick_touch_dispatch_commands(commands: Vec<DevToolsCommand>) -> Vec<DevToolsCommand> {+fn coalesce_tick_touch_dispatch_commands(+ commands: Vec<AutomationCommand>,+) -> Vec<AutomationCommand> {let Some(last_touch_index) = commands.iter().enumerate().filter_map(|(index, command)| match command {- DevToolsCommand::DispatchTouchEvent(_) => Some(index),+ AutomationCommand::DispatchTouchEvent(_) => Some(index),_ => None,}).next_back()@@ -550,7 +552,7 @@ fn coalesce_tick_touch_dispatch_commands(commands: Vec<DevToolsCommand>) -> Vec<let mut touch_commands: Vec<DevToolsDispatchTouchEventCommand> = Vec::new();for command in &commands {- let DevToolsCommand::DispatchTouchEvent(command) = command else {+ let AutomationCommand::DispatchTouchEvent(command) = command else {continue;};match touch_commands.last_mut() {@@ -573,10 +575,10 @@ fn coalesce_tick_touch_dispatch_commands(commands: Vec<DevToolsCommand>) -> Vec<touch_commands.iter().cloned()- .map(DevToolsCommand::DispatchTouchEvent),+ .map(AutomationCommand::DispatchTouchEvent),);}- if !matches!(command, DevToolsCommand::DispatchTouchEvent(_)) {+ if !matches!(command, AutomationCommand::DispatchTouchEvent(_)) {coalesced.push(command);}}@@ -586,7 +588,7 @@ fn coalesce_tick_touch_dispatch_commands(commands: Vec<DevToolsCommand>) -> Vec<pub fn release_actions_commands(context: &ClassicDevToolsCommandContext,action_state: &mut ClassicActionState,-) -> Vec<DevToolsCommand> {+) -> Vec<AutomationCommand> {let mut commands = Vec::new();let cancel_list = std::mem::take(&mut action_state.cancel_list);for cancel in cancel_list.into_iter().rev() {@@ -780,7 +782,7 @@ impl ClassicActionSource {&mut self,context: &ClassicDevToolsCommandContext,action: &Value,- commands: &mut Vec<DevToolsCommand>,+ commands: &mut Vec<AutomationCommand>,element_origins: &ClassicElementOriginViewportPoints,viewport_bounds: Option<ClassicViewportBounds>,cancel_list: &mut Vec<ClassicActionCancel>,@@ -954,7 +956,7 @@ impl ClassicPointerActionSource {&mut self,context: &ClassicDevToolsCommandContext,action: &Value,- commands: &mut Vec<DevToolsCommand>,+ commands: &mut Vec<AutomationCommand>,element_origins: &ClassicElementOriginViewportPoints,viewport_bounds: Option<ClassicViewportBounds>,cancel_list: &mut Vec<ClassicActionCancel>,@@ -1180,7 +1182,7 @@ impl ClassicKeyActionSource {&mut self,context: &ClassicDevToolsCommandContext,action: &Value,- commands: &mut Vec<DevToolsCommand>,+ commands: &mut Vec<AutomationCommand>,cancel_list: &mut Vec<ClassicActionCancel>,) -> Result<(), ClassicError> {let object = action.as_object().ok_or_else(|| {@@ -1276,7 +1278,7 @@ impl ClassicWheelActionSource {&mut self,context: &ClassicDevToolsCommandContext,action: &Value,- commands: &mut Vec<DevToolsCommand>,+ commands: &mut Vec<AutomationCommand>,element_origins: &ClassicElementOriginViewportPoints,viewport_bounds: Option<ClassicViewportBounds>,) -> Result<(), ClassicError> {@@ -1347,7 +1349,7 @@ fn dispatch_mouse_event_command(y: f64,button: i32,buttons: Option<i32>,-) -> DevToolsCommand {+) -> AutomationCommand {dispatch_mouse_event_command_with_pointer_properties(context,event_type,@@ -1369,7 +1371,7 @@ fn dispatch_mouse_event_command_with_pointer_properties(button: i32,buttons: Option<i32>,properties: ClassicPointerEventProperties,-) -> DevToolsCommand {+) -> AutomationCommand {dispatch_mouse_event_command_with_pointer_properties_and_click_count(context,event_type,@@ -1393,7 +1395,7 @@ fn dispatch_mouse_event_command_with_pointer_properties_and_click_count(buttons: Option<i32>,properties: ClassicPointerEventProperties,click_count: i32,-) -> DevToolsCommand {+) -> AutomationCommand {dispatch_mouse_event_command_with_delta_and_pointer_properties(context,event_type,@@ -1419,7 +1421,7 @@ fn dispatch_mouse_event_command_with_delta(buttons: Option<i32>,delta_x: f64,delta_y: f64,-) -> DevToolsCommand {+) -> AutomationCommand {dispatch_mouse_event_command_with_delta_and_pointer_properties(context,event_type,@@ -1447,8 +1449,8 @@ fn dispatch_mouse_event_command_with_delta_and_pointer_properties(delta_x: f64,delta_y: f64,properties: ClassicPointerEventProperties,-) -> DevToolsCommand {- DevToolsCommand::DispatchMouseEvent(DevToolsDispatchMouseEventCommand {+) -> AutomationCommand {+ AutomationCommand::DispatchMouseEvent(DevToolsDispatchMouseEventCommand {context: context.command_context(),event_type,pointer_type,@@ -1481,8 +1483,8 @@ fn dispatch_touch_event_command(id: i32,x: f64,y: f64,-) -> DevToolsCommand {- DevToolsCommand::DispatchTouchEvent(DevToolsDispatchTouchEventCommand {+) -> AutomationCommand {+ AutomationCommand::DispatchTouchEvent(DevToolsDispatchTouchEventCommand {context: context.command_context(),event_type,touch_points: vec![DevToolsTouchPoint { id, x, y }],@@ -1498,8 +1500,8 @@ fn dispatch_key_event_command_with_modifiers(modifiers: u8,auto_repeat: bool,should_insert_text: bool,-) -> DevToolsCommand {- DevToolsCommand::DispatchKeyEvent(DevToolsDispatchKeyEventCommand {+) -> AutomationCommand {+ AutomationCommand::DispatchKeyEvent(DevToolsDispatchKeyEventCommand {context: context.command_context(),event_type,key: key.to_owned(),diff --git a/moli-protocol-webdriver-classic/src/commands/alerts.rs b/moli-protocol-webdriver-classic/src/commands/alerts.rsindex 8398b04de..e84950f6d 100644--- a/moli-protocol-webdriver-classic/src/commands/alerts.rs+++ b/moli-protocol-webdriver-classic/src/commands/alerts.rs@@ -1,5 +1,5 @@-use moli_protocol::devtools_runtime::{- DevToolsCommand, DevToolsGetJavaScriptDialogCommand, DevToolsHandleJavaScriptDialogCommand,+use moli_protocol::automation::{+ AutomationCommand, DevToolsGetJavaScriptDialogCommand, DevToolsHandleJavaScriptDialogCommand,DevToolsSetJavaScriptDialogPromptTextCommand,};use serde_json::Value;@@ -8,8 +8,8 @@ use crate::{ClassicDevToolsCommandContext, ClassicError};use super::parsing::required_string;-pub fn alert_text_command(context: &ClassicDevToolsCommandContext) -> DevToolsCommand {- DevToolsCommand::GetJavaScriptDialog(DevToolsGetJavaScriptDialogCommand {+pub fn alert_text_command(context: &ClassicDevToolsCommandContext) -> AutomationCommand {+ AutomationCommand::GetJavaScriptDialog(DevToolsGetJavaScriptDialogCommand {context: context.command_context(),})}@@ -17,8 +17,8 @@ pub fn alert_text_command(context: &ClassicDevToolsCommandContext) -> DevToolsCopub fn alert_handle_command(context: &ClassicDevToolsCommandContext,accept: bool,-) -> DevToolsCommand {- DevToolsCommand::HandleJavaScriptDialog(DevToolsHandleJavaScriptDialogCommand {+) -> AutomationCommand {+ AutomationCommand::HandleJavaScriptDialog(DevToolsHandleJavaScriptDialogCommand {context: context.command_context(),accept,prompt_text: String::new(),@@ -28,8 +28,8 @@ pub fn alert_handle_command(pub fn alert_send_text_command(context: &ClassicDevToolsCommandContext,params: &Value,-) -> Result<DevToolsCommand, ClassicError> {- Ok(DevToolsCommand::SetJavaScriptDialogPromptText(+) -> Result<AutomationCommand, ClassicError> {+ Ok(AutomationCommand::SetJavaScriptDialogPromptText(DevToolsSetJavaScriptDialogPromptTextCommand {context: context.command_context(),prompt_text: required_string(params, "text")?.to_owned(),diff --git a/moli-protocol-webdriver-classic/src/commands/cookies.rs b/moli-protocol-webdriver-classic/src/commands/cookies.rsindex 0a799b32c..c8ef2a926 100644--- a/moli-protocol-webdriver-classic/src/commands/cookies.rs+++ b/moli-protocol-webdriver-classic/src/commands/cookies.rs@@ -1,6 +1,6 @@-use moli_protocol::devtools_runtime::{- DevToolsCommand, DevToolsCookieParam, DevToolsDeleteCookiesCommand, DevToolsGetCookiesCommand,- DevToolsGetCookiesResult, DevToolsSetCookiesCommand,+use moli_protocol::automation::{+ AutomationCommand, DevToolsCookieParam, DevToolsDeleteCookiesCommand,+ DevToolsGetCookiesCommand, DevToolsGetCookiesResult, DevToolsSetCookiesCommand,};use serde_json::{Value, json};@@ -13,8 +13,8 @@ use super::parsing::{pub fn get_cookies_command(context: &ClassicDevToolsCommandContext,current_url: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::GetCookies(DevToolsGetCookiesCommand {+) -> AutomationCommand {+ AutomationCommand::GetCookies(DevToolsGetCookiesCommand {context: context.command_context(),browser_context_id: None,urls: Some(vec![current_url.into()]),@@ -26,7 +26,7 @@ pub fn add_cookie_command(context: &ClassicDevToolsCommandContext,params: &Value,current_url: impl Into<String>,-) -> Result<DevToolsCommand, ClassicError> {+) -> Result<AutomationCommand, ClassicError> {let cookie = params.get("cookie").and_then(Value::as_object)@@ -47,7 +47,7 @@ pub fn add_cookie_command("sameSite must be None, Lax, or Strict",));}- Ok(DevToolsCommand::SetCookies(DevToolsSetCookiesCommand {+ Ok(AutomationCommand::SetCookies(DevToolsSetCookiesCommand {context: context.command_context(),browser_context_id: None,cookies: vec![DevToolsCookieParam {@@ -72,8 +72,8 @@ pub fn add_cookie_command(pub fn delete_all_cookies_command(context: &ClassicDevToolsCommandContext,current_url: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::DeleteCookies(DevToolsDeleteCookiesCommand {+) -> AutomationCommand {+ AutomationCommand::DeleteCookies(DevToolsDeleteCookiesCommand {context: context.command_context(),browser_context_id: None,name: None,@@ -89,8 +89,8 @@ pub fn delete_cookie_command(context: &ClassicDevToolsCommandContext,name: impl Into<String>,current_url: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::DeleteCookies(DevToolsDeleteCookiesCommand {+) -> AutomationCommand {+ AutomationCommand::DeleteCookies(DevToolsDeleteCookiesCommand {context: context.command_context(),browser_context_id: None,name: Some(name.into()),diff --git a/moli-protocol-webdriver-classic/src/commands/elements.rs b/moli-protocol-webdriver-classic/src/commands/elements.rsindex 59bba9592..5eb64af6b 100644--- a/moli-protocol-webdriver-classic/src/commands/elements.rs+++ b/moli-protocol-webdriver-classic/src/commands/elements.rs@@ -1,5 +1,5 @@-use moli_protocol::devtools_runtime::{- DevToolsCallFunctionCommand, DevToolsCommand, DevToolsDescribeNodeCommand,+use moli_protocol::automation::{+ AutomationCommand, DevToolsCallFunctionCommand, DevToolsDescribeNodeCommand,DevToolsDomGeometryCommand, DevToolsDomGeometryOperation, DevToolsDomNodeReference,DevToolsEvaluateScriptCommand, DevToolsGetAttributesCommand, DevToolsGetAttributesResult,DevToolsGetPropertyCommand, DevToolsGetPropertyResult, DevToolsGetTextCommand,@@ -21,7 +21,7 @@ pub fn find_element_command(context: &ClassicDevToolsCommandContext,params: &Value,multiple: bool,-) -> Result<DevToolsCommand, ClassicError> {+) -> Result<AutomationCommand, ClassicError> {find_element_command_with_root(context, params, multiple, None)}@@ -30,7 +30,7 @@ pub fn find_element_command_with_root(params: &Value,multiple: bool,root: Option<DevToolsDomNodeReference>,-) -> Result<DevToolsCommand, ClassicError> {+) -> Result<AutomationCommand, ClassicError> {let using = required_string(params, "using")?;let value = required_string(params, "value")?;if using == "xpath"@@ -49,7 +49,7 @@ pub fn find_element_command_with_root(},));}- return Ok(DevToolsCommand::LocateNodes(DevToolsLocateNodesCommand {+ return Ok(AutomationCommand::LocateNodes(DevToolsLocateNodesCommand {context: context.command_context(),locator: match using {"xpath" => DevToolsLocateNodesLocator::XPath(value.to_owned()),@@ -76,7 +76,7 @@ pub fn find_element_command_with_root("value must be a non-empty selector",));}- Ok(DevToolsCommand::QuerySelector(+ Ok(AutomationCommand::QuerySelector(DevToolsQuerySelectorCommand {context: context.command_context(),root,@@ -233,7 +233,7 @@ pub fn classic_elements_from_locate_nodes_result(result: DevToolsLocateNodesResupub fn get_element_attributes_command(context: &ClassicDevToolsCommandContext,element_id: &str,-) -> Result<DevToolsCommand, ClassicError> {+) -> Result<AutomationCommand, ClassicError> {let reference = dom_node_reference_from_classic_element_id(element_id)?;Ok(get_element_attributes_reference_command(context, reference))}@@ -241,8 +241,8 @@ pub fn get_element_attributes_command(pub fn get_element_attributes_reference_command(context: &ClassicDevToolsCommandContext,reference: DevToolsDomNodeReference,-) -> DevToolsCommand {- DevToolsCommand::GetAttributes(DevToolsGetAttributesCommand {+) -> AutomationCommand {+ AutomationCommand::GetAttributes(DevToolsGetAttributesCommand {context: context.command_context(),reference,})@@ -251,7 +251,7 @@ pub fn get_element_attributes_reference_command(pub fn get_element_text_command(context: &ClassicDevToolsCommandContext,element_id: &str,-) -> Result<DevToolsCommand, ClassicError> {+) -> Result<AutomationCommand, ClassicError> {let reference = dom_node_reference_from_classic_element_id(element_id)?;Ok(get_element_text_reference_command(context, reference))}@@ -259,8 +259,8 @@ pub fn get_element_text_command(pub fn get_element_text_reference_command(context: &ClassicDevToolsCommandContext,reference: DevToolsDomNodeReference,-) -> DevToolsCommand {- DevToolsCommand::GetText(DevToolsGetTextCommand {+) -> AutomationCommand {+ AutomationCommand::GetText(DevToolsGetTextCommand {context: context.command_context(),reference,})@@ -270,7 +270,7 @@ pub fn get_element_property_command(context: &ClassicDevToolsCommandContext,element_id: &str,name: impl Into<String>,-) -> Result<DevToolsCommand, ClassicError> {+) -> Result<AutomationCommand, ClassicError> {let reference = dom_node_reference_from_classic_element_id(element_id)?;Ok(get_element_property_reference_command(context, reference, name,@@ -281,8 +281,8 @@ pub fn get_element_property_reference_command(context: &ClassicDevToolsCommandContext,reference: DevToolsDomNodeReference,name: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::GetProperty(DevToolsGetPropertyCommand {+) -> AutomationCommand {+ AutomationCommand::GetProperty(DevToolsGetPropertyCommand {context: context.command_context(),reference,name: name.into(),@@ -293,8 +293,8 @@ pub fn get_element_css_value_command(context: &ClassicDevToolsCommandContext,object_id: impl Into<String>,property_name: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {+) -> AutomationCommand {+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: context.command_context(),realm_id: None,world_name: None,@@ -323,8 +323,8 @@ pub fn get_element_css_value_command(pub fn get_element_displayed_command(context: &ClassicDevToolsCommandContext,object_id: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {+) -> AutomationCommand {+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: context.command_context(),realm_id: None,world_name: None,@@ -346,8 +346,8 @@ pub fn get_element_displayed_command(pub fn get_element_rendered_text_command(context: &ClassicDevToolsCommandContext,object_id: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {+) -> AutomationCommand {+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: context.command_context(),realm_id: None,world_name: None,@@ -369,8 +369,8 @@ pub fn get_element_rendered_text_command(pub fn get_element_enabled_command(context: &ClassicDevToolsCommandContext,object_id: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {+) -> AutomationCommand {+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: context.command_context(),realm_id: None,world_name: None,@@ -392,8 +392,8 @@ pub fn get_element_enabled_command(pub fn get_element_computed_label_command(context: &ClassicDevToolsCommandContext,object_id: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {+) -> AutomationCommand {+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: context.command_context(),realm_id: None,world_name: None,@@ -415,8 +415,8 @@ pub fn get_element_computed_label_command(pub fn get_element_computed_role_command(context: &ClassicDevToolsCommandContext,object_id: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {+) -> AutomationCommand {+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: context.command_context(),realm_id: None,world_name: None,@@ -438,8 +438,8 @@ pub fn get_element_computed_role_command(pub fn get_element_shadow_root_command(context: &ClassicDevToolsCommandContext,object_id: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {+) -> AutomationCommand {+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: context.command_context(),realm_id: None,world_name: None,@@ -469,7 +469,7 @@ pub fn describe_node_command(node_id: u32,depth: i32,pierce: bool,-) -> DevToolsCommand {+) -> AutomationCommand {describe_node_reference_command(context,DevToolsDomNodeReference::FrontendNodeId(node_id),@@ -483,8 +483,8 @@ pub fn describe_node_reference_command(reference: DevToolsDomNodeReference,depth: i32,pierce: bool,-) -> DevToolsCommand {- DevToolsCommand::DescribeNode(DevToolsDescribeNodeCommand {+) -> AutomationCommand {+ AutomationCommand::DescribeNode(DevToolsDescribeNodeCommand {context: context.command_context(),reference: Some(reference),depth,@@ -495,8 +495,8 @@ pub fn describe_node_reference_command(pub fn verify_element_attached_command(context: &ClassicDevToolsCommandContext,object_id: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {+) -> AutomationCommand {+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: context.command_context(),realm_id: None,world_name: None,@@ -524,8 +524,8 @@ pub fn verify_element_attached_command(pub fn shadow_root_attached_command(context: &ClassicDevToolsCommandContext,object_id: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {+) -> AutomationCommand {+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: context.command_context(),realm_id: None,world_name: None,@@ -555,14 +555,14 @@ pub fn shadow_root_attached_command(pub fn get_element_tag_name_command(context: &ClassicDevToolsCommandContext,element_id: &str,-) -> Result<DevToolsCommand, ClassicError> {+) -> Result<AutomationCommand, ClassicError> {get_element_property_command(context, element_id, "localName")}pub fn get_element_rect_command(context: &ClassicDevToolsCommandContext,element_id: &str,-) -> Result<DevToolsCommand, ClassicError> {+) -> Result<AutomationCommand, ClassicError> {let reference = dom_node_reference_from_classic_element_id(element_id)?;Ok(get_element_rect_reference_command(context, reference))}@@ -570,16 +570,16 @@ pub fn get_element_rect_command(pub fn get_element_rect_reference_command(context: &ClassicDevToolsCommandContext,reference: DevToolsDomNodeReference,-) -> DevToolsCommand {- DevToolsCommand::DomGeometry(DevToolsDomGeometryCommand {+) -> AutomationCommand {+ AutomationCommand::DomGeometry(DevToolsDomGeometryCommand {context: context.command_context(),reference,operation: DevToolsDomGeometryOperation::GetBoxModel,})}-pub fn active_element_command(context: &ClassicDevToolsCommandContext) -> DevToolsCommand {- DevToolsCommand::EvaluateScript(DevToolsEvaluateScriptCommand {+pub fn active_element_command(context: &ClassicDevToolsCommandContext) -> AutomationCommand {+ AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {context: context.command_context(),realm_id: None,world_name: None,@@ -599,7 +599,7 @@ pub fn resolve_element_command(context: &ClassicDevToolsCommandContext,element_id: &str,object_group: impl Into<String>,-) -> Result<DevToolsCommand, ClassicError> {+) -> Result<AutomationCommand, ClassicError> {let reference = dom_node_reference_from_classic_element_id(element_id)?;Ok(resolve_element_reference_command(context,@@ -612,7 +612,7 @@ pub fn resolve_element_reference_command(context: &ClassicDevToolsCommandContext,reference: DevToolsDomNodeReference,object_group: impl Into<String>,-) -> DevToolsCommand {+) -> AutomationCommand {resolve_element_reference_command_with_execution_context(context, reference, None, object_group)}@@ -621,8 +621,8 @@ pub fn resolve_element_reference_command_with_execution_context(reference: DevToolsDomNodeReference,execution_context_id: Option<i64>,object_group: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::ResolveNode(DevToolsResolveNodeCommand {+) -> AutomationCommand {+ AutomationCommand::ResolveNode(DevToolsResolveNodeCommand {context: context.command_context(),reference,execution_context_id,@@ -634,7 +634,7 @@ pub fn resolve_shadow_root_command(context: &ClassicDevToolsCommandContext,shadow_root_id: &str,object_group: impl Into<String>,-) -> Result<DevToolsCommand, ClassicError> {+) -> Result<AutomationCommand, ClassicError> {let reference = dom_node_reference_from_classic_shadow_root_id(shadow_root_id)?;Ok(resolve_shadow_root_reference_command(context,@@ -647,7 +647,7 @@ pub fn resolve_shadow_root_reference_command(context: &ClassicDevToolsCommandContext,reference: DevToolsDomNodeReference,object_group: impl Into<String>,-) -> DevToolsCommand {+) -> AutomationCommand {resolve_shadow_root_reference_command_with_execution_context(context,reference,@@ -661,8 +661,8 @@ pub fn resolve_shadow_root_reference_command_with_execution_context(reference: DevToolsDomNodeReference,execution_context_id: Option<i64>,object_group: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::ResolveNode(DevToolsResolveNodeCommand {+) -> AutomationCommand {+ AutomationCommand::ResolveNode(DevToolsResolveNodeCommand {context: context.command_context(),reference,execution_context_id,@@ -673,8 +673,8 @@ pub fn resolve_shadow_root_reference_command_with_execution_context(pub fn frame_id_for_element_command(context: &ClassicDevToolsCommandContext,object_id: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {+) -> AutomationCommand {+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: context.command_context(),realm_id: None,world_name: None,@@ -696,8 +696,8 @@ pub fn frame_id_for_element_command(pub fn release_remote_object_command(context: &ClassicDevToolsCommandContext,object_id: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::ReleaseObjects(DevToolsReleaseObjectsCommand {+) -> AutomationCommand {+ AutomationCommand::ReleaseObjects(DevToolsReleaseObjectsCommand {context: context.command_context(),realm_id: None,world_name: None,@@ -717,8 +717,8 @@ const CLASSIC_FRAME_ID_FOR_ELEMENT_FUNCTION: &str = r#"function() {pub fn clear_element_command(context: &ClassicDevToolsCommandContext,object_id: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {+) -> AutomationCommand {+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: context.command_context(),realm_id: None,world_name: None,@@ -740,8 +740,8 @@ pub fn clear_element_command(pub fn element_click_command(context: &ClassicDevToolsCommandContext,object_id: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::CallFunction(element_click_call_function(context, object_id))+) -> AutomationCommand {+ AutomationCommand::CallFunction(element_click_call_function(context, object_id))}fn element_click_call_function(@@ -805,14 +805,14 @@ fn element_click_call_function(pub fn element_geometry_prepare_commands(context: &ClassicDevToolsCommandContext,reference: DevToolsDomNodeReference,-) -> Vec<DevToolsCommand> {+) -> Vec<AutomationCommand> {vec![- DevToolsCommand::ScrollIntoViewIfNeeded(DevToolsScrollIntoViewIfNeededCommand {+ AutomationCommand::ScrollIntoViewIfNeeded(DevToolsScrollIntoViewIfNeededCommand {context: context.command_context(),reference: Some(reference.clone()),rect: None,}),- DevToolsCommand::DomGeometry(DevToolsDomGeometryCommand {+ AutomationCommand::DomGeometry(DevToolsDomGeometryCommand {context: context.command_context(),reference,operation: DevToolsDomGeometryOperation::GetBoxModel,@@ -901,7 +901,7 @@ pub fn classic_property_value(result: DevToolsGetPropertyResult) -> Value {}pub fn classic_rect_from_geometry(- geometry: &moli_protocol::devtools_runtime::DevToolsDomGeometryResult,+ geometry: &moli_protocol::automation::DevToolsDomGeometryResult,) -> Result<Value, ClassicError> {let Some(quad) = geometry_border_quad(geometry) else {return Err(ClassicError::new(diff --git a/moli-protocol-webdriver-classic/src/commands/errors.rs b/moli-protocol-webdriver-classic/src/commands/errors.rsindex 2f67e1391..f2bc46050 100644--- a/moli-protocol-webdriver-classic/src/commands/errors.rs+++ b/moli-protocol-webdriver-classic/src/commands/errors.rs@@ -1,4 +1,4 @@-use moli_protocol::devtools_runtime::{DevToolsError, DevToolsErrorKind};+use moli_protocol::automation::{DevToolsError, DevToolsErrorKind};use crate::{ClassicError, ClassicErrorCode};diff --git a/moli-protocol-webdriver-classic/src/commands/navigation.rs b/moli-protocol-webdriver-classic/src/commands/navigation.rsindex ed1ee4a7b..ac5468bb7 100644--- a/moli-protocol-webdriver-classic/src/commands/navigation.rs+++ b/moli-protocol-webdriver-classic/src/commands/navigation.rs@@ -1,5 +1,5 @@-use moli_protocol::devtools_runtime::{- DevToolsCommand, DevToolsEvaluateScriptCommand, DevToolsGetNavigationHistoryCommand,+use moli_protocol::automation::{+ AutomationCommand, DevToolsEvaluateScriptCommand, DevToolsGetNavigationHistoryCommand,DevToolsGetNavigationHistoryResult, DevToolsGetOuterHtmlCommand, DevToolsGetTargetsCommand,DevToolsHistoryTraversalDestination, DevToolsNavigateCommand, DevToolsNavigationWait,DevToolsReloadCommand, DevToolsResultOwnership, DevToolsTargetId,@@ -16,7 +16,7 @@ pub fn navigate_command(context: &ClassicDevToolsCommandContext,params: &Value,wait: DevToolsNavigationWait,-) -> Result<DevToolsCommand, ClassicError> {+) -> Result<AutomationCommand, ClassicError> {let url = required_string(params, "url")?;if Url::parse(url).is_err() {return Err(ClassicError::new(@@ -24,7 +24,7 @@ pub fn navigate_command("url must be a valid absolute URL",));}- Ok(DevToolsCommand::Navigate(DevToolsNavigateCommand {+ Ok(AutomationCommand::Navigate(DevToolsNavigateCommand {context: context.command_context(),url: url.to_owned(),referrer: None,@@ -32,8 +32,8 @@ pub fn navigate_command(}))}-pub fn current_url_command(context: &ClassicDevToolsCommandContext) -> DevToolsCommand {- DevToolsCommand::GetTargets(DevToolsGetTargetsCommand {+pub fn current_url_command(context: &ClassicDevToolsCommandContext) -> AutomationCommand {+ AutomationCommand::GetTargets(DevToolsGetTargetsCommand {context: context.command_context(),root: context.target_id.as_deref().map(DevToolsTargetId::from),max_depth: None,@@ -41,8 +41,8 @@ pub fn current_url_command(context: &ClassicDevToolsCommandContext) -> DevToolsC})}-pub fn title_command(context: &ClassicDevToolsCommandContext) -> DevToolsCommand {- DevToolsCommand::EvaluateScript(DevToolsEvaluateScriptCommand {+pub fn title_command(context: &ClassicDevToolsCommandContext) -> AutomationCommand {+ AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {context: context.command_context(),realm_id: None,world_name: None,@@ -57,8 +57,8 @@ pub fn title_command(context: &ClassicDevToolsCommandContext) -> DevToolsCommand})}-pub fn page_source_command(context: &ClassicDevToolsCommandContext) -> DevToolsCommand {- DevToolsCommand::GetOuterHtml(DevToolsGetOuterHtmlCommand {+pub fn page_source_command(context: &ClassicDevToolsCommandContext) -> AutomationCommand {+ AutomationCommand::GetOuterHtml(DevToolsGetOuterHtmlCommand {context: context.command_context(),reference: None,include_shadow_dom: false,@@ -68,8 +68,8 @@ pub fn page_source_command(context: &ClassicDevToolsCommandContext) -> DevToolsCpub fn refresh_command(context: &ClassicDevToolsCommandContext,wait: DevToolsNavigationWait,-) -> DevToolsCommand {- DevToolsCommand::Reload(DevToolsReloadCommand {+) -> AutomationCommand {+ AutomationCommand::Reload(DevToolsReloadCommand {context: context.command_context(),ignore_cache: false,script_to_evaluate_on_load: None,@@ -77,8 +77,8 @@ pub fn refresh_command(})}-pub fn navigation_history_command(context: &ClassicDevToolsCommandContext) -> DevToolsCommand {- DevToolsCommand::GetNavigationHistory(DevToolsGetNavigationHistoryCommand {+pub fn navigation_history_command(context: &ClassicDevToolsCommandContext) -> AutomationCommand {+ AutomationCommand::GetNavigationHistory(DevToolsGetNavigationHistoryCommand {context: context.command_context(),})}@@ -100,8 +100,8 @@ pub fn traverse_history_command(entry_id: i32,url: impl Into<String>,wait: DevToolsNavigationWait,-) -> DevToolsCommand {- DevToolsCommand::TraverseHistory(DevToolsTraverseHistoryCommand {+) -> AutomationCommand {+ AutomationCommand::TraverseHistory(DevToolsTraverseHistoryCommand {context: context.command_context(),destination: DevToolsHistoryTraversalDestination::Entry {entry_id,diff --git a/moli-protocol-webdriver-classic/src/commands/script.rs b/moli-protocol-webdriver-classic/src/commands/script.rsindex 0e1f51562..cd22f2eed 100644--- a/moli-protocol-webdriver-classic/src/commands/script.rs+++ b/moli-protocol-webdriver-classic/src/commands/script.rs@@ -1,5 +1,5 @@-use moli_protocol::devtools_runtime::{- DevToolsCallFunctionCommand, DevToolsCommand, DevToolsResultOwnership,+use moli_protocol::automation::{+ AutomationCommand, DevToolsCallFunctionCommand, DevToolsResultOwnership,};use serde_json::Value;@@ -10,40 +10,43 @@ use super::parsing::{classic_script_arguments, required_string};pub fn execute_sync_command(context: &ClassicDevToolsCommandContext,params: &Value,-) -> Result<DevToolsCommand, ClassicError> {+) -> Result<AutomationCommand, ClassicError> {let script = required_string(params, "script")?;- Ok(DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {- context: context.command_context(),- realm_id: None,- world_name: None,- object_id: None,- this_parameter: None,- function_declaration: format!("async function() {{\n{script}\n}}"),- arguments: classic_script_arguments(params)?,- await_promise: true,- user_gesture: false,- webdriver_bidi_file_prompt_handler: None,- result_ownership: DevToolsResultOwnership::None,- object_group: None,- preserve_remote_metadata: false,- materialize_bidi_script_result: false,- serialization_options: None,- }))+ Ok(AutomationCommand::CallFunction(+ DevToolsCallFunctionCommand {+ context: context.command_context(),+ realm_id: None,+ world_name: None,+ object_id: None,+ this_parameter: None,+ function_declaration: format!("async function() {{\n{script}\n}}"),+ arguments: classic_script_arguments(params)?,+ await_promise: true,+ user_gesture: false,+ webdriver_bidi_file_prompt_handler: None,+ result_ownership: DevToolsResultOwnership::None,+ object_group: None,+ preserve_remote_metadata: false,+ materialize_bidi_script_result: false,+ serialization_options: None,+ },+ ))}pub fn execute_async_command(context: &ClassicDevToolsCommandContext,params: &Value,-) -> Result<DevToolsCommand, ClassicError> {+) -> Result<AutomationCommand, ClassicError> {let script = required_string(params, "script")?;- Ok(DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {- context: context.command_context(),- realm_id: None,- world_name: None,- object_id: None,- this_parameter: None,- function_declaration: format!(- "function() {{\n\+ Ok(AutomationCommand::CallFunction(+ DevToolsCallFunctionCommand {+ context: context.command_context(),+ realm_id: None,+ world_name: None,+ object_id: None,+ this_parameter: None,+ function_declaration: format!(+ "function() {{\n\const __moliUserFunction = async function() {{\n\{script}\n\}};\n\@@ -74,15 +77,16 @@ pub fn execute_async_command(}}\n\}});\n\}}"- ),- arguments: classic_script_arguments(params)?,- await_promise: true,- user_gesture: false,- webdriver_bidi_file_prompt_handler: None,- result_ownership: DevToolsResultOwnership::None,- object_group: None,- preserve_remote_metadata: false,- materialize_bidi_script_result: false,- serialization_options: None,- }))+ ),+ arguments: classic_script_arguments(params)?,+ await_promise: true,+ user_gesture: false,+ webdriver_bidi_file_prompt_handler: None,+ result_ownership: DevToolsResultOwnership::None,+ object_group: None,+ preserve_remote_metadata: false,+ materialize_bidi_script_result: false,+ serialization_options: None,+ },+ ))}diff --git a/moli-protocol-webdriver-classic/src/commands/window.rs b/moli-protocol-webdriver-classic/src/commands/window.rsindex 92d6d7b66..be5beed5d 100644--- a/moli-protocol-webdriver-classic/src/commands/window.rs+++ b/moli-protocol-webdriver-classic/src/commands/window.rs@@ -1,6 +1,6 @@-use moli_protocol::devtools_runtime::{- DevToolsActivateTargetCommand, DevToolsCaptureScreenshotClip, DevToolsCaptureScreenshotCommand,- DevToolsCloseTargetCommand, DevToolsCommand, DevToolsCreateTargetCommand,+use moli_protocol::automation::{+ AutomationCommand, DevToolsActivateTargetCommand, DevToolsCaptureScreenshotClip,+ DevToolsCaptureScreenshotCommand, DevToolsCloseTargetCommand, DevToolsCreateTargetCommand,DevToolsDevicePixelRatioSetting, DevToolsGetLayoutMetricsCommand, DevToolsGetTargetsCommand,DevToolsGetTargetsResult, DevToolsPrintToPdfCommand, DevToolsPrintToPdfTransferMode,DevToolsRemoteHandleId, DevToolsScreenshotElementClip, DevToolsSetViewportCommand,@@ -19,8 +19,8 @@ pub const CLASSIC_HEADLESS_SCREEN_WIDTH: u32 = 1920;pub const CLASSIC_HEADLESS_SCREEN_HEIGHT: u32 = 1080;pub const CLASSIC_HEADLESS_AVAILABLE_HEIGHT: u32 = 1040;-pub fn create_initial_target_command(context: &ClassicDevToolsCommandContext) -> DevToolsCommand {- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+pub fn create_initial_target_command(context: &ClassicDevToolsCommandContext) -> AutomationCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: context.command_context(),url: "about:blank".to_owned(),browser_context_id: None,@@ -28,8 +28,8 @@ pub fn create_initial_target_command(context: &ClassicDevToolsCommandContext) ->})}-pub fn layout_metrics_command(context: &ClassicDevToolsCommandContext) -> DevToolsCommand {- DevToolsCommand::GetLayoutMetrics(DevToolsGetLayoutMetricsCommand {+pub fn layout_metrics_command(context: &ClassicDevToolsCommandContext) -> AutomationCommand {+ AutomationCommand::GetLayoutMetrics(DevToolsGetLayoutMetricsCommand {context: context.command_context(),})}@@ -109,7 +109,7 @@ pub fn set_window_rect_command(context: &ClassicDevToolsCommandContext,width: u32,height: u32,-) -> DevToolsCommand {+) -> AutomationCommand {set_window_rect_command_with_screen(context, width, height, None, None)}@@ -119,8 +119,8 @@ pub fn set_window_rect_command_with_screen(height: u32,screen_width: Option<u32>,screen_height: Option<u32>,-) -> DevToolsCommand {- DevToolsCommand::SetViewport(DevToolsSetViewportCommand {+) -> AutomationCommand {+ AutomationCommand::SetViewport(DevToolsSetViewportCommand {context: context.command_context(),browser_context_ids: Vec::new(),viewport: DevToolsViewportSetting::Dimensions { width, height },@@ -154,7 +154,7 @@ pub fn classic_window_rect_for_state(pub fn set_window_state_command(context: &ClassicDevToolsCommandContext,state: ClassicWindowState,-) -> Option<DevToolsCommand> {+) -> Option<AutomationCommand> {let rect = classic_window_rect_for_state(ClassicWindowRect {x: 0,@@ -181,7 +181,7 @@ pub fn set_window_state_command(pub fn set_window_surface_state_command(context: &ClassicDevToolsCommandContext,state: ClassicWindowState,-) -> DevToolsCommand {+) -> AutomationCommand {set_window_surface_state_command_from_devtools(context,match state {@@ -194,15 +194,15 @@ pub fn set_window_surface_state_command(pub fn set_window_normal_surface_state_command(context: &ClassicDevToolsCommandContext,-) -> DevToolsCommand {+) -> AutomationCommand {set_window_surface_state_command_from_devtools(context, DevToolsWindowState::Normal)}fn set_window_surface_state_command_from_devtools(context: &ClassicDevToolsCommandContext,state: DevToolsWindowState,-) -> DevToolsCommand {- DevToolsCommand::SetWindowState(DevToolsSetWindowStateCommand {+) -> AutomationCommand {+ AutomationCommand::SetWindowState(DevToolsSetWindowStateCommand {context: context.command_context(),state,})@@ -259,8 +259,8 @@ fn optional_window_dimension(Ok(Some(value as u32))}-pub fn screenshot_command(context: &ClassicDevToolsCommandContext) -> DevToolsCommand {- DevToolsCommand::CaptureScreenshot(DevToolsCaptureScreenshotCommand {+pub fn screenshot_command(context: &ClassicDevToolsCommandContext) -> AutomationCommand {+ AutomationCommand::CaptureScreenshot(DevToolsCaptureScreenshotCommand {context: context.command_context(),format: Some("png".to_owned()),quality: None,@@ -273,8 +273,8 @@ pub fn screenshot_command(context: &ClassicDevToolsCommandContext) -> DevToolsCopub fn element_screenshot_command(context: &ClassicDevToolsCommandContext,object_id: impl Into<String>,-) -> DevToolsCommand {- DevToolsCommand::CaptureScreenshot(DevToolsCaptureScreenshotCommand {+) -> AutomationCommand {+ AutomationCommand::CaptureScreenshot(DevToolsCaptureScreenshotCommand {context: context.command_context(),format: Some("png".to_owned()),quality: None,@@ -291,10 +291,10 @@ pub fn element_screenshot_command(pub fn print_page_command(context: &ClassicDevToolsCommandContext,params: &Value,-) -> Result<DevToolsCommand, ClassicError> {+) -> Result<AutomationCommand, ClassicError> {let margin = classic_print_margin(params.get("margin"))?;let page = classic_print_page(params.get("page"))?;- Ok(DevToolsCommand::PrintToPdf(DevToolsPrintToPdfCommand {+ Ok(AutomationCommand::PrintToPdf(DevToolsPrintToPdfCommand {context: context.command_context(),landscape: classic_print_orientation(params.get("orientation"))?,print_background: optional_bool(params, "background")?,@@ -514,8 +514,8 @@ fn valid_classic_print_page_range(range: &str) -> bool {start > 0 && end >= start}-pub fn window_handles_command(context: &ClassicDevToolsCommandContext) -> DevToolsCommand {- DevToolsCommand::GetTargets(DevToolsGetTargetsCommand {+pub fn window_handles_command(context: &ClassicDevToolsCommandContext) -> AutomationCommand {+ AutomationCommand::GetTargets(DevToolsGetTargetsCommand {context: context.command_context(),root: None,max_depth: None,@@ -543,8 +543,8 @@ pub fn new_window_type(params: &Value) -> Result<String, ClassicError> {.to_owned())}-pub fn new_window_command(context: &ClassicDevToolsCommandContext) -> DevToolsCommand {- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+pub fn new_window_command(context: &ClassicDevToolsCommandContext) -> AutomationCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: context.command_context(),url: "about:blank".to_owned(),browser_context_id: None,@@ -555,9 +555,9 @@ pub fn new_window_command(context: &ClassicDevToolsCommandContext) -> DevToolsCopub fn switch_window_command(context: &ClassicDevToolsCommandContext,params: &Value,-) -> Result<DevToolsCommand, ClassicError> {+) -> Result<AutomationCommand, ClassicError> {let handle = required_string(params, "handle")?;- Ok(DevToolsCommand::ActivateTarget(+ Ok(AutomationCommand::ActivateTarget(DevToolsActivateTargetCommand {context: ClassicDevToolsCommandContext::with_target_id(&context.session_id, handle).command_context(),@@ -569,9 +569,9 @@ pub fn switch_window_command(pub fn activate_window_command(context: &ClassicDevToolsCommandContext,target_id: impl AsRef<str>,-) -> DevToolsCommand {+) -> AutomationCommand {let target_id = target_id.as_ref();- DevToolsCommand::ActivateTarget(DevToolsActivateTargetCommand {+ AutomationCommand::ActivateTarget(DevToolsActivateTargetCommand {context: ClassicDevToolsCommandContext::with_target_id(&context.session_id, target_id).command_context(),target_id: DevToolsTargetId::from(target_id),@@ -580,14 +580,14 @@ pub fn activate_window_command(pub fn close_window_command(context: &ClassicDevToolsCommandContext,-) -> Result<DevToolsCommand, ClassicError> {+) -> Result<AutomationCommand, ClassicError> {let Some(target_id) = context.target_id.as_deref() else {return Err(ClassicError::new(ClassicErrorCode::NoSuchWindow,"current window not found",));};- Ok(DevToolsCommand::CloseTarget(DevToolsCloseTargetCommand {+ Ok(AutomationCommand::CloseTarget(DevToolsCloseTargetCommand {context: context.command_context(),target_id: DevToolsTargetId::from(target_id),}))diff --git a/moli-protocol-webdriver-classic/src/lib.rs b/moli-protocol-webdriver-classic/src/lib.rsindex fa1db815c..28ad0f060 100644--- a/moli-protocol-webdriver-classic/src/lib.rs+++ b/moli-protocol-webdriver-classic/src/lib.rs@@ -11,8 +11,8 @@ mod responses;mod types;fn geometry_border_quad(- geometry: &moli_protocol::devtools_runtime::DevToolsDomGeometryResult,-) -> Option<&moli_protocol::devtools_runtime::DevToolsDomQuad> {+ geometry: &moli_protocol::automation::DevToolsDomGeometryResult,+) -> Option<&moli_protocol::automation::DevToolsDomQuad> {geometry.box_model.as_ref()diff --git a/moli-protocol-webdriver-classic/src/tests.rs b/moli-protocol-webdriver-classic/src/tests.rsindex 8ddd703a3..0906057f1 100644--- a/moli-protocol-webdriver-classic/src/tests.rs+++ b/moli-protocol-webdriver-classic/src/tests.rs@@ -1,14 +1,14 @@-use moli_protocol::devtools_runtime::{- DevToolsCaptureScreenshotClip, DevToolsCommand, DevToolsDomBoxModel,+use moli_protocol::automation::{+ AutomationCommand, DevToolsCaptureScreenshotClip, DevToolsDomBoxModel,DevToolsDomGeometryOperation, DevToolsDomGeometryResult, DevToolsDomNodeReference,DevToolsDomQuad, DevToolsError, DevToolsErrorKind, DevToolsGetAttributesResult,DevToolsGetCookiesResult, DevToolsGetNavigationHistoryResult, DevToolsGetPropertyResult,DevToolsGetTargetsResult, DevToolsGetTextResult, DevToolsHistoryTraversalDestination,DevToolsKeyEventType, DevToolsLocateNodesLocator, DevToolsLocateNodesTextMatch,DevToolsMouseEventType, DevToolsNavigationWait, DevToolsPointerType,- DevToolsPrintToPdfTransferMode, DevToolsProtocol, DevToolsRemoteHandleId,- DevToolsResultOwnership, DevToolsSessionId, DevToolsTargetId, DevToolsTargetKind,- DevToolsTouchEventType, DevToolsViewportSetting, DevToolsWindowState,+ DevToolsPrintToPdfTransferMode, DevToolsRemoteHandleId, DevToolsResultOwnership,+ DevToolsSessionId, DevToolsTargetId, DevToolsTargetKind, DevToolsTouchEventType,+ DevToolsViewportSetting, DevToolsWindowState, FrontendProtocol,};use serde_json::json;@@ -424,11 +424,11 @@ fn creates_initial_target_command_for_webdriver_classic_session() {let command = create_initial_target_command(&context);- let DevToolsCommand::CreateTarget(command) = command else {+ let AutomationCommand::CreateTarget(command) = command else {panic!("expected CreateTarget command");};assert_eq!(command.url, "about:blank");- assert_eq!(command.context.protocol, DevToolsProtocol::WebDriverClassic);+ assert_eq!(command.context.protocol, FrontendProtocol::WebDriverClassic);assert_eq!(command.context@@ -441,7 +441,7 @@ fn creates_initial_target_command_for_webdriver_classic_session() {}#[test]-fn maps_url_commands_to_shared_devtools_commands() {+fn maps_url_commands_to_shared_automation_commands() {let context = ClassicDevToolsCommandContext::with_target_id("classic-session-1", "TID-1");let navigate = navigate_command(@@ -450,7 +450,7 @@ fn maps_url_commands_to_shared_devtools_commands() {DevToolsNavigationWait::Load,).expect("navigate command");- let DevToolsCommand::Navigate(navigate) = navigate else {+ let AutomationCommand::Navigate(navigate) = navigate else {panic!("expected Navigate command");};assert_eq!(navigate.url, "https://example.test/");@@ -465,7 +465,7 @@ fn maps_url_commands_to_shared_devtools_commands() {);let get_url = current_url_command(&context);- let DevToolsCommand::GetTargets(get_url) = get_url else {+ let AutomationCommand::GetTargets(get_url) = get_url else {panic!("expected GetTargets command");};assert_eq!(@@ -475,11 +475,11 @@ fn maps_url_commands_to_shared_devtools_commands() {}#[test]-fn maps_title_and_source_to_shared_devtools_commands() {+fn maps_title_and_source_to_shared_automation_commands() {let context = ClassicDevToolsCommandContext::with_target_id("classic-session-1", "TID-1");let title = title_command(&context);- let DevToolsCommand::EvaluateScript(title) = title else {+ let AutomationCommand::EvaluateScript(title) = title else {panic!("expected EvaluateScript command");};assert_eq!(title.expression, "document.title");@@ -495,7 +495,7 @@ fn maps_title_and_source_to_shared_devtools_commands() {);let source = page_source_command(&context);- let DevToolsCommand::GetOuterHtml(source) = source else {+ let AutomationCommand::GetOuterHtml(source) = source else {panic!("expected GetOuterHtml command");};assert_eq!(source.reference, None);@@ -523,7 +523,7 @@ fn maps_find_element_to_shared_dom_query_command() {false,).expect("find element command");- let DevToolsCommand::QuerySelector(single) = single else {+ let AutomationCommand::QuerySelector(single) = single else {panic!("expected QuerySelector command");};assert_eq!(single.root, None);@@ -547,7 +547,7 @@ fn maps_find_element_to_shared_dom_query_command() {true,).expect("find elements command");- let DevToolsCommand::QuerySelector(multiple) = multiple else {+ let AutomationCommand::QuerySelector(multiple) = multiple else {panic!("expected QuerySelector command");};assert!(multiple.multiple);@@ -568,7 +568,7 @@ fn maps_find_element_to_shared_dom_query_command() {false,).unwrap_or_else(|error| panic!("{using} locator should map: {error:?}"));- let DevToolsCommand::QuerySelector(command) = command else {+ let AutomationCommand::QuerySelector(command) = command else {panic!("expected QuerySelector command for {using}");};assert_eq!(command.selector, expected_selector, "locator {using}");@@ -594,7 +594,7 @@ fn maps_find_element_to_shared_dom_query_command() {false,).expect("tag name locator should map");- let DevToolsCommand::LocateNodes(tag_name) = tag_name else {+ let AutomationCommand::LocateNodes(tag_name) = tag_name else {panic!("expected LocateNodes command for tag name");};assert_eq!(@@ -612,7 +612,7 @@ fn maps_find_element_to_shared_dom_query_command() {true,).expect("tag name locator should map for find elements");- let DevToolsCommand::LocateNodes(tag_name_all) = tag_name_all else {+ let AutomationCommand::LocateNodes(tag_name_all) = tag_name_all else {panic!("expected LocateNodes command for tag name");};assert_eq!(tag_name_all.max_node_count, None);@@ -648,7 +648,7 @@ fn maps_find_element_to_shared_dom_query_command() {false,).expect("xpath locator should map");- let DevToolsCommand::LocateNodes(xpath) = xpath else {+ let AutomationCommand::LocateNodes(xpath) = xpath else {panic!("expected LocateNodes command for xpath");};assert_eq!(@@ -666,7 +666,7 @@ fn maps_find_element_to_shared_dom_query_command() {true,).expect("xpath locator should map for find elements");- let DevToolsCommand::LocateNodes(xpath_all) = xpath_all else {+ let AutomationCommand::LocateNodes(xpath_all) = xpath_all else {panic!("expected LocateNodes command for xpath");};assert_eq!(xpath_all.max_node_count, None);@@ -691,7 +691,7 @@ fn maps_find_element_to_shared_dom_query_command() {false,).expect("link text locator should map");- let DevToolsCommand::LocateNodes(link_text) = link_text else {+ let AutomationCommand::LocateNodes(link_text) = link_text else {panic!("expected LocateNodes command for link text");};assert_eq!(@@ -712,7 +712,7 @@ fn maps_find_element_to_shared_dom_query_command() {true,).expect("partial link text locator should map");- let DevToolsCommand::LocateNodes(partial_link_text) = partial_link_text else {+ let AutomationCommand::LocateNodes(partial_link_text) = partial_link_text else {panic!("expected LocateNodes command for partial link text");};assert_eq!(@@ -756,7 +756,7 @@ fn maps_find_element_to_shared_dom_query_command() {Some(DevToolsDomNodeReference::FrontendNodeId(7)),).expect("root-scoped CSS locator should map");- let DevToolsCommand::QuerySelector(rooted) = rooted else {+ let AutomationCommand::QuerySelector(rooted) = rooted else {panic!("expected QuerySelector command for root-scoped CSS");};assert_eq!(@@ -787,7 +787,7 @@ fn maps_find_element_to_shared_dom_query_command() {let high_id_attribute =get_element_attributes_command(&context, "moli-node-2000000042-element-7").expect("legacy element id should parse");- let DevToolsCommand::GetAttributes(high_id_attribute) = high_id_attribute else {+ let AutomationCommand::GetAttributes(high_id_attribute) = high_id_attribute else {panic!("expected GetAttributes command for high legacy element id");};assert_eq!(@@ -800,7 +800,7 @@ fn maps_find_element_to_shared_dom_query_command() {"classic-shadow",).expect("legacy shadow root id should parse");- let DevToolsCommand::ResolveNode(high_id_shadow_root) = high_id_shadow_root else {+ let AutomationCommand::ResolveNode(high_id_shadow_root) = high_id_shadow_root else {panic!("expected ResolveNode command for high legacy shadow root id");};assert_eq!(@@ -840,7 +840,7 @@ fn maps_screenshot_endpoints_to_shared_page_capture_command() {let context = ClassicDevToolsCommandContext::with_target_id("classic-session-1", "TID-1");let page = screenshot_command(&context);- let DevToolsCommand::CaptureScreenshot(page) = page else {+ let AutomationCommand::CaptureScreenshot(page) = page else {panic!("expected CaptureScreenshot command");};assert_eq!(page.format.as_deref(), Some("png"));@@ -854,7 +854,7 @@ fn maps_screenshot_endpoints_to_shared_page_capture_command() {);let element = element_screenshot_command(&context, "remote-element-1");- let DevToolsCommand::CaptureScreenshot(element) = element else {+ let AutomationCommand::CaptureScreenshot(element) = element else {panic!("expected CaptureScreenshot command");};assert_eq!(element.format.as_deref(), Some("png"));@@ -889,7 +889,7 @@ fn maps_print_page_to_shared_print_to_pdf_command() {}),).expect("classic print page command should map");- let DevToolsCommand::PrintToPdf(command) = command else {+ let AutomationCommand::PrintToPdf(command) = command else {panic!("expected PrintToPdf command");};assert_eq!(@@ -937,7 +937,7 @@ fn maps_element_attribute_to_shared_dom_attributes_command() {let context = ClassicDevToolsCommandContext::with_target_id("classic-session-1", "TID-1");let command = get_element_attributes_command(&context, "moli-node-42").expect("command");- let DevToolsCommand::GetAttributes(command) = command else {+ let AutomationCommand::GetAttributes(command) = command else {panic!("expected GetAttributes command");};assert_eq!(@@ -958,7 +958,7 @@ fn maps_element_attribute_to_shared_dom_attributes_command() {let value = classic_attribute_value(DevToolsGetAttributesResult {- attributes: vec![moli_protocol::devtools_runtime::DevToolsDomAttribute {+ attributes: vec![moli_protocol::automation::DevToolsDomAttribute {name: "data-kind".to_owned(),value: "primary".to_owned(),}],@@ -968,7 +968,7 @@ fn maps_element_attribute_to_shared_dom_attributes_command() {assert_eq!(value.as_deref(), Some("primary"));let boolean_value = classic_attribute_value(DevToolsGetAttributesResult {- attributes: vec![moli_protocol::devtools_runtime::DevToolsDomAttribute {+ attributes: vec![moli_protocol::automation::DevToolsDomAttribute {name: "disabled".to_owned(),value: String::new(),}],@@ -978,7 +978,7 @@ fn maps_element_attribute_to_shared_dom_attributes_command() {assert_eq!(boolean_value.as_deref(), Some("true"));let boolean_with_false_value = classic_attribute_value(DevToolsGetAttributesResult {- attributes: vec![moli_protocol::devtools_runtime::DevToolsDomAttribute {+ attributes: vec![moli_protocol::automation::DevToolsDomAttribute {name: "checked".to_owned(),value: "false".to_owned(),}],@@ -1036,7 +1036,7 @@ fn maps_element_text_to_shared_dom_text_command() {let context = ClassicDevToolsCommandContext::with_target_id("classic-session-1", "TID-1");let command = get_element_text_command(&context, "moli-node-7").expect("command");- let DevToolsCommand::GetText(command) = command else {+ let AutomationCommand::GetText(command) = command else {panic!("expected GetText command");};assert_eq!(@@ -1075,7 +1075,7 @@ fn maps_element_property_to_shared_dom_property_command() {let context = ClassicDevToolsCommandContext::with_target_id("classic-session-1", "TID-1");let command = get_element_property_command(&context, "moli-node-11", "value").expect("command");- let DevToolsCommand::GetProperty(command) = command else {+ let AutomationCommand::GetProperty(command) = command else {panic!("expected GetProperty command");};assert_eq!(@@ -1109,7 +1109,7 @@ fn maps_element_css_value_to_current_context_runtime_command() {let context = ClassicDevToolsCommandContext::with_target_id("classic-session-1", "FRAME-1");let command = get_element_css_value_command(&context, "remote-42", "display");- let DevToolsCommand::CallFunction(command) = command else {+ let AutomationCommand::CallFunction(command) = command else {panic!("expected CallFunction command");};assert_eq!(@@ -1141,7 +1141,7 @@ fn maps_element_displayed_to_current_context_runtime_command() {let context = ClassicDevToolsCommandContext::with_target_id("classic-session-1", "FRAME-1");let command = get_element_displayed_command(&context, "remote-17");- let DevToolsCommand::CallFunction(command) = command else {+ let AutomationCommand::CallFunction(command) = command else {panic!("expected CallFunction command");};assert_eq!(@@ -1170,7 +1170,7 @@ fn maps_element_rendered_text_to_current_context_runtime_command() {let context = ClassicDevToolsCommandContext::with_target_id("classic-session-1", "FRAME-1");let command = get_element_rendered_text_command(&context, "remote-18");- let DevToolsCommand::CallFunction(command) = command else {+ let AutomationCommand::CallFunction(command) = command else {panic!("expected CallFunction command");};assert_eq!(@@ -1204,7 +1204,7 @@ fn maps_element_enabled_to_current_context_runtime_command() {let context = ClassicDevToolsCommandContext::with_target_id("classic-session-1", "FRAME-1");let command = get_element_enabled_command(&context, "remote-19");- let DevToolsCommand::CallFunction(command) = command else {+ let AutomationCommand::CallFunction(command) = command else {panic!("expected CallFunction command");};assert_eq!(@@ -1237,7 +1237,7 @@ fn maps_shadow_root_commands_to_current_context_runtime_commands() {let context = ClassicDevToolsCommandContext::with_target_id("classic-session-1", "FRAME-1");let get = get_element_shadow_root_command(&context, "host-remote-1");- let DevToolsCommand::CallFunction(get) = get else {+ let AutomationCommand::CallFunction(get) = get else {panic!("expected get shadow root CallFunction command");};assert_eq!(@@ -1252,7 +1252,7 @@ fn maps_shadow_root_commands_to_current_context_runtime_commands() {assert!(get.preserve_remote_metadata);let element_attached = verify_element_attached_command(&context, "host-remote-1");- let DevToolsCommand::CallFunction(element_attached) = element_attached else {+ let AutomationCommand::CallFunction(element_attached) = element_attached else {panic!("expected element attachment CallFunction command");};assert_eq!(@@ -1275,7 +1275,7 @@ fn maps_shadow_root_commands_to_current_context_runtime_commands() {assert!(!element_attached.preserve_remote_metadata);let describe = describe_node_command(&context, 42, 1, true);- let DevToolsCommand::DescribeNode(describe) = describe else {+ let AutomationCommand::DescribeNode(describe) = describe else {panic!("expected DescribeNode command");};assert_eq!(@@ -1291,7 +1291,7 @@ fn maps_shadow_root_commands_to_current_context_runtime_commands() {"webdriver-classic-shadow-root",).expect("resolve command");- let DevToolsCommand::ResolveNode(resolve) = resolve else {+ let AutomationCommand::ResolveNode(resolve) = resolve else {panic!("expected ResolveNode command");};assert_eq!(@@ -1304,7 +1304,7 @@ fn maps_shadow_root_commands_to_current_context_runtime_commands() {);let attached = shadow_root_attached_command(&context, "shadow-remote-1");- let DevToolsCommand::CallFunction(attached) = attached else {+ let AutomationCommand::CallFunction(attached) = attached else {panic!("expected shadow root attachment CallFunction command");};assert_eq!(@@ -1327,7 +1327,7 @@ fn maps_element_tag_name_to_shared_dom_local_name_property_command() {let context = ClassicDevToolsCommandContext::with_target_id("classic-session-1", "TID-1");let command = get_element_tag_name_command(&context, "moli-node-13").expect("command");- let DevToolsCommand::GetProperty(command) = command else {+ let AutomationCommand::GetProperty(command) = command else {panic!("expected GetProperty command");};assert_eq!(@@ -1354,7 +1354,7 @@ fn maps_active_element_to_shared_runtime_node_remote_command() {let context = ClassicDevToolsCommandContext::with_target_id("classic-session-1", "TID-1");let command = active_element_command(&context);- let DevToolsCommand::EvaluateScript(command) = command else {+ let AutomationCommand::EvaluateScript(command) = command else {panic!("expected EvaluateScript command");};assert!(command.expression.contains("document.activeElement"));@@ -1377,7 +1377,7 @@ fn maps_get_element_rect_to_shared_dom_geometry_command_and_response() {let context = ClassicDevToolsCommandContext::with_target_id("classic-session-1", "TID-1");let command = get_element_rect_command(&context, "moli-node-13").expect("command");- let DevToolsCommand::DomGeometry(command) = command else {+ let AutomationCommand::DomGeometry(command) = command else {panic!("expected DOM geometry command");};assert_eq!(@@ -1421,7 +1421,7 @@ fn maps_element_clear_to_shared_dom_resolve_and_runtime_command() {let resolve = resolve_element_command(&context, "moli-node-31", "webdriver-classic-clear").expect("resolve command");- let DevToolsCommand::ResolveNode(resolve) = resolve else {+ let AutomationCommand::ResolveNode(resolve) = resolve else {panic!("expected ResolveNode command");};assert_eq!(@@ -1442,7 +1442,7 @@ fn maps_element_clear_to_shared_dom_resolve_and_runtime_command() {);let clear = clear_element_command(&context, "remote-object-1");- let DevToolsCommand::CallFunction(clear) = clear else {+ let AutomationCommand::CallFunction(clear) = clear else {panic!("expected CallFunction command");};assert_eq!(@@ -1457,7 +1457,7 @@ fn maps_element_clear_to_shared_dom_resolve_and_runtime_command() {assert!(clear.function_declaration.contains("invalid element state"));let release = release_remote_object_command(&context, "remote-object-1");- let DevToolsCommand::ReleaseObjects(release) = release else {+ let AutomationCommand::ReleaseObjects(release) = release else {panic!("expected ReleaseObjects command");};assert_eq!(release.realm_id, None);@@ -1491,7 +1491,7 @@ fn maps_element_geometry_and_coordinate_input_commands() {let commands =element_geometry_prepare_commands(&context, DevToolsDomNodeReference::FrontendNodeId(23));assert_eq!(commands.len(), 2);- let DevToolsCommand::ScrollIntoViewIfNeeded(scroll) = &commands[0] else {+ let AutomationCommand::ScrollIntoViewIfNeeded(scroll) = &commands[0] else {panic!("expected scroll command");};assert_eq!(@@ -1506,7 +1506,7 @@ fn maps_element_geometry_and_coordinate_input_commands() {.map(DevToolsTargetId::as_str),Some("TID-1"));- let DevToolsCommand::DomGeometry(geometry) = &commands[1] else {+ let AutomationCommand::DomGeometry(geometry) = &commands[1] else {panic!("expected DOM geometry command");};assert_eq!(@@ -1528,7 +1528,7 @@ fn maps_element_geometry_and_coordinate_input_commands() {(DevToolsMouseEventType::Pressed, Some(1)),(DevToolsMouseEventType::Released, Some(0)),]) {- let DevToolsCommand::DispatchMouseEvent(command) = command else {+ let AutomationCommand::DispatchMouseEvent(command) = command else {panic!("expected mouse dispatch");};assert_eq!(command.event_type, event_type);@@ -1560,7 +1560,7 @@ fn maps_element_send_keys_to_shared_input_key_commands() {(DevToolsKeyEventType::KeyDown, "b", "b", true),(DevToolsKeyEventType::KeyUp, "b", "", false),]) {- let DevToolsCommand::DispatchKeyEvent(command) = command else {+ let AutomationCommand::DispatchKeyEvent(command) = command else {panic!("expected key dispatch");};assert_eq!(command.event_type, event_type);@@ -1618,7 +1618,7 @@ fn maps_element_send_keys_to_shared_input_key_commands() {for (command, (event_type, key, code, text, should_insert_text)) incommands.into_iter().zip(expected){- let DevToolsCommand::DispatchKeyEvent(command) = command else {+ let AutomationCommand::DispatchKeyEvent(command) = command else {panic!("expected key dispatch");};assert_eq!(command.event_type, event_type);@@ -1716,7 +1716,7 @@ fn maps_element_send_keys_to_shared_input_key_commands() {for (command, (event_type, key, code, text, modifiers, should_insert_text)) incommands.into_iter().zip(expected){- let DevToolsCommand::DispatchKeyEvent(command) = command else {+ let AutomationCommand::DispatchKeyEvent(command) = command else {panic!("expected key dispatch");};assert_eq!(command.event_type, event_type);@@ -1747,7 +1747,7 @@ fn maps_element_send_keys_to_shared_input_key_commands() {];assert_eq!(commands.len(), expected.len() * 2);for (pair, (key, code, text, should_insert_text)) in commands.chunks_exact(2).zip(expected) {- let DevToolsCommand::DispatchKeyEvent(key_down) = &pair[0] else {+ let AutomationCommand::DispatchKeyEvent(key_down) = &pair[0] else {panic!("expected keyDown dispatch");};assert_eq!(key_down.event_type, DevToolsKeyEventType::KeyDown);@@ -1756,7 +1756,7 @@ fn maps_element_send_keys_to_shared_input_key_commands() {assert_eq!(key_down.text, text);assert_eq!(key_down.should_insert_text, should_insert_text);- let DevToolsCommand::DispatchKeyEvent(key_up) = &pair[1] else {+ let AutomationCommand::DispatchKeyEvent(key_up) = &pair[1] else {panic!("expected keyUp dispatch");};assert_eq!(key_up.event_type, DevToolsKeyEventType::KeyUp);@@ -1793,7 +1793,7 @@ fn maps_element_send_keys_to_shared_input_key_commands() {for (command, (event_type, key, code, text, modifiers, should_insert_text)) incommands.into_iter().zip(expected){- let DevToolsCommand::DispatchKeyEvent(command) = command else {+ let AutomationCommand::DispatchKeyEvent(command) = command else {panic!("expected key dispatch");};assert_eq!(command.event_type, event_type);@@ -1846,7 +1846,7 @@ fn maps_pointer_actions_to_shared_input_commands() {for (command, (event_type, x, y, button, buttons, click_count)) incommands.into_iter().zip(expected){- let DevToolsCommand::DispatchMouseEvent(command) = command else {+ let AutomationCommand::DispatchMouseEvent(command) = command else {panic!("expected mouse dispatch command");};assert_eq!(command.event_type, event_type);@@ -1910,7 +1910,7 @@ fn maps_touch_pointer_actions_to_shared_touch_commands() {(DevToolsTouchEventType::Move, 22.0, 24.0),(DevToolsTouchEventType::End, 22.0, 24.0),]) {- let DevToolsCommand::DispatchTouchEvent(command) = command else {+ let AutomationCommand::DispatchTouchEvent(command) = command else {panic!("expected touch dispatch command");};assert_eq!(command.event_type, event_type);@@ -1983,7 +1983,7 @@ fn coalesces_same_tick_touch_sources_into_multi_point_commands() {[(0, 11.0, 12.0), (1, 31.0, 32.0)],),]) {- let DevToolsCommand::DispatchTouchEvent(command) = command else {+ let AutomationCommand::DispatchTouchEvent(command) = command else {panic!("expected touch dispatch command");};assert_eq!(command.event_type, event_type);@@ -2024,7 +2024,7 @@ fn releases_pressed_touch_pointer_source() {let release = release_actions_commands(&context, &mut state);assert_eq!(release.len(), 1);- let DevToolsCommand::DispatchTouchEvent(command) = &release[0] else {+ let AutomationCommand::DispatchTouchEvent(command) = &release[0] else {panic!("expected touch release command");};assert_eq!(command.event_type, DevToolsTouchEventType::End);@@ -2068,7 +2068,7 @@ fn maps_pen_pointer_actions_to_shared_mouse_commands_with_pointer_type() {DevToolsMouseEventType::Pressed,DevToolsMouseEventType::Released,]) {- let DevToolsCommand::DispatchMouseEvent(command) = command else {+ let AutomationCommand::DispatchMouseEvent(command) = command else {panic!("expected mouse dispatch command");};assert_eq!(command.event_type, event_type);@@ -2205,26 +2205,26 @@ fn groups_action_commands_by_tick_duration() {assert_eq!(ticks[1].duration_ms, 0);assert_eq!(ticks[1].commands.len(), 2);- let DevToolsCommand::DispatchMouseEvent(pointer_move) = &ticks[0].commands[0] else {+ let AutomationCommand::DispatchMouseEvent(pointer_move) = &ticks[0].commands[0] else {panic!("expected pointer move in first tick");};assert_eq!(pointer_move.event_type, DevToolsMouseEventType::Moved);assert_eq!(pointer_move.x, 20.0);assert_eq!(pointer_move.y, 21.0);- let DevToolsCommand::DispatchMouseEvent(wheel_scroll) = &ticks[0].commands[1] else {+ let AutomationCommand::DispatchMouseEvent(wheel_scroll) = &ticks[0].commands[1] else {panic!("expected wheel scroll in first tick");};assert_eq!(wheel_scroll.event_type, DevToolsMouseEventType::Wheel);assert_eq!(wheel_scroll.delta_x, 1.0);assert_eq!(wheel_scroll.delta_y, 2.0);- let DevToolsCommand::DispatchMouseEvent(pointer_down) = &ticks[1].commands[0] else {+ let AutomationCommand::DispatchMouseEvent(pointer_down) = &ticks[1].commands[0] else {panic!("expected pointer down in second tick");};assert_eq!(pointer_down.event_type, DevToolsMouseEventType::Pressed);- let DevToolsCommand::DispatchKeyEvent(key_down) = &ticks[1].commands[1] else {+ let AutomationCommand::DispatchKeyEvent(key_down) = &ticks[1].commands[1] else {panic!("expected key down in second tick");};assert_eq!(key_down.event_type, DevToolsKeyEventType::KeyDown);@@ -2366,7 +2366,7 @@ fn maps_pointer_actions_with_element_origin_to_shared_input_commands() {(DevToolsMouseEventType::Released, 23.0, 26.0, 0, Some(0)),];for (command, (event_type, x, y, button, buttons)) in commands.into_iter().zip(expected) {- let DevToolsCommand::DispatchMouseEvent(command) = command else {+ let AutomationCommand::DispatchMouseEvent(command) = command else {panic!("expected mouse dispatch command");};assert_eq!(command.event_type, event_type);@@ -2444,7 +2444,7 @@ fn maintains_action_state_across_commands_and_releases_pressed_sources() {).expect("pointer origin should use persisted pointer position");assert_eq!(moved.len(), 1);- let DevToolsCommand::DispatchMouseEvent(command) = &moved[0] else {+ let AutomationCommand::DispatchMouseEvent(command) = &moved[0] else {panic!("expected mouse dispatch command");};assert_eq!(command.event_type, DevToolsMouseEventType::Moved);@@ -2454,7 +2454,7 @@ fn maintains_action_state_across_commands_and_releases_pressed_sources() {let release = release_actions_commands(&context, &mut state);assert_eq!(release.len(), 2);- let DevToolsCommand::DispatchMouseEvent(mouse_up) = &release[0] else {+ let AutomationCommand::DispatchMouseEvent(mouse_up) = &release[0] else {panic!("expected mouse release command first");};assert_eq!(mouse_up.event_type, DevToolsMouseEventType::Released);@@ -2463,7 +2463,7 @@ fn maintains_action_state_across_commands_and_releases_pressed_sources() {assert_eq!(mouse_up.button, 0);assert_eq!(mouse_up.buttons, Some(0));- let DevToolsCommand::DispatchKeyEvent(key_up) = &release[1] else {+ let AutomationCommand::DispatchKeyEvent(key_up) = &release[1] else {panic!("expected key release command second");};assert_eq!(key_up.event_type, DevToolsKeyEventType::KeyUp);@@ -2570,7 +2570,8 @@ fn maps_wheel_actions_to_shared_input_commands() {.expect("wheel actions should map");assert_eq!(commands.len(), 1);- let DevToolsCommand::DispatchMouseEvent(command) = commands.into_iter().next().unwrap() else {+ let AutomationCommand::DispatchMouseEvent(command) = commands.into_iter().next().unwrap()+ else {panic!("expected mouse dispatch command");};assert_eq!(command.event_type, DevToolsMouseEventType::Wheel);@@ -2646,7 +2647,8 @@ fn maps_wheel_actions_with_element_origin_to_shared_input_commands() {.expect("wheel element origin should map");assert_eq!(commands.len(), 1);- let DevToolsCommand::DispatchMouseEvent(command) = commands.into_iter().next().unwrap() else {+ let AutomationCommand::DispatchMouseEvent(command) = commands.into_iter().next().unwrap()+ else {panic!("expected mouse dispatch command");};assert_eq!(command.event_type, DevToolsMouseEventType::Wheel);@@ -2739,7 +2741,7 @@ fn maps_key_actions_to_shared_input_commands() {for (command, (event_type, key, code, text, modifiers, auto_repeat, should_insert_text)) incommands.into_iter().zip(expected){- let DevToolsCommand::DispatchKeyEvent(command) = command else {+ let AutomationCommand::DispatchKeyEvent(command) = command else {panic!("expected key dispatch command");};assert_eq!(command.event_type, event_type);@@ -2798,7 +2800,7 @@ fn maps_repeated_keydown_action_to_auto_repeat_key_event() {let repeats = commands.iter().map(|command| {- let DevToolsCommand::DispatchKeyEvent(command) = command else {+ let AutomationCommand::DispatchKeyEvent(command) = command else {panic!("expected key dispatch command");};command.auto_repeat@@ -2920,7 +2922,7 @@ fn maps_shift_modified_key_actions_to_shifted_key_and_text() {for (command, (event_type, key, code, text, modifiers, should_insert_text)) incommands.into_iter().zip(expected){- let DevToolsCommand::DispatchKeyEvent(command) = command else {+ let AutomationCommand::DispatchKeyEvent(command) = command else {panic!("expected key dispatch command");};assert_eq!(command.event_type, event_type);@@ -2937,7 +2939,7 @@ fn maps_window_commands_to_shared_target_commands() {let context = ClassicDevToolsCommandContext::with_target_id("classic-session-1", "TID-1");let handles = window_handles_command(&context);- let DevToolsCommand::GetTargets(handles) = handles else {+ let AutomationCommand::GetTargets(handles) = handles else {panic!("expected GetTargets command");};assert!(handles.root.is_none());@@ -2951,7 +2953,7 @@ fn maps_window_commands_to_shared_target_commands() {);let new_window = new_window_command(&context);- let DevToolsCommand::CreateTarget(new_window) = new_window else {+ let AutomationCommand::CreateTarget(new_window) = new_window else {panic!("expected CreateTarget command");};assert_eq!(new_window.url, "about:blank");@@ -2962,7 +2964,7 @@ fn maps_window_commands_to_shared_target_commands() {let switch =switch_window_command(&context, &json!({"handle": "TID-2"})).expect("switch command");- let DevToolsCommand::ActivateTarget(switch) = switch else {+ let AutomationCommand::ActivateTarget(switch) = switch else {panic!("expected ActivateTarget command");};assert_eq!(switch.target_id.as_str(), "TID-2");@@ -2976,13 +2978,13 @@ fn maps_window_commands_to_shared_target_commands() {);let close = close_window_command(&context).expect("close command");- let DevToolsCommand::CloseTarget(close) = close else {+ let AutomationCommand::CloseTarget(close) = close else {panic!("expected CloseTarget command");};assert_eq!(close.target_id.as_str(), "TID-1");let set_rect = set_window_rect_command(&context, 640, 480);- let DevToolsCommand::SetViewport(set_rect) = set_rect else {+ let AutomationCommand::SetViewport(set_rect) = set_rect else {panic!("expected SetViewport command");};assert_eq!(@@ -3021,7 +3023,7 @@ fn maps_classic_window_state_to_headless_viewport_contract() {set_window_state_command(&context, ClassicWindowState::Minimized).is_none(),"minimize has no viewport command because Moli has no OS window");- let DevToolsCommand::SetWindowState(minimize_surface) =+ let AutomationCommand::SetWindowState(minimize_surface) =set_window_surface_state_command(&context, ClassicWindowState::Minimized)else {panic!("minimize should map to SetWindowState");@@ -3046,7 +3048,7 @@ fn maps_classic_window_state_to_headless_viewport_contract() {height: CLASSIC_HEADLESS_AVAILABLE_HEIGHT,});- let Some(DevToolsCommand::SetViewport(maximize_command)) =+ let Some(AutomationCommand::SetViewport(maximize_command)) =set_window_state_command(&context, ClassicWindowState::Maximized)else {panic!("maximize should map to SetViewport");@@ -3068,7 +3070,7 @@ fn maps_classic_window_state_to_headless_viewport_contract() {Some(CLASSIC_HEADLESS_SCREEN_HEIGHT)));- let DevToolsCommand::SetWindowState(maximize_surface) =+ let AutomationCommand::SetWindowState(maximize_surface) =set_window_surface_state_command(&context, ClassicWindowState::Maximized)else {panic!("maximize should map to SetWindowState");@@ -3085,7 +3087,7 @@ fn maps_classic_window_state_to_headless_viewport_contract() {height: CLASSIC_HEADLESS_SCREEN_HEIGHT,});- let Some(DevToolsCommand::SetViewport(fullscreen_command)) =+ let Some(AutomationCommand::SetViewport(fullscreen_command)) =set_window_state_command(&context, ClassicWindowState::Fullscreen)else {panic!("fullscreen should map to SetViewport");@@ -3107,13 +3109,13 @@ fn maps_classic_window_state_to_headless_viewport_contract() {Some(CLASSIC_HEADLESS_SCREEN_HEIGHT)));- let DevToolsCommand::SetWindowState(fullscreen_surface) =+ let AutomationCommand::SetWindowState(fullscreen_surface) =set_window_surface_state_command(&context, ClassicWindowState::Fullscreen)else {panic!("fullscreen should map to SetWindowState");};assert_eq!(fullscreen_surface.state, DevToolsWindowState::Fullscreen);- let DevToolsCommand::SetWindowState(normal_surface) =+ let AutomationCommand::SetWindowState(normal_surface) =set_window_normal_surface_state_command(&context)else {panic!("set rect should map to normal SetWindowState");@@ -3187,26 +3189,26 @@ fn parses_classic_window_rect_params_like_webdriver() {fn maps_alert_commands_to_shared_page_dialog_commands() {let context = ClassicDevToolsCommandContext::with_target_id("SID-1", "TID-1");- let DevToolsCommand::GetJavaScriptDialog(get) = alert_text_command(&context) else {+ let AutomationCommand::GetJavaScriptDialog(get) = alert_text_command(&context) else {panic!("alert text should map to get dialog command");};assert_eq!(get.context.session_id.as_ref().unwrap().as_str(), "SID-1");assert_eq!(get.context.target_id.as_ref().unwrap().as_str(), "TID-1");- let DevToolsCommand::HandleJavaScriptDialog(accept) = alert_handle_command(&context, true)+ let AutomationCommand::HandleJavaScriptDialog(accept) = alert_handle_command(&context, true)else {panic!("accept alert should map to handle dialog command");};assert!(accept.accept);assert_eq!(accept.prompt_text, "");- let DevToolsCommand::HandleJavaScriptDialog(dismiss) = alert_handle_command(&context, false)+ let AutomationCommand::HandleJavaScriptDialog(dismiss) = alert_handle_command(&context, false)else {panic!("dismiss alert should map to handle dialog command");};assert!(!dismiss.accept);- let DevToolsCommand::SetJavaScriptDialogPromptText(send_text) =+ let AutomationCommand::SetJavaScriptDialogPromptText(send_text) =alert_send_text_command(&context, &json!({"text": "cheese"})).expect("send text command")else {panic!("send alert text should map to set dialog prompt text command");@@ -3237,7 +3239,7 @@ fn serializes_element_not_interactable_error_code() {fn extracts_classic_window_handles_from_page_targets() {let handles = window_handles_from_targets(DevToolsGetTargetsResult {targets: vec![- moli_protocol::devtools_runtime::DevToolsTargetInfo {+ moli_protocol::automation::DevToolsTargetInfo {target_id: Some(DevToolsTargetId::from("PAGE-1")),kind: DevToolsTargetKind::Page,title: String::new(),@@ -3249,7 +3251,7 @@ fn extracts_classic_window_handles_from_page_targets() {browser_context_id: None,moli_popup_id: None,},- moli_protocol::devtools_runtime::DevToolsTargetInfo {+ moli_protocol::automation::DevToolsTargetInfo {target_id: Some(DevToolsTargetId::from("TAB-PAGE-1")),kind: DevToolsTargetKind::Tab,title: String::new(),@@ -3261,7 +3263,7 @@ fn extracts_classic_window_handles_from_page_targets() {browser_context_id: None,moli_popup_id: None,},- moli_protocol::devtools_runtime::DevToolsTargetInfo {+ moli_protocol::automation::DevToolsTargetInfo {target_id: Some(DevToolsTargetId::from("WORKER-1")),kind: DevToolsTargetKind::Worker,title: String::new(),@@ -3273,7 +3275,7 @@ fn extracts_classic_window_handles_from_page_targets() {browser_context_id: None,moli_popup_id: None,},- moli_protocol::devtools_runtime::DevToolsTargetInfo {+ moli_protocol::automation::DevToolsTargetInfo {target_id: None,kind: DevToolsTargetKind::Browser,title: String::new(),@@ -3320,11 +3322,11 @@ fn rejects_invalid_classic_window_params() {}#[test]-fn maps_refresh_and_history_traversal_to_shared_devtools_commands() {+fn maps_refresh_and_history_traversal_to_shared_automation_commands() {let context = ClassicDevToolsCommandContext::with_target_id("classic-session-1", "TID-1");let refresh = refresh_command(&context, DevToolsNavigationWait::Load);- let DevToolsCommand::Reload(refresh) = refresh else {+ let AutomationCommand::Reload(refresh) = refresh else {panic!("expected Reload command");};assert_eq!(refresh.wait, DevToolsNavigationWait::Load);@@ -3338,7 +3340,7 @@ fn maps_refresh_and_history_traversal_to_shared_devtools_commands() {);let history_command = navigation_history_command(&context);- let DevToolsCommand::GetNavigationHistory(history_command) = history_command else {+ let AutomationCommand::GetNavigationHistory(history_command) = history_command else {panic!("expected GetNavigationHistory command");};assert_eq!(@@ -3353,14 +3355,14 @@ fn maps_refresh_and_history_traversal_to_shared_devtools_commands() {let history = DevToolsGetNavigationHistoryResult {current_index: 1,entries: vec![- moli_protocol::devtools_runtime::DevToolsNavigationHistoryEntry {+ moli_protocol::automation::DevToolsNavigationHistoryEntry {id: 7,url: "https://example.test/first".to_owned(),user_typed_url: "https://example.test/first".to_owned(),title: "first".to_owned(),transition_type: "typed".to_owned(),},- moli_protocol::devtools_runtime::DevToolsNavigationHistoryEntry {+ moli_protocol::automation::DevToolsNavigationHistoryEntry {id: 8,url: "https://example.test/second".to_owned(),user_typed_url: "https://example.test/second".to_owned(),@@ -3381,7 +3383,7 @@ fn maps_refresh_and_history_traversal_to_shared_devtools_commands() {"https://example.test/first",DevToolsNavigationWait::Load,);- let DevToolsCommand::TraverseHistory(traverse) = traverse else {+ let AutomationCommand::TraverseHistory(traverse) = traverse else {panic!("expected TraverseHistory command");};assert_eq!(@@ -3418,7 +3420,7 @@ fn maps_execute_sync_to_shared_call_function_command() {).expect("execute command");- let DevToolsCommand::CallFunction(execute) = execute else {+ let AutomationCommand::CallFunction(execute) = execute else {panic!("expected CallFunction command");};assert_eq!(@@ -3457,7 +3459,7 @@ fn maps_execute_async_to_shared_callback_call_function_command() {).expect("execute async command");- let DevToolsCommand::CallFunction(execute) = execute else {+ let AutomationCommand::CallFunction(execute) = execute else {panic!("expected CallFunction command");};assert!(@@ -3498,7 +3500,7 @@ fn maps_cookie_commands_to_shared_storage_commands() {let current_url = "https://example.test/path";let get = get_cookies_command(&context, current_url);- let DevToolsCommand::GetCookies(get) = get else {+ let AutomationCommand::GetCookies(get) = get else {panic!("expected GetCookies command");};assert_eq!(get.urls, Some(vec![current_url.to_owned()]));@@ -3523,7 +3525,7 @@ fn maps_cookie_commands_to_shared_storage_commands() {current_url,).expect("add cookie command");- let DevToolsCommand::SetCookies(add) = add else {+ let AutomationCommand::SetCookies(add) = add else {panic!("expected SetCookies command");};assert_eq!(add.cookies.len(), 1);@@ -3563,21 +3565,21 @@ fn maps_cookie_commands_to_shared_storage_commands() {current_url,).expect("default add cookie command");- let DevToolsCommand::SetCookies(default_add) = default_add else {+ let AutomationCommand::SetCookies(default_add) = default_add else {panic!("expected SetCookies command");};assert_eq!(default_add.cookies[0].secure, Some(false));assert!(default_add.cookies[0].same_site.is_none());let delete = delete_cookie_command(&context, "sid", current_url);- let DevToolsCommand::DeleteCookies(delete) = delete else {+ let AutomationCommand::DeleteCookies(delete) = delete else {panic!("expected DeleteCookies command");};assert_eq!(delete.name.as_deref(), Some("sid"));assert_eq!(delete.url.as_deref(), Some(current_url));let delete_all = delete_all_cookies_command(&context, current_url);- let DevToolsCommand::DeleteCookies(delete_all) = delete_all else {+ let AutomationCommand::DeleteCookies(delete_all) = delete_all else {panic!("expected DeleteCookies command");};assert!(delete_all.name.is_none());diff --git a/moli-protocol-webdriver-classic/src/types.rs b/moli-protocol-webdriver-classic/src/types.rsindex f0f2456cd..c9ca33686 100644--- a/moli-protocol-webdriver-classic/src/types.rs+++ b/moli-protocol-webdriver-classic/src/types.rs@@ -2,9 +2,9 @@ use std::collections::BTreeMap;use serde_json::{Map, Value, json};-use moli_protocol::devtools_runtime::{- DevToolsCommandContext, DevToolsNavigationWait, DevToolsProtocol, DevToolsSessionId,- DevToolsTargetId,+use moli_protocol::automation::{+ AutomationContext, DevToolsNavigationWait, DevToolsSessionId, DevToolsTargetId,+ FrontendProtocol,};use crate::actions::ClassicActionState;@@ -242,7 +242,7 @@ impl ClassicPromptHandler {pub struct ClassicDevToolsCommandContext {pub session_id: String,pub target_id: Option<String>,- protocol: DevToolsProtocol,+ protocol: FrontendProtocol,}impl ClassicDevToolsCommandContext {@@ -250,7 +250,7 @@ impl ClassicDevToolsCommandContext {Self {session_id: session_id.into(),target_id: None,- protocol: DevToolsProtocol::WebDriverClassic,+ protocol: FrontendProtocol::WebDriverClassic,}}@@ -258,12 +258,12 @@ impl ClassicDevToolsCommandContext {Self {session_id: session_id.into(),target_id: Some(target_id.into()),- protocol: DevToolsProtocol::WebDriverClassic,+ protocol: FrontendProtocol::WebDriverClassic,}}pub fn with_protocol_and_target_id(- protocol: DevToolsProtocol,+ protocol: FrontendProtocol,session_id: impl Into<String>,target_id: impl Into<String>,) -> Self {@@ -274,8 +274,8 @@ impl ClassicDevToolsCommandContext {}}- pub(crate) fn command_context(&self) -> DevToolsCommandContext {- DevToolsCommandContext {+ pub(crate) fn command_context(&self) -> AutomationContext {+ AutomationContext {protocol: self.protocol,session_id: Some(DevToolsSessionId::from(self.session_id.as_str())),target_id: self.target_id.as_deref().map(DevToolsTargetId::from),diff --git a/moli-protocol/src/devtools_runtime.rs b/moli-protocol/src/automation.rssimilarity index 88%rename from moli-protocol/src/devtools_runtime.rsrename to moli-protocol/src/automation.rsindex 037d77154..cc9c985e3 100644--- a/moli-protocol/src/devtools_runtime.rs+++ b/moli-protocol/src/automation.rs@@ -1,8 +1,8 @@-//! Protocol-neutral DevTools runtime types.+//! Protocol-neutral automation requests and results.//!//! This module is the shared data-shape boundary for CDP, WebDriver Classic,-//! and WebDriver BiDi. It intentionally contains data shapes only; ownership-//! and behavior stay in the DevTools protocol owner layer.+//! and WebDriver BiDi. It intentionally contains data shapes only; Browser and renderer ownership+//! stays in the execution layer; frontend adapters parse and project wire data.use std::{fmt, str::FromStr, sync::Arc};@@ -137,7 +137,7 @@ mod tests {}#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]-pub enum DevToolsProtocol {+pub enum FrontendProtocol {Cdp,WebDriverClassic,WebDriverBidi,@@ -200,15 +200,15 @@ pub enum DevToolsNavigationWait {}#[derive(Debug, Clone, PartialEq, Eq)]-pub struct DevToolsCommandContext {- pub protocol: DevToolsProtocol,+pub struct AutomationContext {+ pub protocol: FrontendProtocol,pub session_id: Option<DevToolsSessionId>,pub target_id: Option<DevToolsTargetId>,pub browser_context_id: Option<DevToolsBrowserContextId>,}#[derive(Debug, Clone, PartialEq)]-pub enum DevToolsCommand {+pub enum AutomationCommand {Navigate(DevToolsNavigateCommand),Reload(DevToolsReloadCommand),GetNavigationHistory(DevToolsGetNavigationHistoryCommand),@@ -293,91 +293,91 @@ pub enum DevToolsCommand {FulfillInterceptedRequest(DevToolsFulfillInterceptedRequestCommand),}-impl DevToolsCommand {- pub fn context(&self) -> &DevToolsCommandContext {+impl AutomationCommand {+ pub fn context(&self) -> &AutomationContext {match self {- DevToolsCommand::Navigate(command) => &command.context,- DevToolsCommand::Reload(command) => &command.context,- DevToolsCommand::GetNavigationHistory(command) => &command.context,- DevToolsCommand::TraverseHistory(command) => &command.context,- DevToolsCommand::GetRealms(command) => &command.context,- DevToolsCommand::EvaluateScript(command) => &command.context,- DevToolsCommand::CallFunction(command) => &command.context,- DevToolsCommand::TerminateExecution(command) => &command.context,- DevToolsCommand::ReleaseObjects(command) => &command.context,- DevToolsCommand::CreateTarget(command) => &command.context,- DevToolsCommand::CloseTarget(command) => &command.context,- DevToolsCommand::ActivateTarget(command) => &command.context,- DevToolsCommand::GetTargets(command) => &command.context,- DevToolsCommand::GetServiceWorkerLogs(command) => &command.context,- DevToolsCommand::GetClientWindows(command) => &command.context,- DevToolsCommand::SetClientWindowState(command) => &command.context,- DevToolsCommand::CreateBrowserContext(command) => &command.context,- DevToolsCommand::GetBrowserContexts(command) => &command.context,- DevToolsCommand::RemoveBrowserContext(command) => &command.context,- DevToolsCommand::SetDownloadBehavior(command) => &command.context,- DevToolsCommand::SetPermission(command) => &command.context,- DevToolsCommand::GetTargetInfo(command) => &command.context,- DevToolsCommand::GetFrameTree(command) => &command.context,- DevToolsCommand::GetFrameTrees(command) => &command.context,- DevToolsCommand::GetLayoutMetrics(command) => &command.context,- DevToolsCommand::GetJavaScriptDialog(command) => &command.context,- DevToolsCommand::SetJavaScriptDialogPromptText(command) => &command.context,- DevToolsCommand::HandleJavaScriptDialog(command) => &command.context,- DevToolsCommand::CaptureScreenshot(command) => &command.context,- DevToolsCommand::PrintToPdf(command) => &command.context,- DevToolsCommand::SetViewport(command) => &command.context,- DevToolsCommand::SetWindowState(command) => &command.context,- DevToolsCommand::SetUserAgentOverride(command) => &command.context,- DevToolsCommand::SetLocaleOverride(command) => &command.context,- DevToolsCommand::SetTimezoneOverride(command) => &command.context,- DevToolsCommand::SetGeolocationOverride(command) => &command.context,- DevToolsCommand::SetNetworkConditions(command) => &command.context,- DevToolsCommand::GetFrameOwner(command) => &command.context,- DevToolsCommand::LocateNodes(command) => &command.context,- DevToolsCommand::GetDocument(command) => &command.context,- DevToolsCommand::RequestChildNodes(command) => &command.context,- DevToolsCommand::QuerySelector(command) => &command.context,- DevToolsCommand::PerformSearch(command) => &command.context,- DevToolsCommand::GetSearchResults(command) => &command.context,- DevToolsCommand::DiscardSearchResults(command) => &command.context,- DevToolsCommand::GetNodeForLocation(command) => &command.context,- DevToolsCommand::ResolveNode(command) => &command.context,- DevToolsCommand::GetAttributes(command) => &command.context,- DevToolsCommand::GetText(command) => &command.context,- DevToolsCommand::GetProperty(command) => &command.context,- DevToolsCommand::PushNodesByBackendIds(command) => &command.context,- DevToolsCommand::DescribeNode(command) => &command.context,- DevToolsCommand::DomObjectReference(command) => &command.context,- DevToolsCommand::SetFileInputFiles(command) => &command.context,- DevToolsCommand::GetOuterHtml(command) => &command.context,- DevToolsCommand::ScrollIntoViewIfNeeded(command) => &command.context,- DevToolsCommand::DomGeometry(command) => &command.context,- DevToolsCommand::RemoveNode(command) => &command.context,- DevToolsCommand::AddPreloadScript(command) => &command.context,- DevToolsCommand::RemovePreloadScript(command) => &command.context,- DevToolsCommand::ElementClick(command) => &command.context,- DevToolsCommand::DispatchMouseEvent(command) => &command.context,- DevToolsCommand::DispatchKeyEvent(command) => &command.context,- DevToolsCommand::DispatchTouchEvent(command) => &command.context,- DevToolsCommand::DispatchDragEvent(command) => &command.context,- DevToolsCommand::SynthesizeTapGesture(command) => &command.context,- DevToolsCommand::GetCookies(command) => &command.context,- DevToolsCommand::DeleteCookies(command) => &command.context,- DevToolsCommand::SetCookies(command) => &command.context,- DevToolsCommand::AddNetworkIntercept(command) => &command.context,- DevToolsCommand::RemoveNetworkIntercept(command) => &command.context,- DevToolsCommand::AddNetworkDataCollector(command) => &command.context,- DevToolsCommand::RemoveNetworkDataCollector(command) => &command.context,- DevToolsCommand::DisownNetworkData(command) => &command.context,- DevToolsCommand::SetCacheBehavior(command) => &command.context,- DevToolsCommand::SetExtraHeaders(command) => &command.context,- DevToolsCommand::GetNetworkData(command) => &command.context,- DevToolsCommand::ContinueInterceptedRequest(command) => &command.context,- DevToolsCommand::ContinueInterceptedResponse(command) => &command.context,- DevToolsCommand::ContinueWithAuth(command) => &command.context,- DevToolsCommand::FailInterceptedRequest(command) => &command.context,- DevToolsCommand::FulfillInterceptedRequest(command) => &command.context,+ AutomationCommand::Navigate(command) => &command.context,+ AutomationCommand::Reload(command) => &command.context,+ AutomationCommand::GetNavigationHistory(command) => &command.context,+ AutomationCommand::TraverseHistory(command) => &command.context,+ AutomationCommand::GetRealms(command) => &command.context,+ AutomationCommand::EvaluateScript(command) => &command.context,+ AutomationCommand::CallFunction(command) => &command.context,+ AutomationCommand::TerminateExecution(command) => &command.context,+ AutomationCommand::ReleaseObjects(command) => &command.context,+ AutomationCommand::CreateTarget(command) => &command.context,+ AutomationCommand::CloseTarget(command) => &command.context,+ AutomationCommand::ActivateTarget(command) => &command.context,+ AutomationCommand::GetTargets(command) => &command.context,+ AutomationCommand::GetServiceWorkerLogs(command) => &command.context,+ AutomationCommand::GetClientWindows(command) => &command.context,+ AutomationCommand::SetClientWindowState(command) => &command.context,+ AutomationCommand::CreateBrowserContext(command) => &command.context,+ AutomationCommand::GetBrowserContexts(command) => &command.context,+ AutomationCommand::RemoveBrowserContext(command) => &command.context,+ AutomationCommand::SetDownloadBehavior(command) => &command.context,+ AutomationCommand::SetPermission(command) => &command.context,+ AutomationCommand::GetTargetInfo(command) => &command.context,+ AutomationCommand::GetFrameTree(command) => &command.context,+ AutomationCommand::GetFrameTrees(command) => &command.context,+ AutomationCommand::GetLayoutMetrics(command) => &command.context,+ AutomationCommand::GetJavaScriptDialog(command) => &command.context,+ AutomationCommand::SetJavaScriptDialogPromptText(command) => &command.context,+ AutomationCommand::HandleJavaScriptDialog(command) => &command.context,+ AutomationCommand::CaptureScreenshot(command) => &command.context,+ AutomationCommand::PrintToPdf(command) => &command.context,+ AutomationCommand::SetViewport(command) => &command.context,+ AutomationCommand::SetWindowState(command) => &command.context,+ AutomationCommand::SetUserAgentOverride(command) => &command.context,+ AutomationCommand::SetLocaleOverride(command) => &command.context,+ AutomationCommand::SetTimezoneOverride(command) => &command.context,+ AutomationCommand::SetGeolocationOverride(command) => &command.context,+ AutomationCommand::SetNetworkConditions(command) => &command.context,+ AutomationCommand::GetFrameOwner(command) => &command.context,+ AutomationCommand::LocateNodes(command) => &command.context,+ AutomationCommand::GetDocument(command) => &command.context,+ AutomationCommand::RequestChildNodes(command) => &command.context,+ AutomationCommand::QuerySelector(command) => &command.context,+ AutomationCommand::PerformSearch(command) => &command.context,+ AutomationCommand::GetSearchResults(command) => &command.context,+ AutomationCommand::DiscardSearchResults(command) => &command.context,+ AutomationCommand::GetNodeForLocation(command) => &command.context,+ AutomationCommand::ResolveNode(command) => &command.context,+ AutomationCommand::GetAttributes(command) => &command.context,+ AutomationCommand::GetText(command) => &command.context,+ AutomationCommand::GetProperty(command) => &command.context,+ AutomationCommand::PushNodesByBackendIds(command) => &command.context,+ AutomationCommand::DescribeNode(command) => &command.context,+ AutomationCommand::DomObjectReference(command) => &command.context,+ AutomationCommand::SetFileInputFiles(command) => &command.context,+ AutomationCommand::GetOuterHtml(command) => &command.context,+ AutomationCommand::ScrollIntoViewIfNeeded(command) => &command.context,+ AutomationCommand::DomGeometry(command) => &command.context,+ AutomationCommand::RemoveNode(command) => &command.context,+ AutomationCommand::AddPreloadScript(command) => &command.context,+ AutomationCommand::RemovePreloadScript(command) => &command.context,+ AutomationCommand::ElementClick(command) => &command.context,+ AutomationCommand::DispatchMouseEvent(command) => &command.context,+ AutomationCommand::DispatchKeyEvent(command) => &command.context,+ AutomationCommand::DispatchTouchEvent(command) => &command.context,+ AutomationCommand::DispatchDragEvent(command) => &command.context,+ AutomationCommand::SynthesizeTapGesture(command) => &command.context,+ AutomationCommand::GetCookies(command) => &command.context,+ AutomationCommand::DeleteCookies(command) => &command.context,+ AutomationCommand::SetCookies(command) => &command.context,+ AutomationCommand::AddNetworkIntercept(command) => &command.context,+ AutomationCommand::RemoveNetworkIntercept(command) => &command.context,+ AutomationCommand::AddNetworkDataCollector(command) => &command.context,+ AutomationCommand::RemoveNetworkDataCollector(command) => &command.context,+ AutomationCommand::DisownNetworkData(command) => &command.context,+ AutomationCommand::SetCacheBehavior(command) => &command.context,+ AutomationCommand::SetExtraHeaders(command) => &command.context,+ AutomationCommand::GetNetworkData(command) => &command.context,+ AutomationCommand::ContinueInterceptedRequest(command) => &command.context,+ AutomationCommand::ContinueInterceptedResponse(command) => &command.context,+ AutomationCommand::ContinueWithAuth(command) => &command.context,+ AutomationCommand::FailInterceptedRequest(command) => &command.context,+ AutomationCommand::FulfillInterceptedRequest(command) => &command.context,}}@@ -387,10 +387,10 @@ impl DevToolsCommand {) {let handler = handler.map(str::to_owned);match self {- DevToolsCommand::EvaluateScript(command) => {+ AutomationCommand::EvaluateScript(command) => {command.webdriver_bidi_file_prompt_handler = handler;}- DevToolsCommand::CallFunction(command) => {+ AutomationCommand::CallFunction(command) => {command.webdriver_bidi_file_prompt_handler = handler;}_ => {}@@ -400,7 +400,7 @@ impl DevToolsCommand {#[derive(Debug, Clone, PartialEq)]pub struct DevToolsNavigateCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub url: String,pub referrer: Option<String>,pub wait: DevToolsNavigationWait,@@ -408,7 +408,7 @@ pub struct DevToolsNavigateCommand {#[derive(Debug, Clone, PartialEq)]pub struct DevToolsReloadCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub ignore_cache: bool,pub script_to_evaluate_on_load: Option<String>,pub wait: DevToolsNavigationWait,@@ -416,12 +416,12 @@ pub struct DevToolsReloadCommand {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsGetNavigationHistoryCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,}#[derive(Debug, Clone, PartialEq)]pub struct DevToolsTraverseHistoryCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub destination: DevToolsHistoryTraversalDestination,pub wait: DevToolsNavigationWait,}@@ -434,13 +434,13 @@ pub enum DevToolsHistoryTraversalDestination {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsGetRealmsCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub realm_type: Option<String>,}#[derive(Debug, Clone, PartialEq)]pub struct DevToolsEvaluateScriptCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub realm_id: Option<DevToolsRealmId>,pub world_name: Option<String>,pub expression: String,@@ -455,7 +455,7 @@ pub struct DevToolsEvaluateScriptCommand {#[derive(Debug, Clone, PartialEq)]pub struct DevToolsCallFunctionCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub realm_id: Option<DevToolsRealmId>,pub world_name: Option<String>,pub object_id: Option<DevToolsRemoteHandleId>,@@ -474,7 +474,7 @@ pub struct DevToolsCallFunctionCommand {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsTerminateExecutionCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,}#[derive(Debug, Clone, PartialEq, Eq)]@@ -486,7 +486,7 @@ pub struct DevToolsSerializationOptions {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsReleaseObjectsCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub realm_id: Option<DevToolsRealmId>,pub world_name: Option<String>,pub handles: Vec<DevToolsRemoteHandleId>,@@ -494,7 +494,7 @@ pub struct DevToolsReleaseObjectsCommand {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsCreateTargetCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub url: String,pub browser_context_id: Option<DevToolsBrowserContextId>,pub activate: bool,@@ -502,19 +502,19 @@ pub struct DevToolsCreateTargetCommand {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsCloseTargetCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub target_id: DevToolsTargetId,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsActivateTargetCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub target_id: DevToolsTargetId,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsGetTargetsCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub root: Option<DevToolsTargetId>,pub max_depth: Option<u32>,pub filter: Option<Vec<DevToolsTargetFilterEntry>>,@@ -528,18 +528,18 @@ pub struct DevToolsTargetFilterEntry {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsGetServiceWorkerLogsCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub target_id: Option<DevToolsTargetId>,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsGetClientWindowsCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsCreateBrowserContextCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub browser_context_id: Option<DevToolsBrowserContextId>,pub accept_insecure_certs: Option<bool>,pub proxy_server: Option<String>,@@ -551,25 +551,25 @@ pub struct DevToolsCreateBrowserContextCommand {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsGetBrowserContextsCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsRemoveBrowserContextCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub browser_context_id: DevToolsBrowserContextId,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsSetDownloadBehaviorCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub behavior: Option<DevToolsDownloadBehaviorSetting>,pub user_contexts: Option<Vec<DevToolsBrowserContextId>>,}#[derive(Debug, Clone, PartialEq)]pub struct DevToolsSetPermissionCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub permission: Value,pub setting: String,pub origin: String,@@ -586,48 +586,48 @@ pub struct DevToolsDownloadBehaviorSetting {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsGetTargetInfoCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub target_id: Option<DevToolsTargetId>,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsGetFrameTreeCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub max_depth: Option<u32>,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsGetFrameTreesCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub max_depth: Option<u32>,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsGetLayoutMetricsCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsGetJavaScriptDialogCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsSetJavaScriptDialogPromptTextCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub prompt_text: String,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsHandleJavaScriptDialogCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub accept: bool,pub prompt_text: String,}#[derive(Debug, Clone, PartialEq)]pub struct DevToolsCaptureScreenshotCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub format: Option<String>,pub quality: Option<u8>,pub clip: Option<DevToolsCaptureScreenshotClip>,@@ -657,7 +657,7 @@ pub struct DevToolsScreenshotElementClip {#[derive(Debug, Clone, PartialEq)]pub struct DevToolsPrintToPdfCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub landscape: Option<bool>,pub print_background: Option<bool>,pub scale: Option<f64>,@@ -680,7 +680,7 @@ pub enum DevToolsPrintToPdfTransferMode {#[derive(Debug, Clone, PartialEq)]pub struct DevToolsSetViewportCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub browser_context_ids: Vec<DevToolsBrowserContextId>,pub viewport: DevToolsViewportSetting,pub device_pixel_ratio: DevToolsDevicePixelRatioSetting,@@ -709,13 +709,13 @@ impl DevToolsWindowState {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsSetWindowStateCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub state: DevToolsWindowState,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsSetClientWindowStateCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub client_window: DevToolsTargetId,pub state: DevToolsWindowState,pub width: Option<u32>,@@ -726,7 +726,7 @@ pub struct DevToolsSetClientWindowStateCommand {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsSetUserAgentOverrideCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub target_ids: Vec<DevToolsTargetId>,pub browser_context_ids: Vec<DevToolsBrowserContextId>,pub user_agent: Option<String>,@@ -734,7 +734,7 @@ pub struct DevToolsSetUserAgentOverrideCommand {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsSetLocaleOverrideCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub target_ids: Vec<DevToolsTargetId>,pub browser_context_ids: Vec<DevToolsBrowserContextId>,pub locale: Option<String>,@@ -742,7 +742,7 @@ pub struct DevToolsSetLocaleOverrideCommand {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsSetTimezoneOverrideCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub target_ids: Vec<DevToolsTargetId>,pub browser_context_ids: Vec<DevToolsBrowserContextId>,pub timezone: Option<String>,@@ -767,7 +767,7 @@ pub enum DevToolsGeolocationOverrideState {#[derive(Debug, Clone, PartialEq)]pub struct DevToolsSetGeolocationOverrideCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub target_ids: Vec<DevToolsTargetId>,pub browser_context_ids: Vec<DevToolsBrowserContextId>,pub override_state: Option<DevToolsGeolocationOverrideState>,@@ -786,7 +786,7 @@ impl DevToolsNetworkConditions {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsSetNetworkConditionsCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub target_ids: Vec<DevToolsTargetId>,pub browser_context_ids: Vec<DevToolsBrowserContextId>,pub network_conditions: Option<DevToolsNetworkConditions>,@@ -808,7 +808,7 @@ pub enum DevToolsDevicePixelRatioSetting {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsGetCookiesCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub browser_context_id: Option<DevToolsBrowserContextId>,pub urls: Option<Vec<String>>,pub filter: Option<DevToolsCookieFilter>,@@ -816,7 +816,7 @@ pub struct DevToolsGetCookiesCommand {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsDeleteCookiesCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub browser_context_id: Option<DevToolsBrowserContextId>,pub name: Option<String>,pub url: Option<String>,@@ -828,7 +828,7 @@ pub struct DevToolsDeleteCookiesCommand {#[derive(Debug, Clone, PartialEq)]pub struct DevToolsSetCookiesCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub browser_context_id: Option<DevToolsBrowserContextId>,pub cookies: Vec<DevToolsCookieParam>,}@@ -866,13 +866,13 @@ pub struct DevToolsCookieFilter {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsGetFrameOwnerCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub frame_id: DevToolsFrameId,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsLocateNodesCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub locator: DevToolsLocateNodesLocator,pub max_node_count: Option<u64>,pub start_nodes: Vec<Value>,@@ -910,7 +910,7 @@ pub enum DevToolsLocateNodesTextMatch {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsGetDocumentCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub depth: Option<i32>,pub pierce: bool,pub flattened: bool,@@ -924,7 +924,7 @@ pub enum DevToolsDomNodeReference {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsRequestChildNodesCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub reference: DevToolsDomNodeReference,pub depth: i32,pub pierce: bool,@@ -932,7 +932,7 @@ pub struct DevToolsRequestChildNodesCommand {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsQuerySelectorCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub root: Option<DevToolsDomNodeReference>,pub selector: String,pub multiple: bool,@@ -940,14 +940,14 @@ pub struct DevToolsQuerySelectorCommand {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsPerformSearchCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub query: String,pub include_user_agent_shadow_dom: bool,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsGetSearchResultsCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub search_id: String,pub from_index: usize,pub to_index: usize,@@ -955,13 +955,13 @@ pub struct DevToolsGetSearchResultsCommand {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsDiscardSearchResultsCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub search_id: String,}#[derive(Debug, Clone, PartialEq)]pub struct DevToolsGetNodeForLocationCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub x: f64,pub y: f64,pub include_user_agent_shadow_dom: bool,@@ -977,7 +977,7 @@ pub struct DevToolsGetNodeForLocationResult {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsResolveNodeCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub reference: DevToolsDomNodeReference,pub execution_context_id: Option<i64>,pub object_group: Option<String>,@@ -985,26 +985,26 @@ pub struct DevToolsResolveNodeCommand {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsGetAttributesCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub reference: DevToolsDomNodeReference,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsGetTextCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub reference: DevToolsDomNodeReference,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsGetPropertyCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub reference: DevToolsDomNodeReference,pub name: String,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsPushNodesByBackendIdsCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub backend_node_ids: Vec<u32>,}@@ -1015,7 +1015,7 @@ pub struct DevToolsPushNodesByBackendIdsResult {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsDescribeNodeCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub reference: Option<DevToolsDomNodeReference>,pub depth: i32,pub pierce: bool,@@ -1033,7 +1033,7 @@ pub enum DevToolsDomObjectReferenceOperation {#[derive(Debug, Clone, PartialEq)]pub struct DevToolsElementClickCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub operation: DevToolsElementClickOperation,}@@ -1045,14 +1045,14 @@ pub enum DevToolsElementClickOperation {#[derive(Debug, Clone, PartialEq)]pub struct DevToolsDomObjectReferenceCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub object_id: DevToolsRemoteHandleId,pub operation: DevToolsDomObjectReferenceOperation,}#[derive(Debug, Clone, PartialEq)]pub struct DevToolsSetFileInputFilesCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub object_id: DevToolsRemoteHandleId,pub files: Vec<SelectedFile>,pub append: bool,@@ -1060,14 +1060,14 @@ pub struct DevToolsSetFileInputFilesCommand {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsGetOuterHtmlCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub reference: Option<DevToolsDomNodeReference>,pub include_shadow_dom: bool,}#[derive(Debug, Clone, PartialEq)]pub struct DevToolsScrollIntoViewIfNeededCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub reference: Option<DevToolsDomNodeReference>,pub rect: Option<DomScrollIntoViewRect>,}@@ -1080,20 +1080,20 @@ pub enum DevToolsDomGeometryOperation {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsDomGeometryCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub reference: DevToolsDomNodeReference,pub operation: DevToolsDomGeometryOperation,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsRemoveNodeCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub reference: DevToolsDomNodeReference,}#[derive(Debug, Clone, PartialEq)]pub struct DevToolsAddPreloadScriptCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub source: DevToolsPreloadScriptSource,pub world_name: Option<String>,pub target_ids: Option<Vec<DevToolsTargetId>>,@@ -1113,7 +1113,7 @@ pub enum DevToolsPreloadScriptSource {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsRemovePreloadScriptCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub script_id: DevToolsPreloadScriptId,}@@ -1133,7 +1133,7 @@ pub enum DevToolsPointerType {#[derive(Debug, Clone, PartialEq)]pub struct DevToolsDispatchMouseEventCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub event_type: DevToolsMouseEventType,pub pointer_type: DevToolsPointerType,pub x: f64,@@ -1160,7 +1160,7 @@ pub enum DevToolsKeyEventType {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsDispatchKeyEventCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub event_type: DevToolsKeyEventType,pub key: String,pub code: String,@@ -1187,7 +1187,7 @@ pub struct DevToolsTouchPoint {#[derive(Debug, Clone, PartialEq)]pub struct DevToolsDispatchTouchEventCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub event_type: DevToolsTouchEventType,pub touch_points: Vec<DevToolsTouchPoint>,}@@ -1217,7 +1217,7 @@ pub struct DevToolsDragData {#[derive(Debug, Clone, PartialEq)]pub struct DevToolsDispatchDragEventCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub event_type: DevToolsDragEventType,pub x: f64,pub y: f64,@@ -1227,7 +1227,7 @@ pub struct DevToolsDispatchDragEventCommand {#[derive(Debug, Clone, PartialEq)]pub struct DevToolsSynthesizeTapGestureCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub x: f64,pub y: f64,}@@ -1253,7 +1253,7 @@ pub struct DevToolsNetworkInterceptPattern {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsAddNetworkInterceptCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub intercept_id: DevToolsNetworkInterceptId,pub phases: Vec<DevToolsNetworkInterceptPhase>,pub url_patterns: Vec<DevToolsNetworkInterceptPattern>,@@ -1261,20 +1261,20 @@ pub struct DevToolsAddNetworkInterceptCommand {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsRemoveNetworkInterceptCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub intercept_id: DevToolsNetworkInterceptId,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsSetCacheBehaviorCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub target_ids: Vec<DevToolsTargetId>,pub cache_disabled: bool,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsSetExtraHeadersCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub target_ids: Vec<DevToolsTargetId>,pub browser_context_ids: Vec<DevToolsBrowserContextId>,pub headers: moli_fetch::RequestHeaders,@@ -1288,7 +1288,7 @@ pub enum DevToolsNetworkDataType {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsAddNetworkDataCollectorCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub collector_id: DevToolsNetworkDataCollectorId,pub data_types: Vec<DevToolsNetworkDataType>,pub max_encoded_data_size: u64,@@ -1298,13 +1298,13 @@ pub struct DevToolsAddNetworkDataCollectorCommand {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsRemoveNetworkDataCollectorCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub collector_id: DevToolsNetworkDataCollectorId,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsDisownNetworkDataCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub request_id: DevToolsRequestId,pub data_type: DevToolsNetworkDataType,pub collector_id: DevToolsNetworkDataCollectorId,@@ -1312,7 +1312,7 @@ pub struct DevToolsDisownNetworkDataCommand {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsGetNetworkDataCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub request_id: DevToolsRequestId,pub data_type: DevToolsNetworkDataType,pub collector: Option<DevToolsNetworkDataCollectorId>,@@ -1321,7 +1321,7 @@ pub struct DevToolsGetNetworkDataCommand {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsContinueInterceptedRequestCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub request_id: DevToolsRequestId,pub url: Option<String>,pub method: Option<String>,@@ -1332,7 +1332,7 @@ pub struct DevToolsContinueInterceptedRequestCommand {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsContinueInterceptedResponseCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub request_id: DevToolsRequestId,pub response_code: Option<u16>,pub response_headers: Option<Vec<(String, Vec<u8>)>>,@@ -1355,7 +1355,7 @@ pub enum DevToolsAuthChallengeAction {#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsContinueWithAuthCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub request_id: DevToolsRequestId,pub action: DevToolsAuthChallengeAction,pub username: Option<String>,@@ -1382,14 +1382,14 @@ impl std::error::Error for DevToolsRequestFailure {}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsFailInterceptedRequestCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub request_id: DevToolsRequestId,pub failure: DevToolsRequestFailure,}#[derive(Debug, Clone, PartialEq, Eq)]pub struct DevToolsFulfillInterceptedRequestCommand {- pub context: DevToolsCommandContext,+ pub context: AutomationContext,pub request_id: DevToolsRequestId,pub response_code: u16,pub response_headers: Vec<(String, Vec<u8>)>,@@ -1398,7 +1398,7 @@ pub struct DevToolsFulfillInterceptedRequestCommand {}#[derive(Debug, Clone, PartialEq)]-pub enum DevToolsCommandResult {+pub enum AutomationResult {ElementClickPreparation(Result<moli_core::page::RendererElementClickTarget,diff --git a/moli-protocol/src/cdp_projection.rs b/moli-protocol/src/cdp_projection.rsindex 0e40b1c44..41c4b5304 100644--- a/moli-protocol/src/cdp_projection.rs+++ b/moli-protocol/src/cdp_projection.rs@@ -1,4 +1,4 @@-use crate::devtools_runtime::DevToolsRemoteValue;+use crate::automation::DevToolsRemoteValue;use moli_protocol_cdp::remote_object_from_json_value;use serde_json::{Value, json};diff --git a/moli-protocol/src/conn.rs b/moli-protocol/src/conn.rsindex 4fd9614c7..59bf56372 100644--- a/moli-protocol/src/conn.rs+++ b/moli-protocol/src/conn.rs@@ -14,8 +14,8 @@ use moli_fetch::FetchConfig;use parking_lot::Mutex;use serde_json::json;-use crate::devtools_runtime::{- DevToolsCommandContext, DevToolsTargetFilterEntry, DevToolsTargetInfo, DevToolsTargetKind,+use crate::automation::{+ AutomationContext, DevToolsTargetFilterEntry, DevToolsTargetInfo, DevToolsTargetKind,};use crate::domains::command_output::{BackgroundProtocolEventBuffer, CommandOutputBuffer};@@ -33,6 +33,7 @@ pub const DEFAULT_CDP_PAGE_TARGET_ID: &str = "moli-default";pub const DEFAULT_CDP_TAB_TARGET_ID: &str = "moli-default-tab";mod activity_source;+mod automation_command;mod bidi_channel_work;mod body_spool;mod browser_context;@@ -43,7 +44,6 @@ mod cookie_owner;mod cookie_policy_surface;#[cfg(test)]mod cookie_store_boundary;-mod devtools_command;mod dispatch;mod downloads;mod fetch_support;@@ -68,6 +68,8 @@ mod target;mod top_level_navigation_work;pub use crate::domains::network::IoStreamState;+pub use automation_command::AutomationCommandDispatchOutcome;+pub(crate) use automation_command::AutomationExecutionOutput;#[cfg(test)]pub(crate) use bidi_channel_work::BidiChannelOwnerActionKind;pub(crate) use bidi_channel_work::{@@ -94,8 +96,6 @@ pub(crate) use cookie_manager_surface::{pub(crate) use cookie_owner::{BrowserContextCookieGetFreshnessStatus, BrowserContextCookieSetReadinessStatus,};-pub use devtools_command::DevToolsCommandDispatchOutcome;-pub(crate) use devtools_command::DevToolsCommandExecutionOutput;pub use dispatch::{CdpCommandTaskStep, CompletedCdpCommandDispatch, PendingCdpCommandDispatch};pub(crate) use downloads::SharedDownloadRegistry;pub(crate) use fetch_support::PendingStreamingDocumentResponseNavigation;@@ -1655,19 +1655,19 @@ impl CdpConnection {pub fn has_inflight_background_navigation_for_devtools_context(&self,- context: &crate::devtools_runtime::DevToolsCommandContext,+ context: &crate::automation::AutomationContext,) -> bool {context.target_id.as_ref()- .map(crate::devtools_runtime::DevToolsTargetId::as_str)+ .map(crate::automation::DevToolsTargetId::as_str).map(str::to_owned).or_else(|| {self.target_id_for_session_owner(context.session_id.as_ref()- .map(crate::devtools_runtime::DevToolsSessionId::as_str),+ .map(crate::automation::DevToolsSessionId::as_str),)}).is_some_and(|target_id| self.has_inflight_background_navigation_for_target(&target_id))@@ -1730,7 +1730,7 @@ impl CdpConnection {/// browser context.pub fn devtools_context_document_navigation_state(&mut self,- context: &DevToolsCommandContext,+ context: &AutomationContext,) -> DevToolsDocumentNavigationState {let Some(owner_scope) = self.command_owner_scope_for_devtools_context(context) else {return DevToolsDocumentNavigationState::Unavailable;@@ -2234,10 +2234,7 @@ impl CdpConnection {true}- pub fn devtools_context_routes_to_top_level_target(- &self,- context: &DevToolsCommandContext,- ) -> bool {+ pub fn devtools_context_routes_to_top_level_target(&self, context: &AutomationContext) -> bool {context.target_id.as_ref().is_some_and(|target_id| {self.target_session_route_for_target_id(target_id.as_str()).is_some()@@ -2246,7 +2243,7 @@ impl CdpConnection {pub(crate) fn command_owner_scope_for_devtools_context(&self,- context: &DevToolsCommandContext,+ context: &AutomationContext,) -> Option<CommandOwnerScope> {if let Some(target_id) = context.target_id.as_ref() {let route = self@@ -2276,7 +2273,7 @@ impl CdpConnection {/// within that Page and changes when the Page itself is replaced.pub fn page_residence_identity_for_devtools_context(&mut self,- context: &DevToolsCommandContext,+ context: &AutomationContext,) -> Option<DevToolsPageResidenceIdentity> {let owner_scope = self.command_owner_scope_for_devtools_context(context)?;self.target_page_residence_identity_for_owner(&owner_scope)@@ -2284,7 +2281,7 @@ impl CdpConnection {pub fn capture_devtools_document_lifecycle_wait_key(&mut self,- context: &DevToolsCommandContext,+ context: &AutomationContext,expected_loader_id: &str,milestone: moli_core::page::RendererDocumentLifecycleMilestone,) -> Option<DevToolsDocumentLifecycleWaitKey> {@@ -2307,7 +2304,7 @@ impl CdpConnection {pub fn devtools_document_lifecycle_wait_state(&mut self,- context: &DevToolsCommandContext,+ context: &AutomationContext,key: &DevToolsDocumentLifecycleWaitKey,) -> DevToolsDocumentLifecycleWaitState {let Some(owner_scope) = self.command_owner_scope_for_devtools_context(context) else {@@ -2322,7 +2319,7 @@ impl CdpConnection {pub fn release_devtools_document_lifecycle_wait_key(&mut self,- context: &DevToolsCommandContext,+ context: &AutomationContext,key: &DevToolsDocumentLifecycleWaitKey,) -> bool {let Some(owner_scope) = self.command_owner_scope_for_devtools_context(context) else {diff --git a/moli-protocol/src/conn/devtools_command.rs b/moli-protocol/src/conn/automation_command.rssimilarity index 71%rename from moli-protocol/src/conn/devtools_command.rsrename to moli-protocol/src/conn/automation_command.rsindex d28b926ed..3db832c57 100644--- a/moli-protocol/src/conn/devtools_command.rs+++ b/moli-protocol/src/conn/automation_command.rs@@ -1,6 +1,6 @@-use crate::devtools_runtime::{- DevToolsCommand, DevToolsCommandContext, DevToolsCommandResult, DevToolsError,- DevToolsErrorKind, DevToolsTargetId,+use crate::automation::{+ AutomationCommand, AutomationContext, AutomationResult, DevToolsError, DevToolsErrorKind,+ DevToolsTargetId,};use super::*;@@ -13,14 +13,14 @@ use super::*;/// error, so neither the events nor the exact renderer cursor may be discarded/// while a domain-specific adapter translates the result.#[must_use = "DevTools execution output carries protocol events and an exact renderer cursor"]-pub(crate) struct DevToolsCommandExecutionOutput {- result: Result<DevToolsCommandResult, DevToolsError>,+pub(crate) struct AutomationExecutionOutput {+ result: Result<AutomationResult, DevToolsError>,protocol_events: Vec<BackgroundProtocolEvent>,renderer_output_predecessor: Option<moli_core::RendererOutputFence>,}-impl DevToolsCommandExecutionOutput {- pub(crate) fn new(result: Result<DevToolsCommandResult, DevToolsError>) -> Self {+impl AutomationExecutionOutput {+ pub(crate) fn new(result: Result<AutomationResult, DevToolsError>) -> Self {Self {result,protocol_events: Vec::new(),@@ -29,7 +29,7 @@ impl DevToolsCommandExecutionOutput {}pub(crate) fn from_parts(- result: Result<DevToolsCommandResult, DevToolsError>,+ result: Result<AutomationResult, DevToolsError>,protocol_events: Vec<BackgroundProtocolEvent>,renderer_output_predecessor: Option<moli_core::RendererOutputFence>,) -> Self {@@ -43,7 +43,7 @@ impl DevToolsCommandExecutionOutput {pub(crate) fn into_parts(self,) -> (- Result<DevToolsCommandResult, DevToolsError>,+ Result<AutomationResult, DevToolsError>,Vec<BackgroundProtocolEvent>,Option<moli_core::RendererOutputFence>,) {@@ -55,16 +55,16 @@ impl DevToolsCommandExecutionOutput {}}-pub struct DevToolsCommandDispatchOutcome {- result: Result<DevToolsCommandResult, DevToolsError>,+pub struct AutomationCommandDispatchOutcome {+ result: Result<AutomationResult, DevToolsError>,scheduler_events: Vec<CdpSchedulerEvent>,protocol_events: Vec<BackgroundProtocolEvent>,renderer_output_predecessor: Option<moli_core::RendererOutputFence>,}-impl DevToolsCommandDispatchOutcome {+impl AutomationCommandDispatchOutcome {pub(crate) fn new_with_protocol_events(- result: Result<DevToolsCommandResult, DevToolsError>,+ result: Result<AutomationResult, DevToolsError>,scheduler_events: Vec<CdpSchedulerEvent>,protocol_events: Vec<BackgroundProtocolEvent>,) -> Self {@@ -98,7 +98,7 @@ impl DevToolsCommandDispatchOutcome {pub fn into_parts(self,) -> (- Result<DevToolsCommandResult, DevToolsError>,+ Result<AutomationResult, DevToolsError>,Vec<CdpSchedulerEvent>,) {assert!(@@ -118,7 +118,7 @@ impl DevToolsCommandDispatchOutcome {pub fn into_parts_with_protocol_events(self,) -> (- Result<DevToolsCommandResult, DevToolsError>,+ Result<AutomationResult, DevToolsError>,Vec<CdpSchedulerEvent>,Vec<BackgroundProtocolEvent>,) {@@ -134,7 +134,7 @@ impl DevToolsCommandDispatchOutcome {pub fn into_complete_parts(self,) -> (- Result<DevToolsCommandResult, DevToolsError>,+ Result<AutomationResult, DevToolsError>,Vec<CdpSchedulerEvent>,Vec<BackgroundProtocolEvent>,Option<moli_core::RendererOutputFence>,@@ -149,30 +149,32 @@ impl DevToolsCommandDispatchOutcome {}impl CdpConnection {- pub async fn execute_devtools_command(+ pub async fn execute_automation_command(&mut self,- command: DevToolsCommand,- ) -> DevToolsCommandDispatchOutcome {- Box::pin(self.execute_devtools_command_with_protocol_events(command)).await+ command: AutomationCommand,+ ) -> AutomationCommandDispatchOutcome {+ Box::pin(self.execute_automation_command_with_protocol_events(command)).await}- pub async fn execute_devtools_command_with_protocol_events(+ pub async fn execute_automation_command_with_protocol_events(&mut self,- command: DevToolsCommand,- ) -> DevToolsCommandDispatchOutcome {- self.execute_devtools_command_with_protocol_events_with_background_command_id(command, None)- .await+ command: AutomationCommand,+ ) -> AutomationCommandDispatchOutcome {+ self.execute_automation_command_with_protocol_events_with_background_command_id(+ command, None,+ )+ .await}- pub async fn execute_devtools_command_with_protocol_events_with_background_command_id(+ pub async fn execute_automation_command_with_protocol_events_with_background_command_id(&mut self,- command: DevToolsCommand,+ command: AutomationCommand,background_command_id: Option<u64>,- ) -> DevToolsCommandDispatchOutcome {+ ) -> AutomationCommandDispatchOutcome {let command_context = command.context().clone();let mut renderer_output_predecessor = None;let (result, protocol_events) = match command {- DevToolsCommand::CreateTarget(command) => {+ AutomationCommand::CreateTarget(command) => {let (result, protocol_events, predecessor) =crate::domains::target::execute_devtools_create_target_command_async_with_protocol_events(self,@@ -182,30 +184,30 @@ impl CdpConnection {renderer_output_predecessor = predecessor;(result, protocol_events)}- command @ (DevToolsCommand::GetTargets(_)- | DevToolsCommand::GetServiceWorkerLogs(_)- | DevToolsCommand::GetClientWindows(_)- | DevToolsCommand::CreateBrowserContext(_)- | DevToolsCommand::GetBrowserContexts(_)- | DevToolsCommand::GetTargetInfo(_)) => {+ command @ (AutomationCommand::GetTargets(_)+ | AutomationCommand::GetServiceWorkerLogs(_)+ | AutomationCommand::GetClientWindows(_)+ | AutomationCommand::CreateBrowserContext(_)+ | AutomationCommand::GetBrowserContexts(_)+ | AutomationCommand::GetTargetInfo(_)) => {crate::domains::target::execute_immediate_devtools_target_command_with_protocol_events(self, command,)}- command @ DevToolsCommand::SetDownloadBehavior(_) => (+ command @ AutomationCommand::SetDownloadBehavior(_) => (crate::domains::browser::execute_devtools_browser_command(self, command),Vec::new(),),- command @ DevToolsCommand::SetPermission(_) => (+ command @ AutomationCommand::SetPermission(_) => (Box::pin(crate::domains::browser::execute_devtools_browser_command_async(self, command,)).await,Vec::new(),),- command @ (DevToolsCommand::CloseTarget(_)- | DevToolsCommand::ActivateTarget(_)- | DevToolsCommand::RemoveBrowserContext(_)) => {+ command @ (AutomationCommand::CloseTarget(_)+ | AutomationCommand::ActivateTarget(_)+ | AutomationCommand::RemoveBrowserContext(_)) => {Box::pin(crate::domains::target::execute_devtools_target_command_async_with_protocol_events(self, command,@@ -213,20 +215,20 @@ impl CdpConnection {).await}- command @ (DevToolsCommand::Navigate(_)- | DevToolsCommand::Reload(_)- | DevToolsCommand::CaptureScreenshot(_)- | DevToolsCommand::PrintToPdf(_)- | DevToolsCommand::GetJavaScriptDialog(_)- | DevToolsCommand::SetJavaScriptDialogPromptText(_)- | DevToolsCommand::HandleJavaScriptDialog(_)- | DevToolsCommand::GetFrameTree(_)- | DevToolsCommand::GetFrameTrees(_)- | DevToolsCommand::GetLayoutMetrics(_)- | DevToolsCommand::GetNavigationHistory(_)- | DevToolsCommand::TraverseHistory(_)- | DevToolsCommand::AddPreloadScript(_)- | DevToolsCommand::RemovePreloadScript(_)) => {+ command @ (AutomationCommand::Navigate(_)+ | AutomationCommand::Reload(_)+ | AutomationCommand::CaptureScreenshot(_)+ | AutomationCommand::PrintToPdf(_)+ | AutomationCommand::GetJavaScriptDialog(_)+ | AutomationCommand::SetJavaScriptDialogPromptText(_)+ | AutomationCommand::HandleJavaScriptDialog(_)+ | AutomationCommand::GetFrameTree(_)+ | AutomationCommand::GetFrameTrees(_)+ | AutomationCommand::GetLayoutMetrics(_)+ | AutomationCommand::GetNavigationHistory(_)+ | AutomationCommand::TraverseHistory(_)+ | AutomationCommand::AddPreloadScript(_)+ | AutomationCommand::RemovePreloadScript(_)) => {let (result, protocol_events, predecessor) = Box::pin(crate::domains::page::execute_devtools_page_command_async_with_protocol_events(self,@@ -238,27 +240,27 @@ impl CdpConnection {renderer_output_predecessor = predecessor;(result, protocol_events)}- command @ (DevToolsCommand::SetViewport(_)- | DevToolsCommand::SetWindowState(_)- | DevToolsCommand::SetClientWindowState(_)- | DevToolsCommand::SetUserAgentOverride(_)- | DevToolsCommand::SetLocaleOverride(_)- | DevToolsCommand::SetTimezoneOverride(_)- | DevToolsCommand::SetGeolocationOverride(_)- | DevToolsCommand::SetNetworkConditions(_)- | DevToolsCommand::SetExtraHeaders(_)) => (+ command @ (AutomationCommand::SetViewport(_)+ | AutomationCommand::SetWindowState(_)+ | AutomationCommand::SetClientWindowState(_)+ | AutomationCommand::SetUserAgentOverride(_)+ | AutomationCommand::SetLocaleOverride(_)+ | AutomationCommand::SetTimezoneOverride(_)+ | AutomationCommand::SetGeolocationOverride(_)+ | AutomationCommand::SetNetworkConditions(_)+ | AutomationCommand::SetExtraHeaders(_)) => (Box::pin(crate::domains::emulation::execute_devtools_emulation_command_async(self, command,)).await,Vec::new(),),- command @ (DevToolsCommand::GetRealms(_)- | DevToolsCommand::EvaluateScript(_)- | DevToolsCommand::CallFunction(_)- | DevToolsCommand::TerminateExecution(_)- | DevToolsCommand::LocateNodes(_)- | DevToolsCommand::ReleaseObjects(_)) => {+ command @ (AutomationCommand::GetRealms(_)+ | AutomationCommand::EvaluateScript(_)+ | AutomationCommand::CallFunction(_)+ | AutomationCommand::TerminateExecution(_)+ | AutomationCommand::LocateNodes(_)+ | AutomationCommand::ReleaseObjects(_)) => {let output = Box::pin(crate::domains::runtime::execute_devtools_runtime_command_async_with_protocol_events(self, command,@@ -270,22 +272,22 @@ impl CdpConnection {renderer_output_predecessor = predecessor;(result, protocol_events)}- command @ (DevToolsCommand::GetCookies(_)- | DevToolsCommand::DeleteCookies(_)- | DevToolsCommand::SetCookies(_)) => (+ command @ (AutomationCommand::GetCookies(_)+ | AutomationCommand::DeleteCookies(_)+ | AutomationCommand::SetCookies(_)) => (Box::pin(crate::domains::storage::execute_devtools_storage_command_async(self, command,)).await,Vec::new(),),- command @ (DevToolsCommand::AddNetworkIntercept(_)- | DevToolsCommand::RemoveNetworkIntercept(_)- | DevToolsCommand::ContinueInterceptedRequest(_)- | DevToolsCommand::ContinueInterceptedResponse(_)- | DevToolsCommand::ContinueWithAuth(_)- | DevToolsCommand::FailInterceptedRequest(_)- | DevToolsCommand::FulfillInterceptedRequest(_)) => {+ command @ (AutomationCommand::AddNetworkIntercept(_)+ | AutomationCommand::RemoveNetworkIntercept(_)+ | AutomationCommand::ContinueInterceptedRequest(_)+ | AutomationCommand::ContinueInterceptedResponse(_)+ | AutomationCommand::ContinueWithAuth(_)+ | AutomationCommand::FailInterceptedRequest(_)+ | AutomationCommand::FulfillInterceptedRequest(_)) => {let output = Box::pin(crate::domains::fetch::execute_devtools_fetch_command_async_with_protocol_events(self, command,@@ -297,20 +299,20 @@ impl CdpConnection {renderer_output_predecessor = predecessor;(result, protocol_events)}- command @ (DevToolsCommand::AddNetworkDataCollector(_)- | DevToolsCommand::RemoveNetworkDataCollector(_)- | DevToolsCommand::DisownNetworkData(_)- | DevToolsCommand::GetNetworkData(_)- | DevToolsCommand::SetCacheBehavior(_)) => (+ command @ (AutomationCommand::AddNetworkDataCollector(_)+ | AutomationCommand::RemoveNetworkDataCollector(_)+ | AutomationCommand::DisownNetworkData(_)+ | AutomationCommand::GetNetworkData(_)+ | AutomationCommand::SetCacheBehavior(_)) => (crate::domains::network::execute_devtools_network_command(self, command),Vec::new(),),- command @ (DevToolsCommand::ElementClick(_)- | DevToolsCommand::DispatchMouseEvent(_)- | DevToolsCommand::DispatchKeyEvent(_)- | DevToolsCommand::DispatchTouchEvent(_)- | DevToolsCommand::DispatchDragEvent(_)- | DevToolsCommand::SynthesizeTapGesture(_)) => {+ command @ (AutomationCommand::ElementClick(_)+ | AutomationCommand::DispatchMouseEvent(_)+ | AutomationCommand::DispatchKeyEvent(_)+ | AutomationCommand::DispatchTouchEvent(_)+ | AutomationCommand::DispatchDragEvent(_)+ | AutomationCommand::SynthesizeTapGesture(_)) => {Box::pin(crate::domains::input::execute_devtools_input_command_async_with_protocol_events(self, command,@@ -318,19 +320,19 @@ impl CdpConnection {).await}- command @ (DevToolsCommand::QuerySelector(_)- | DevToolsCommand::GetAttributes(_)- | DevToolsCommand::GetText(_)- | DevToolsCommand::GetProperty(_)- | DevToolsCommand::GetOuterHtml(_)- | DevToolsCommand::DescribeNode(_)- | DevToolsCommand::GetFrameOwner(_)- | DevToolsCommand::GetNodeForLocation(_)- | DevToolsCommand::ResolveNode(_)- | DevToolsCommand::ScrollIntoViewIfNeeded(_)- | DevToolsCommand::DomObjectReference(_)- | DevToolsCommand::SetFileInputFiles(_)- | DevToolsCommand::DomGeometry(_)) => (+ command @ (AutomationCommand::QuerySelector(_)+ | AutomationCommand::GetAttributes(_)+ | AutomationCommand::GetText(_)+ | AutomationCommand::GetProperty(_)+ | AutomationCommand::GetOuterHtml(_)+ | AutomationCommand::DescribeNode(_)+ | AutomationCommand::GetFrameOwner(_)+ | AutomationCommand::GetNodeForLocation(_)+ | AutomationCommand::ResolveNode(_)+ | AutomationCommand::ScrollIntoViewIfNeeded(_)+ | AutomationCommand::DomObjectReference(_)+ | AutomationCommand::SetFileInputFiles(_)+ | AutomationCommand::DomGeometry(_)) => (Box::pin(crate::domains::dom::execute_devtools_dom_command_async(self, command,))@@ -345,7 +347,7 @@ impl CdpConnection {Vec::new(),),};- self.finish_devtools_command_dispatch(+ self.finish_automation_command_dispatch(command_context,result,protocol_events,@@ -354,13 +356,13 @@ impl CdpConnection {.await}- pub(crate) async fn finish_devtools_command_dispatch(+ pub(crate) async fn finish_automation_command_dispatch(&mut self,- command_context: DevToolsCommandContext,- result: Result<DevToolsCommandResult, DevToolsError>,+ command_context: AutomationContext,+ result: Result<AutomationResult, DevToolsError>,mut protocol_events: Vec<BackgroundProtocolEvent>,renderer_output_predecessor: Option<moli_core::RendererOutputFence>,- ) -> DevToolsCommandDispatchOutcome {+ ) -> AutomationCommandDispatchOutcome {let mut dispatch_context = CommandDispatchContext::default();Box::pin(self.project_protocol_local_outputs_for_direct_command(&command_context,@@ -370,7 +372,7 @@ impl CdpConnection {.await;protocol_events.extend(dispatch_context.take_post_response_events());let scheduler_events = self.take_scheduler_events();- DevToolsCommandDispatchOutcome::new_with_protocol_events(+ AutomationCommandDispatchOutcome::new_with_protocol_events(result,scheduler_events,protocol_events,@@ -484,7 +486,7 @@ impl CdpConnection {async fn project_protocol_local_outputs_for_direct_command(&mut self,- context: &DevToolsCommandContext,+ context: &AutomationContext,dispatch_context: &mut CommandDispatchContext,protocol_events: &mut Vec<BackgroundProtocolEvent>,) {diff --git a/moli-protocol/src/conn/browser_context/fetch_owner.rs b/moli-protocol/src/conn/browser_context/fetch_owner.rsindex 2d351c618..dc2cf47b2 100644--- a/moli-protocol/src/conn/browser_context/fetch_owner.rs+++ b/moli-protocol/src/conn/browser_context/fetch_owner.rs@@ -1,5 +1,6 @@use super::target_session_owner::TargetSessionOwnerMut;use super::*;+use crate::automation::{DevToolsNetworkInterceptId, DevToolsNetworkResourceType};use crate::conn::state::{TargetFetchConfig, TargetFetchOwner, TargetFetchSubresourceInterceptionSnapshot,};@@ -11,7 +12,6 @@ use crate::conn::{PendingSubresourceFetchAuthRequest, PendingSubresourceFetchRequest,PendingSubresourceFetchResponseRequest, TargetRuntimeSlot,};-use crate::devtools_runtime::{DevToolsNetworkInterceptId, DevToolsNetworkResourceType};use crate::domains::network::TargetIoStreamRead;pub(crate) type SessionOwnerPendingFetchState = (diff --git a/moli-protocol/src/conn/browser_context/network_owner.rs b/moli-protocol/src/conn/browser_context/network_owner.rsindex b1f421834..aeb49d4ba 100644--- a/moli-protocol/src/conn/browser_context/network_owner.rs+++ b/moli-protocol/src/conn/browser_context/network_owner.rs@@ -1,8 +1,8 @@use super::target_session_owner::{TargetSessionOwnerMut, TargetSessionStateMut};use super::*;+use crate::automation::DevToolsNetworkDataType;use crate::conn::CdpSessionRoute;use crate::conn::{CapturedBody, TargetRuntimeSlot};-use crate::devtools_runtime::DevToolsNetworkDataType;use crate::domains::network::{CapturedRequestBody, CapturedResponseBody, CollectedNetworkDataArtifact,NetworkBacklogPreferredRequestId, PendingNetworkBacklogDeliverySnapshot,diff --git a/moli-protocol/src/conn/browser_context/target_session_owner.rs b/moli-protocol/src/conn/browser_context/target_session_owner.rsindex 7b2697428..5c2abcac4 100644--- a/moli-protocol/src/conn/browser_context/target_session_owner.rs+++ b/moli-protocol/src/conn/browser_context/target_session_owner.rs@@ -1,4 +1,5 @@use super::*;+use crate::automation::{DevToolsNetworkInterceptId, DevToolsNetworkResourceType};use crate::conn::state::{BrowserContextPageStorageHandles, BrowserContextResourceStorageHandles, DevToolsSessionState,PageNavigationHistoryEntry, PageTargetHost, RendererMainDocumentCommitSeed, TargetFetchConfig,@@ -14,7 +15,6 @@ use crate::conn::{PendingSubresourceFetchAuthRequest, PendingSubresourceFetchRequest,PendingSubresourceFetchResponseRequest, RuntimeBindingDefinition,};-use crate::devtools_runtime::{DevToolsNetworkInterceptId, DevToolsNetworkResourceType};use moli_cookie_jar::{StoredCookieQueryReport, StoredCookieSetReport};#[cfg(test)]use moli_core::page::RendererServiceWorkerVersionStatus;diff --git a/moli-protocol/src/conn/command_owner_scope.rs b/moli-protocol/src/conn/command_owner_scope.rsindex 6ae83e8fb..4940b1c66 100644--- a/moli-protocol/src/conn/command_owner_scope.rs+++ b/moli-protocol/src/conn/command_owner_scope.rs@@ -102,14 +102,14 @@ impl CommandOwnerScope {#[cfg(test)]mod tests {use super::*;- use crate::conn::{BrowserContext, PageTargetHost};- use crate::devtools_runtime::{- DevToolsCommandContext, DevToolsProtocol, DevToolsSessionId, DevToolsTargetId,+ use crate::automation::{+ AutomationContext, DevToolsSessionId, DevToolsTargetId, FrontendProtocol,};+ use crate::conn::{BrowserContext, PageTargetHost};- fn page_context(session_id: &str, target_id: &str) -> DevToolsCommandContext {- DevToolsCommandContext {- protocol: DevToolsProtocol::Cdp,+ fn page_context(session_id: &str, target_id: &str) -> AutomationContext {+ AutomationContext {+ protocol: FrontendProtocol::Cdp,session_id: Some(DevToolsSessionId::from(session_id)),target_id: Some(DevToolsTargetId::from(target_id)),browser_context_id: None,diff --git a/moli-protocol/src/conn/command_view.rs b/moli-protocol/src/conn/command_view.rsindex 8bcdf0a94..001e31ecf 100644--- a/moli-protocol/src/conn/command_view.rs+++ b/moli-protocol/src/conn/command_view.rs@@ -7,8 +7,8 @@ use serde_json::{Map, Value};use tracing::debug;use crate::{- DevToolsBrowserContextId, DevToolsCommandContext, DevToolsProtocol, DevToolsSessionId,- DevToolsTargetId,+ AutomationContext, DevToolsBrowserContextId, DevToolsSessionId, DevToolsTargetId,+ FrontendProtocol,};/// Ephemeral view of the current in-flight protocol command.@@ -114,13 +114,13 @@ impl<'a> Cmd<'a> {/// Build the protocol-neutral command context for shared DevTools command/// dispatch. Existing domain handlers still own target/browser-context/// resolution; those IDs can be filled by the caller once resolved.- pub fn devtools_command_context(+ pub fn automation_context(&self,target_id: Option<impl Into<DevToolsTargetId>>,browser_context_id: Option<impl Into<DevToolsBrowserContextId>>,- ) -> DevToolsCommandContext {- DevToolsCommandContext {- protocol: DevToolsProtocol::Cdp,+ ) -> AutomationContext {+ AutomationContext {+ protocol: FrontendProtocol::Cdp,session_id: self.session_id.map(DevToolsSessionId::from),target_id: target_id.map(Into::into),browser_context_id: browser_context_id.map(Into::into),@@ -175,9 +175,9 @@ mod tests {r#"{"id":7,"method":"Runtime.evaluate"}"#,);- let context = cmd.devtools_command_context(Some("target-1"), Some("context-1"));+ let context = cmd.automation_context(Some("target-1"), Some("context-1"));- assert_eq!(context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(context.protocol, FrontendProtocol::Cdp);assert_eq!(context.session_id.as_ref().map(DevToolsSessionId::as_str),Some("session-1")diff --git a/moli-protocol/src/conn/dispatch_tests/bidi.rs b/moli-protocol/src/conn/dispatch_tests/bidi.rsindex c426fb63b..127e56a67 100644--- a/moli-protocol/src/conn/dispatch_tests/bidi.rs+++ b/moli-protocol/src/conn/dispatch_tests/bidi.rs@@ -52,20 +52,18 @@ async fn bidi_fetch_control_resolves_background_request_owner() {Some(CdpSessionRoute::PageTarget { target_id, .. }) if target_id == "TID-background"));- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let outcome = conn- .execute_devtools_command(DevToolsCommand::FailInterceptedRequest(+ .execute_automation_command(AutomationCommand::FailInterceptedRequest(DevToolsFailInterceptedRequestCommand {context,request_id: DevToolsRequestId::from("FETCH-background"),- failure: crate::devtools_runtime::DevToolsRequestFailure::Failed(- "Failed".to_owned(),- ),+ failure: crate::automation::DevToolsRequestFailure::Failed("Failed".to_owned()),},)).await;@@ -73,7 +71,7 @@ async fn bidi_fetch_control_resolves_background_request_owner() {assert_eq!(result.expect("BiDi failRequest should resolve background owner"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);assert!(conn.pending_fetch_request_session_route("FETCH-background")@@ -93,7 +91,7 @@ async fn bidi_fetch_control_resolves_background_request_owner() {#[tokio::test]async fn bidi_fetch_request_actions_resolve_background_request_owner() {assert_bidi_fetch_action_consumes_background_request(- DevToolsCommand::ContinueInterceptedRequest(DevToolsContinueInterceptedRequestCommand {+ AutomationCommand::ContinueInterceptedRequest(DevToolsContinueInterceptedRequestCommand {context: bidi_fetch_command_context(),request_id: DevToolsRequestId::from("FETCH-background-continue-request"),url: None,@@ -107,20 +105,22 @@ async fn bidi_fetch_request_actions_resolve_background_request_owner() {.await;assert_bidi_fetch_action_consumes_background_request(- DevToolsCommand::ContinueInterceptedResponse(DevToolsContinueInterceptedResponseCommand {- context: bidi_fetch_command_context(),- request_id: DevToolsRequestId::from("FETCH-background-continue-response"),- response_code: None,- response_headers: None,- response_phrase: None,- auth_credentials: None,- }),+ AutomationCommand::ContinueInterceptedResponse(+ DevToolsContinueInterceptedResponseCommand {+ context: bidi_fetch_command_context(),+ request_id: DevToolsRequestId::from("FETCH-background-continue-response"),+ response_code: None,+ response_headers: None,+ response_phrase: None,+ auth_credentials: None,+ },+ ),"FETCH-background-continue-response",).await;assert_bidi_fetch_action_consumes_background_request(- DevToolsCommand::FulfillInterceptedRequest(DevToolsFulfillInterceptedRequestCommand {+ AutomationCommand::FulfillInterceptedRequest(DevToolsFulfillInterceptedRequestCommand {context: bidi_fetch_command_context(),request_id: DevToolsRequestId::from("FETCH-background-provide-response"),response_code: 204,@@ -136,23 +136,25 @@ async fn bidi_fetch_request_actions_resolve_background_request_owner() {#[tokio::test]async fn bidi_create_target_installs_initial_about_blank_page_without_default_preload() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-lifecycle-create")),target_id: None,browser_context_id: None,};let (create_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context,- url: "about:blank".to_owned(),- browser_context_id: None,- activate: true,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context,+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: true,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(_) =+ let AutomationResult::CreateTarget(_) =create_result.expect("active target create should succeed")else {panic!("expected create target result");@@ -169,15 +171,15 @@ async fn bidi_create_target_installs_initial_about_blank_page_without_default_pr#[tokio::test]async fn devtools_call_function_node_shared_id_failure_precedes_handle() {let mut ctx = crate::testing::TestContext::from_conn(CdpConnection::new());- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};- let create_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let create_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: context.clone(),url: "about:blank".to_owned(),browser_context_id: None,@@ -185,19 +187,19 @@ async fn devtools_call_function_node_shared_id_failure_precedes_handle() {}),).await;- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");};- let target_context = DevToolsCommandContext {+ let target_context = AutomationContext {target_id: Some(create_result.target_id),..context};- let navigate_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let navigate_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::Navigate(DevToolsNavigateCommand {+ AutomationCommand::Navigate(DevToolsNavigateCommand {context: target_context.clone(),url: "data:text/html,<img id='target'>".to_owned(),referrer: None,@@ -207,9 +209,9 @@ async fn devtools_call_function_node_shared_id_failure_precedes_handle() {.await;navigate_result.expect("navigate should succeed");- let evaluate_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let evaluate_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::EvaluateScript(DevToolsEvaluateScriptCommand {+ AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {context: target_context.clone(),realm_id: None,world_name: None,@@ -224,7 +226,7 @@ async fn devtools_call_function_node_shared_id_failure_precedes_handle() {}),).await;- let DevToolsCommandResult::Script(evaluate_result) =+ let AutomationResult::Script(evaluate_result) =evaluate_result.expect("node evaluate should succeed")else {panic!("expected script result");@@ -238,9 +240,9 @@ async fn devtools_call_function_node_shared_id_failure_precedes_handle() {"node remote value should expose sharedId");- let call_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let call_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: target_context,realm_id: None,world_name: None,@@ -301,9 +303,9 @@ async fn bidi_node_remote_value_registers_renderer_shared_node_binding() {async fn bidi_node_remote_value_reuses_renderer_frontend_node_id() {let mut ctx = crate::testing::TestContext::from_conn(CdpConnection::new());let context = bidi_fetch_command_context();- let create_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let create_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: context.clone(),url: "about:blank".to_owned(),browser_context_id: None,@@ -311,20 +313,20 @@ async fn bidi_node_remote_value_reuses_renderer_frontend_node_id() {}),).await;- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");};let target_id = create_result.target_id.as_str().to_owned();- let target_context = DevToolsCommandContext {+ let target_context = AutomationContext {target_id: Some(create_result.target_id),..context};- let navigate_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let navigate_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::Navigate(DevToolsNavigateCommand {+ AutomationCommand::Navigate(DevToolsNavigateCommand {context: target_context.clone(),url: "data:text/html,<main id='target'>target</main>".to_owned(),referrer: None,@@ -332,8 +334,7 @@ async fn bidi_node_remote_value_reuses_renderer_frontend_node_id() {}),).await;- let DevToolsCommandResult::Navigate(navigation) =- navigate_result.expect("navigate should succeed")+ let AutomationResult::Navigate(navigation) = navigate_result.expect("navigate should succeed")else {panic!("expected navigate result");};@@ -347,9 +348,9 @@ async fn bidi_node_remote_value_reuses_renderer_frontend_node_id() {.expect("WebDriver BiDi navigation id should encode the loader id");crate::testing::wait_until_renderer_document_load(&mut ctx, None, &target_id, loader_id).await;- let query_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let query_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::QuerySelector(DevToolsQuerySelectorCommand {+ AutomationCommand::QuerySelector(DevToolsQuerySelectorCommand {context: target_context.clone(),root: None,selector: "#target".to_owned(),@@ -357,16 +358,16 @@ async fn bidi_node_remote_value_reuses_renderer_frontend_node_id() {}),).await;- let DevToolsCommandResult::QuerySelector(query_result) =+ let AutomationResult::QuerySelector(query_result) =query_result.expect("query selector should succeed")else {panic!("expected query selector result");};let frontend_node_id = query_result.node_ids[0];- let evaluate_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let evaluate_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::EvaluateScript(DevToolsEvaluateScriptCommand {+ AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {context: target_context,realm_id: None,world_name: None,@@ -411,8 +412,8 @@ async fn bidi_node_remote_value_registers_child_shared_node_bindings() {.await;let evaluate_result = ctx- .execute_devtools_command_through_renderer_fence_for_test(DevToolsCommand::EvaluateScript(- DevToolsEvaluateScriptCommand {+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {context: target_context.clone(),realm_id: None,world_name: None,@@ -428,8 +429,8 @@ async fn bidi_node_remote_value_registers_child_shared_node_bindings() {max_dom_depth: Some(1),include_shadow_tree: None,}),- },- ))+ }),+ ).await;let remote_value = expect_script_value_result(evaluate_result.expect("node evaluate should succeed"),@@ -461,8 +462,8 @@ async fn bidi_node_remote_value_registers_child_shared_node_bindings() {);let call_result = ctx- .execute_devtools_command_through_renderer_fence_for_test(DevToolsCommand::CallFunction(- DevToolsCallFunctionCommand {+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: target_context,realm_id: None,world_name: None,@@ -481,8 +482,8 @@ async fn bidi_node_remote_value_registers_child_shared_node_bindings() {preserve_remote_metadata: false,materialize_bidi_script_result: false,serialization_options: None,- },- ))+ }),+ ).await;let remote_value = expect_script_value_result(call_result.expect("callFunction should resolve child sharedId via renderer binding"),@@ -498,7 +499,7 @@ async fn set_file_input_files_shared_id_uses_renderer_binding_without_protocol_rmaterialize_bidi_target_input_node_for_test(&mut ctx, "<input id='target' type='file'>").await;let fake_shared_id =- crate::devtools_runtime::webdriver_bidi_node_shared_id_for_backend_node_id(backend_node_id);+ crate::automation::webdriver_bidi_node_shared_id_for_backend_node_id(backend_node_id);let owner = CommandOwnerScope::capture(&ctx.conn, None);ctx.conn.register_document_bidi_node_binding_for_owner_async(@@ -511,8 +512,8 @@ async fn set_file_input_files_shared_id_uses_renderer_binding_without_protocol_rlet upload_bytes = b"from renderer registry";let set_result = ctx- .execute_devtools_command_through_renderer_fence_for_test(- DevToolsCommand::SetFileInputFiles(DevToolsSetFileInputFilesCommand {+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::SetFileInputFiles(DevToolsSetFileInputFilesCommand {context: target_context.clone(),object_id: fake_shared_id,files: vec![moli_core::page::SelectedFile {@@ -528,7 +529,7 @@ async fn set_file_input_files_shared_id_uses_renderer_binding_without_protocol_rset_result.expect("setFileInputFiles should use renderer shared-node binding");let evaluate_result = ctx- .execute_devtools_command_through_renderer_fence_for_test(DevToolsCommand::EvaluateScript(+ .execute_automation_command_through_renderer_fence_for_test(AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {context: target_context,realm_id: None,@@ -564,7 +565,7 @@ async fn locate_nodes_start_node_shared_id_uses_renderer_binding_without_protoco).await;let fake_shared_id =- crate::devtools_runtime::webdriver_bidi_node_shared_id_for_backend_node_id(backend_node_id);+ crate::automation::webdriver_bidi_node_shared_id_for_backend_node_id(backend_node_id);let owner = CommandOwnerScope::capture(&ctx.conn, None);ctx.conn.register_document_bidi_node_binding_for_owner_async(@@ -576,7 +577,7 @@ async fn locate_nodes_start_node_shared_id_uses_renderer_binding_without_protoco.expect("renderer fake shared-node binding registration should run");let locate_result = ctx- .execute_devtools_command_through_renderer_fence_for_test(DevToolsCommand::LocateNodes(+ .execute_automation_command_through_renderer_fence_for_test(AutomationCommand::LocateNodes(DevToolsLocateNodesCommand {context: target_context,locator: DevToolsLocateNodesLocator::Css("a".to_owned()),@@ -590,7 +591,7 @@ async fn locate_nodes_start_node_shared_id_uses_renderer_binding_without_protoco},)).await;- let DevToolsCommandResult::LocateNodes(locate_result) =+ let AutomationResult::LocateNodes(locate_result) =locate_result.expect("locateNodes should use renderer shared-node binding")else {panic!("expected locateNodes result");@@ -613,7 +614,7 @@ async fn call_function_shared_id_uses_renderer_binding_without_protocol_registry).await;let fake_shared_id =- crate::devtools_runtime::webdriver_bidi_node_shared_id_for_backend_node_id(backend_node_id);+ crate::automation::webdriver_bidi_node_shared_id_for_backend_node_id(backend_node_id);let owner = CommandOwnerScope::capture(&ctx.conn, None);ctx.conn.register_document_bidi_node_binding_for_owner_async(@@ -625,8 +626,8 @@ async fn call_function_shared_id_uses_renderer_binding_without_protocol_registry.expect("renderer fake shared-node binding registration should run");let call_result = ctx- .execute_devtools_command_through_renderer_fence_for_test(DevToolsCommand::CallFunction(- DevToolsCallFunctionCommand {+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: target_context,realm_id: None,world_name: None,@@ -646,8 +647,8 @@ async fn call_function_shared_id_uses_renderer_binding_without_protocol_registrypreserve_remote_metadata: false,materialize_bidi_script_result: false,serialization_options: None,- },- ))+ }),+ ).await;let remote_value = expect_script_value_result(call_result.expect("callFunction should use renderer shared-node binding"),diff --git a/moli-protocol/src/conn/dispatch_tests/browser_context.rs b/moli-protocol/src/conn/dispatch_tests/browser_context.rsindex faeb1cb7d..df6af3a4e 100644--- a/moli-protocol/src/conn/dispatch_tests/browser_context.rs+++ b/moli-protocol/src/conn/dispatch_tests/browser_context.rs@@ -15,15 +15,15 @@ async fn devtools_browser_context_create_uses_ephemeral_storage_partition() {&initial_storage_owner,);let mut conn = CdpConnection::new_with_initial_storage_partition(initial_storage_partition);- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (create_result, create_events) = conn- .execute_devtools_command(DevToolsCommand::CreateBrowserContext(+ .execute_automation_command(AutomationCommand::CreateBrowserContext(DevToolsCreateBrowserContextCommand {context,browser_context_id: None,@@ -39,7 +39,7 @@ async fn devtools_browser_context_create_uses_ephemeral_storage_partition() {.into_parts();assert!(create_events.is_empty());- let DevToolsCommandResult::CreateBrowserContext(create_result) =+ let AutomationResult::CreateBrowserContext(create_result) =create_result.expect("create browser context should succeed")else {panic!("expected create browser context result");@@ -67,15 +67,15 @@ async fn devtools_browser_context_create_rejects_persistent_partition_id() {("tenant/a", "InvalidPersistentBrowserContextId"),] {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (create_result, create_events) = conn- .execute_devtools_command(DevToolsCommand::CreateBrowserContext(+ .execute_automation_command(AutomationCommand::CreateBrowserContext(DevToolsCreateBrowserContextCommand {context,browser_context_id: None,@@ -104,15 +104,15 @@ async fn devtools_browser_context_create_rejects_persistent_partition_id() {#[tokio::test]async fn devtools_browser_context_commands_create_list_and_remove_user_context() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (create_result, create_events) = conn- .execute_devtools_command(DevToolsCommand::CreateBrowserContext(+ .execute_automation_command(AutomationCommand::CreateBrowserContext(DevToolsCreateBrowserContextCommand {context: context.clone(),browser_context_id: None,@@ -127,7 +127,7 @@ async fn devtools_browser_context_commands_create_list_and_remove_user_context().await.into_parts();assert!(create_events.is_empty());- let DevToolsCommandResult::CreateBrowserContext(create_result) =+ let AutomationResult::CreateBrowserContext(create_result) =create_result.expect("create browser context should succeed")else {panic!("expected create browser context result");@@ -152,14 +152,14 @@ async fn devtools_browser_context_commands_create_list_and_remove_user_context()assert_eq!(created_context.proxy_socks_version, None);let (get_contexts_result, _) = conn- .execute_devtools_command(DevToolsCommand::GetBrowserContexts(+ .execute_automation_command(AutomationCommand::GetBrowserContexts(DevToolsGetBrowserContextsCommand {context: context.clone(),},)).await.into_parts();- let DevToolsCommandResult::GetBrowserContexts(get_contexts_result) =+ let AutomationResult::GetBrowserContexts(get_contexts_result) =get_contexts_result.expect("get browser contexts should succeed")else {panic!("expected get browser contexts result");@@ -172,22 +172,24 @@ async fn devtools_browser_context_commands_create_list_and_remove_user_context());let (create_target_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: Some(create_result.browser_context_id.clone()),- activate: true,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: Some(create_result.browser_context_id.clone()),+ activate: true,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(create_target_result) =+ let AutomationResult::CreateTarget(create_target_result) =create_target_result.expect("create target in user context should succeed")else {panic!("expected create target result");};let (remove_result, _, remove_events) = conn- .execute_devtools_command_with_protocol_events(DevToolsCommand::RemoveBrowserContext(+ .execute_automation_command_with_protocol_events(AutomationCommand::RemoveBrowserContext(DevToolsRemoveBrowserContextCommand {context,browser_context_id: create_result.browser_context_id,@@ -197,7 +199,7 @@ async fn devtools_browser_context_commands_create_list_and_remove_user_context().into_parts_with_protocol_events();assert_eq!(remove_result.expect("remove browser context should succeed"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);assert!(!conn.has_browser_context_id("user-context-1"));assert!(@@ -232,15 +234,15 @@ async fn devtools_browser_context_commands_create_list_and_remove_user_context()#[tokio::test]async fn devtools_browser_context_create_preserves_proxy_autoconfig_and_socks_metadata() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (create_result, create_events) = conn- .execute_devtools_command(DevToolsCommand::CreateBrowserContext(+ .execute_automation_command(AutomationCommand::CreateBrowserContext(DevToolsCreateBrowserContextCommand {context,browser_context_id: None,@@ -255,7 +257,7 @@ async fn devtools_browser_context_create_preserves_proxy_autoconfig_and_socks_me.await.into_parts();assert!(create_events.is_empty());- let DevToolsCommandResult::CreateBrowserContext(create_result) =+ let AutomationResult::CreateBrowserContext(create_result) =create_result.expect("create browser context should succeed")else {panic!("expected create browser context result");@@ -277,14 +279,14 @@ async fn devtools_browser_context_create_preserves_proxy_autoconfig_and_socks_me#[tokio::test]async fn devtools_remove_browser_context_rejects_unknown_user_context() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (remove_result, _, remove_events) = conn- .execute_devtools_command_with_protocol_events(DevToolsCommand::RemoveBrowserContext(+ .execute_automation_command_with_protocol_events(AutomationCommand::RemoveBrowserContext(DevToolsRemoveBrowserContextCommand {context,browser_context_id: DevToolsBrowserContextId::from("missing-user-context"),@@ -306,20 +308,22 @@ async fn devtools_create_target_explicit_default_browser_context_materializes_deconn.insert_browser_context(user_context);let (create_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,- session_id: Some(DevToolsSessionId::from("bidi-session-1")),- target_id: None,+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,+ session_id: Some(DevToolsSessionId::from("bidi-session-1")),+ target_id: None,+ browser_context_id: Some(DevToolsBrowserContextId::from("BID-default")),+ },+ url: "about:blank".to_owned(),browser_context_id: Some(DevToolsBrowserContextId::from("BID-default")),+ activate: true,},- url: "about:blank".to_owned(),- browser_context_id: Some(DevToolsBrowserContextId::from("BID-default")),- activate: true,- }))+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target in explicit default context should succeed")else {panic!("expected create target result");@@ -354,21 +358,23 @@ async fn devtools_create_target_uses_reference_target_browser_context_when_unspeconn.insert_browser_context(reference_context);let (create_result, create_events) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,- session_id: Some(DevToolsSessionId::from("bidi-session-1")),- target_id: Some(DevToolsTargetId::from("TID-reference")),+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,+ session_id: Some(DevToolsSessionId::from("bidi-session-1")),+ target_id: Some(DevToolsTargetId::from("TID-reference")),+ browser_context_id: None,+ },+ url: "about:blank".to_owned(),browser_context_id: None,+ activate: true,},- url: "about:blank".to_owned(),- browser_context_id: None,- activate: true,- }))+ )).await.into_parts();assert!(create_events.is_empty());- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target from reference context should succeed")else {panic!("expected create target result");@@ -412,21 +418,23 @@ async fn devtools_create_target_explicit_browser_context_overrides_reference_tarconn.insert_browser_context(explicit_context);let (create_result, create_events) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,- session_id: Some(DevToolsSessionId::from("bidi-session-1")),- target_id: Some(DevToolsTargetId::from("TID-reference")),+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,+ session_id: Some(DevToolsSessionId::from("bidi-session-1")),+ target_id: Some(DevToolsTargetId::from("TID-reference")),+ browser_context_id: Some(DevToolsBrowserContextId::from("BID-explicit")),+ },+ url: "about:blank".to_owned(),browser_context_id: Some(DevToolsBrowserContextId::from("BID-explicit")),+ activate: true,},- url: "about:blank".to_owned(),- browser_context_id: Some(DevToolsBrowserContextId::from("BID-explicit")),- activate: true,- }))+ )).await.into_parts();assert!(create_events.is_empty());- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("explicit browser context target creation should succeed")else {panic!("expected create target result");@@ -459,21 +467,21 @@ async fn devtools_create_target_explicit_browser_context_overrides_reference_tar}#[tokio::test]-async fn devtools_command_preserves_remove_browser_context_detached_typed_sidecar() {+async fn automation_command_preserves_remove_browser_context_detached_typed_sidecar() {let mut conn = CdpConnection::new();let mut browser_context = BrowserContext::new("user-context-detach-sidecar".to_owned());browser_context.set_active_target_id("TID-dispose-sidecar".to_owned());browser_context.attach_active_session("SID-dispose-sidecar".to_owned());conn.insert_browser_context(browser_context);- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (result, scheduler_events, protocol_events) = conn- .execute_devtools_command_with_protocol_events(DevToolsCommand::RemoveBrowserContext(+ .execute_automation_command_with_protocol_events(AutomationCommand::RemoveBrowserContext(DevToolsRemoveBrowserContextCommand {context,browser_context_id: DevToolsBrowserContextId::from("user-context-detach-sidecar"),@@ -485,7 +493,7 @@ async fn devtools_command_preserves_remove_browser_context_detached_typed_sidecaassert!(scheduler_events.is_empty());assert_eq!(result.expect("remove browser context should succeed"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);let mut saw_detached = false;for event in protocol_events {@@ -508,18 +516,18 @@ async fn devtools_command_preserves_remove_browser_context_detached_typed_sideca}#[tokio::test]-async fn devtools_command_rejects_missing_user_context_viewport_override() {+async fn automation_command_rejects_missing_user_context_viewport_override() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (viewport_result, _) = conn- .execute_devtools_command(DevToolsCommand::SetViewport(DevToolsSetViewportCommand {+ .execute_automation_command(AutomationCommand::SetViewport(DevToolsSetViewportCommand {context: context.clone(),- browser_context_ids: vec![crate::devtools_runtime::DevToolsBrowserContextId::from(+ browser_context_ids: vec![crate::automation::DevToolsBrowserContextId::from("custom-user-context",)],viewport: DevToolsViewportSetting::Dimensions {@@ -539,20 +547,20 @@ async fn devtools_command_rejects_missing_user_context_viewport_override() {}#[tokio::test]-async fn devtools_command_applies_known_user_context_viewport_default() {+async fn automation_command_applies_known_user_context_viewport_default() {let mut conn = CdpConnection::new();let browser_context = conn.new_browser_context("custom-user-context".to_owned());conn.insert_browser_context(browser_context);- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (viewport_result, _) = conn- .execute_devtools_command(DevToolsCommand::SetViewport(DevToolsSetViewportCommand {+ .execute_automation_command(AutomationCommand::SetViewport(DevToolsSetViewportCommand {context: context.clone(),- browser_context_ids: vec![crate::devtools_runtime::DevToolsBrowserContextId::from(+ browser_context_ids: vec![crate::automation::DevToolsBrowserContextId::from("custom-user-context",)],viewport: DevToolsViewportSetting::Dimensions {@@ -568,7 +576,7 @@ async fn devtools_command_applies_known_user_context_viewport_default() {assert_eq!(viewport_result.expect("known userContext setViewport should succeed"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);let browser_context = conn.browser_context_by_id("custom-user-context")@@ -586,15 +594,17 @@ async fn devtools_command_applies_known_user_context_viewport_default() {assert_eq!(default_metrics.device_scale_factor, 2.0);let (create_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: Some(DevToolsBrowserContextId::from("custom-user-context")),- activate: true,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: Some(DevToolsBrowserContextId::from("custom-user-context")),+ activate: true,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target in userContext should succeed")else {panic!("expected create target result");@@ -627,24 +637,24 @@ async fn devtools_storage_cookie_commands_scope_to_target_browser_context() {conn.install_browser_context_fixture_for_test(default_context);conn.push_inactive_browser_context_fixture_for_test(custom_context);- let base_context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let base_context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};- let default_target_context = DevToolsCommandContext {+ let default_target_context = AutomationContext {target_id: Some(DevToolsTargetId::from("TID-default")),..base_context.clone()};- let custom_target_context = DevToolsCommandContext {+ let custom_target_context = AutomationContext {target_id: Some(DevToolsTargetId::from("TID-custom")),..base_context};let cookie_url = "https://example.com/path".to_owned();let (set_result, _) = conn- .execute_devtools_command(DevToolsCommand::SetCookies(DevToolsSetCookiesCommand {+ .execute_automation_command(AutomationCommand::SetCookies(DevToolsSetCookiesCommand {context: custom_target_context.clone(),browser_context_id: None,cookies: vec![DevToolsCookieParam {@@ -666,7 +676,7 @@ async fn devtools_storage_cookie_commands_scope_to_target_browser_context() {})).await.into_parts();- let DevToolsCommandResult::SetCookies(set_result) =+ let AutomationResult::SetCookies(set_result) =set_result.expect("custom target setCookies should succeed")else {panic!("expected set cookies result");@@ -674,7 +684,7 @@ async fn devtools_storage_cookie_commands_scope_to_target_browser_context() {assert!(set_result.success);let (custom_get, _) = conn- .execute_devtools_command(DevToolsCommand::GetCookies(DevToolsGetCookiesCommand {+ .execute_automation_command(AutomationCommand::GetCookies(DevToolsGetCookiesCommand {context: custom_target_context,browser_context_id: None,urls: Some(vec![cookie_url.clone()]),@@ -682,7 +692,7 @@ async fn devtools_storage_cookie_commands_scope_to_target_browser_context() {})).await.into_parts();- let DevToolsCommandResult::GetCookies(custom_get) =+ let AutomationResult::GetCookies(custom_get) =custom_get.expect("custom target getCookies should succeed")else {panic!("expected get cookies result");@@ -692,7 +702,7 @@ async fn devtools_storage_cookie_commands_scope_to_target_browser_context() {assert_eq!(custom_get.cookies[0]["value"], json!("custom"));let (default_get, _) = conn- .execute_devtools_command(DevToolsCommand::GetCookies(DevToolsGetCookiesCommand {+ .execute_automation_command(AutomationCommand::GetCookies(DevToolsGetCookiesCommand {context: default_target_context,browser_context_id: None,urls: Some(vec![cookie_url]),@@ -700,7 +710,7 @@ async fn devtools_storage_cookie_commands_scope_to_target_browser_context() {})).await.into_parts();- let DevToolsCommandResult::GetCookies(default_get) =+ let AutomationResult::GetCookies(default_get) =default_get.expect("default target getCookies should succeed")else {panic!("expected get cookies result");@@ -709,7 +719,7 @@ async fn devtools_storage_cookie_commands_scope_to_target_browser_context() {}#[tokio::test]-async fn devtools_command_executes_user_context_preload_without_default_leakage() {+async fn automation_command_executes_user_context_preload_without_default_leakage() {let mut ctx = crate::testing::TestContext::new();let default_context_id = ctx.conn.default_browser_context_id().to_owned();let default_browser_context = ctx.conn.new_browser_context(default_context_id.clone());@@ -722,16 +732,16 @@ async fn devtools_command_executes_user_context_preload_without_default_leakage(.conn.new_browser_context("second-user-context".to_owned());ctx.conn.insert_browser_context(second_browser_context);- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};- let add_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let add_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::AddPreloadScript(DevToolsAddPreloadScriptCommand {+ AutomationCommand::AddPreloadScript(DevToolsAddPreloadScriptCommand {context: context.clone(),source: DevToolsPreloadScriptSource::FunctionDeclaration {function_declaration: "() => { globalThis.__bidiUserContextPreload = 'custom'; }"@@ -749,7 +759,7 @@ async fn devtools_command_executes_user_context_preload_without_default_leakage(}),).await;- let DevToolsCommandResult::AddPreloadScript(add_result) =+ let AutomationResult::AddPreloadScript(add_result) =add_result.expect("userContext addPreloadScript should succeed")else {panic!("expected add preload script result");@@ -781,13 +791,13 @@ async fn devtools_command_executes_user_context_preload_without_default_leakage(.any(|script| script.source.contains("__bidiUserContextPreload")),"custom userContext target navigation inputs should retain its context preload script");- let custom_context = DevToolsCommandContext {+ let custom_context = AutomationContext {target_id: Some(custom_target.clone()),..context.clone()};- execute_direct_devtools_command_through_renderer_fence_for_test(+ execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::Navigate(DevToolsNavigateCommand {+ AutomationCommand::Navigate(DevToolsNavigateCommand {context: custom_context.clone(),url: "data:text/html,user-context-preload".to_owned(),referrer: None,@@ -820,13 +830,13 @@ async fn devtools_command_executes_user_context_preload_without_default_leakage("second userContext target",).await;- let second_context = DevToolsCommandContext {+ let second_context = AutomationContext {target_id: Some(second_target.clone()),..context.clone()};- execute_direct_devtools_command_through_renderer_fence_for_test(+ execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::Navigate(DevToolsNavigateCommand {+ AutomationCommand::Navigate(DevToolsNavigateCommand {context: second_context.clone(),url: "data:text/html,second-user-context-preload".to_owned(),referrer: None,@@ -851,13 +861,13 @@ async fn devtools_command_executes_user_context_preload_without_default_leakage("default userContext target",).await;- let default_context = DevToolsCommandContext {+ let default_context = AutomationContext {target_id: Some(default_target),..context.clone()};- execute_direct_devtools_command_through_renderer_fence_for_test(+ execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::Navigate(DevToolsNavigateCommand {+ AutomationCommand::Navigate(DevToolsNavigateCommand {context: default_context.clone(),url: "data:text/html,default-context-preload".to_owned(),referrer: None,@@ -875,9 +885,9 @@ async fn devtools_command_executes_user_context_preload_without_default_leakage(.await;assert_eq!(default_value, "undefined");- let remove_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let remove_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::RemovePreloadScript(DevToolsRemovePreloadScriptCommand {+ AutomationCommand::RemovePreloadScript(DevToolsRemovePreloadScriptCommand {context,script_id: script_id.clone(),}),@@ -885,7 +895,7 @@ async fn devtools_command_executes_user_context_preload_without_default_leakage(.await;assert_eq!(remove_result.expect("userContext removePreloadScript should succeed"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);for browser_context_id in ["custom-user-context", "second-user-context"] {assert!(diff --git a/moli-protocol/src/conn/dispatch_tests/commands.rs b/moli-protocol/src/conn/dispatch_tests/commands.rsindex 810b744fb..fc7ab27da 100644--- a/moli-protocol/src/conn/dispatch_tests/commands.rs+++ b/moli-protocol/src/conn/dispatch_tests/commands.rs@@ -3,8 +3,8 @@ use super::*;#[tokio::test]async fn protocol_neutral_await_promise_keeps_background_owner_route_across_pending_completion() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-owner-route")),target_id: None,browser_context_id: None,@@ -13,14 +13,14 @@ async fn protocol_neutral_await_promise_keeps_background_owner_route_across_pendlet (first_result, _) =crate::domains::target::execute_immediate_devtools_target_command_with_protocol_events(&mut conn,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: context.clone(),url: "about:blank".to_owned(),browser_context_id: None,activate: false,}),);- let DevToolsCommandResult::CreateTarget(first_result) =+ let AutomationResult::CreateTarget(first_result) =first_result.expect("initial target create should succeed")else {panic!("expected create target result");@@ -29,15 +29,17 @@ async fn protocol_neutral_await_promise_keeps_background_owner_route_across_pendensure_initial_document_for_target_id_for_test(&mut conn, &first_target_id).await;let (second_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(second_result) =+ let AutomationResult::CreateTarget(second_result) =second_result.expect("background target create should succeed")else {panic!("expected create target result");@@ -45,11 +47,11 @@ async fn protocol_neutral_await_promise_keeps_background_owner_route_across_pendlet second_target_id = second_result.target_id;ensure_initial_document_for_target_id_for_test(&mut conn, &second_target_id).await;- let first_context = DevToolsCommandContext {+ let first_context = AutomationContext {target_id: Some(first_target_id.clone()),..context.clone()};- let second_context = DevToolsCommandContext {+ let second_context = AutomationContext {target_id: Some(second_target_id.clone()),..context.clone()};@@ -71,7 +73,7 @@ async fn protocol_neutral_await_promise_keeps_background_owner_route_across_pendassert_eq!(second_owner, "background");let step = conn- .start_devtools_runtime_command_dispatch(DevToolsCommand::EvaluateScript(+ .start_devtools_runtime_command_dispatch(AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {context: second_context,realm_id: None,@@ -165,35 +167,37 @@ async fn protocol_neutral_await_promise_keeps_background_owner_route_across_pend}#[tokio::test]-async fn devtools_command_executes_preload_without_cdp_response_sidecar() {+async fn automation_command_executes_preload_without_cdp_response_sidecar() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (create_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");};- let target_context = DevToolsCommandContext {+ let target_context = AutomationContext {target_id: Some(create_result.target_id.clone()),..context.clone()};let (add_result, _scheduler_events, add_protocol_events) = conn- .execute_devtools_command_with_protocol_events(DevToolsCommand::AddPreloadScript(+ .execute_automation_command_with_protocol_events(AutomationCommand::AddPreloadScript(DevToolsAddPreloadScriptCommand {context: target_context,source: DevToolsPreloadScriptSource::FunctionDeclaration {@@ -209,7 +213,7 @@ async fn devtools_command_executes_preload_without_cdp_response_sidecar() {)).await.into_parts_with_protocol_events();- let DevToolsCommandResult::AddPreloadScript(add_result) =+ let AutomationResult::AddPreloadScript(add_result) =add_result.expect("addPreloadScript should succeed")else {panic!("expected add preload script result");@@ -229,7 +233,7 @@ async fn devtools_command_executes_preload_without_cdp_response_sidecar() {);let (remove_result, _scheduler_events, remove_protocol_events) = conn- .execute_devtools_command_with_protocol_events(DevToolsCommand::RemovePreloadScript(+ .execute_automation_command_with_protocol_events(AutomationCommand::RemovePreloadScript(DevToolsRemovePreloadScriptCommand {context,script_id: add_result.script_id,@@ -239,7 +243,7 @@ async fn devtools_command_executes_preload_without_cdp_response_sidecar() {.into_parts_with_protocol_events();assert_eq!(remove_result.expect("removePreloadScript should succeed"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);assert!(remove_protocol_events@@ -250,17 +254,17 @@ async fn devtools_command_executes_preload_without_cdp_response_sidecar() {}#[tokio::test]-async fn devtools_command_reports_invalid_preload_without_cdp_response_parser() {+async fn automation_command_reports_invalid_preload_without_cdp_response_parser() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (add_result, _scheduler_events, protocol_events) = conn- .execute_devtools_command_with_protocol_events(DevToolsCommand::AddPreloadScript(+ .execute_automation_command_with_protocol_events(AutomationCommand::AddPreloadScript(DevToolsAddPreloadScriptCommand {context,source: DevToolsPreloadScriptSource::FunctionDeclaration {@@ -288,36 +292,38 @@ async fn devtools_command_reports_invalid_preload_without_cdp_response_parser()}#[tokio::test]-async fn devtools_command_applies_window_state_to_document_surface() {+async fn automation_command_applies_window_state_to_document_surface() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (create_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");};let target_id = create_result.target_id.clone();- let target_context = DevToolsCommandContext {+ let target_context = AutomationContext {target_id: Some(target_id),..context};let (minimize_result, _) = conn- .execute_devtools_command(DevToolsCommand::SetWindowState(+ .execute_automation_command(AutomationCommand::SetWindowState(DevToolsSetWindowStateCommand {context: target_context.clone(),state: DevToolsWindowState::Minimized,@@ -327,7 +333,7 @@ async fn devtools_command_applies_window_state_to_document_surface() {.into_parts();assert_eq!(minimize_result.expect("minimize surface state should succeed"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);assert!(conn.browser_context@@ -350,7 +356,7 @@ async fn devtools_command_applies_window_state_to_document_surface() {);let (fullscreen_result, _) = conn- .execute_devtools_command(DevToolsCommand::SetWindowState(+ .execute_automation_command(AutomationCommand::SetWindowState(DevToolsSetWindowStateCommand {context: target_context.clone(),state: DevToolsWindowState::Fullscreen,@@ -360,7 +366,7 @@ async fn devtools_command_applies_window_state_to_document_surface() {.into_parts();assert_eq!(fullscreen_result.expect("fullscreen surface state should succeed"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);assert_eq!(conn.browser_context@@ -384,7 +390,7 @@ async fn devtools_command_applies_window_state_to_document_surface() {);let (normal_result, _) = conn- .execute_devtools_command(DevToolsCommand::SetWindowState(+ .execute_automation_command(AutomationCommand::SetWindowState(DevToolsSetWindowStateCommand {context: target_context.clone(),state: DevToolsWindowState::Normal,@@ -394,7 +400,7 @@ async fn devtools_command_applies_window_state_to_document_surface() {.into_parts();assert_eq!(normal_result.expect("normal surface state should succeed"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);assert_eq!(evaluate_document_surface_payload(&mut conn, target_context).await,@@ -409,24 +415,26 @@ async fn devtools_command_applies_window_state_to_document_surface() {}#[tokio::test]-async fn devtools_command_executes_dom_outer_html_for_document_source() {+async fn automation_command_executes_dom_outer_html_for_document_source() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from("classic-session-1")),target_id: None,browser_context_id: None,};let (create_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");@@ -434,8 +442,8 @@ async fn devtools_command_executes_dom_outer_html_for_document_source() {let target_id = create_result.target_id.clone();let url = "data:text/html,<title>DOMSource</title><main>source-owner</main>".to_owned();let _ = conn- .execute_devtools_command(DevToolsCommand::Navigate(DevToolsNavigateCommand {- context: DevToolsCommandContext {+ .execute_automation_command(AutomationCommand::Navigate(DevToolsNavigateCommand {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -446,17 +454,19 @@ async fn devtools_command_executes_dom_outer_html_for_document_source() {.await;let (source_result, _) = conn- .execute_devtools_command(DevToolsCommand::GetOuterHtml(DevToolsGetOuterHtmlCommand {- context: DevToolsCommandContext {- target_id: Some(target_id),- ..context+ .execute_automation_command(AutomationCommand::GetOuterHtml(+ DevToolsGetOuterHtmlCommand {+ context: AutomationContext {+ target_id: Some(target_id),+ ..context+ },+ reference: None,+ include_shadow_dom: false,},- reference: None,- include_shadow_dom: false,- }))+ )).await.into_parts();- let DevToolsCommandResult::GetOuterHtml(source_result) =+ let AutomationResult::GetOuterHtml(source_result) =source_result.expect("get outer html should succeed")else {panic!("expected get outer html result");@@ -470,35 +480,37 @@ async fn devtools_command_executes_dom_outer_html_for_document_source() {}#[tokio::test]-async fn devtools_command_executes_dom_query_selector_for_document_root() {+async fn automation_command_executes_dom_query_selector_for_document_root() {let mut ctx = crate::testing::TestContext::from_conn(CdpConnection::new());- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from("classic-session-1")),target_id: None,browser_context_id: None,};let (create_result, _) = ctx.conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");};let target_id = create_result.target_id.clone();let url = "data:text/html,<main id='target'>target</main><section id='root'><a id='child-link' href='child.html'>Child Link</a></section><a id='top-link' href='top.html'>Top Link</a><input id='field' value='initial'><script>document.getElementById('field').value='changed'</script><p class='item'></p><p class='item'></p>".to_owned();- let navigation = execute_direct_devtools_command_through_renderer_fence_for_test(+ let navigation = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::Navigate(DevToolsNavigateCommand {- context: DevToolsCommandContext {+ AutomationCommand::Navigate(DevToolsNavigateCommand {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -508,7 +520,7 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {}),).await;- let DevToolsCommandResult::Navigate(navigation) = navigation.expect("navigate should succeed")+ let AutomationResult::Navigate(navigation) = navigation.expect("navigate should succeed")else {panic!("expected navigate result");};@@ -523,9 +535,9 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {let conn = &mut ctx.conn;let (single_result, _) = conn- .execute_devtools_command(DevToolsCommand::QuerySelector(+ .execute_automation_command(AutomationCommand::QuerySelector(DevToolsQuerySelectorCommand {- context: DevToolsCommandContext {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -536,7 +548,7 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {)).await.into_parts();- let DevToolsCommandResult::QuerySelector(single_result) =+ let AutomationResult::QuerySelector(single_result) =single_result.expect("query selector should succeed")else {panic!("expected query selector result");@@ -546,9 +558,9 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {let target_node_id = single_result.node_ids[0];let (attributes_result, _) = conn- .execute_devtools_command(DevToolsCommand::GetAttributes(+ .execute_automation_command(AutomationCommand::GetAttributes(DevToolsGetAttributesCommand {- context: DevToolsCommandContext {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -557,7 +569,7 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {)).await.into_parts();- let DevToolsCommandResult::GetAttributes(attributes_result) =+ let AutomationResult::GetAttributes(attributes_result) =attributes_result.expect("get attributes should succeed")else {panic!("expected get attributes result");@@ -570,8 +582,8 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {);let (text_result, _) = conn- .execute_devtools_command(DevToolsCommand::GetText(DevToolsGetTextCommand {- context: DevToolsCommandContext {+ .execute_automation_command(AutomationCommand::GetText(DevToolsGetTextCommand {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -579,15 +591,15 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {})).await.into_parts();- let DevToolsCommandResult::GetText(text_result) = text_result.expect("get text should succeed")+ let AutomationResult::GetText(text_result) = text_result.expect("get text should succeed")else {panic!("expected get text result");};assert_eq!(text_result.text, "target");let (property_result, _) = conn- .execute_devtools_command(DevToolsCommand::GetProperty(DevToolsGetPropertyCommand {- context: DevToolsCommandContext {+ .execute_automation_command(AutomationCommand::GetProperty(DevToolsGetPropertyCommand {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -596,7 +608,7 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {})).await.into_parts();- let DevToolsCommandResult::GetProperty(property_result) =+ let AutomationResult::GetProperty(property_result) =property_result.expect("get property should succeed")else {panic!("expected get property result");@@ -604,9 +616,9 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {assert_eq!(property_result.value, json!("target"));let (field_result, _) = conn- .execute_devtools_command(DevToolsCommand::QuerySelector(+ .execute_automation_command(AutomationCommand::QuerySelector(DevToolsQuerySelectorCommand {- context: DevToolsCommandContext {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -617,7 +629,7 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {)).await.into_parts();- let DevToolsCommandResult::QuerySelector(field_result) =+ let AutomationResult::QuerySelector(field_result) =field_result.expect("field query selector should succeed")else {panic!("expected field query selector result");@@ -625,8 +637,8 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {let field_node_id = field_result.node_ids[0];let (field_value_result, _) = conn- .execute_devtools_command(DevToolsCommand::GetProperty(DevToolsGetPropertyCommand {- context: DevToolsCommandContext {+ .execute_automation_command(AutomationCommand::GetProperty(DevToolsGetPropertyCommand {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -635,7 +647,7 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {})).await.into_parts();- let DevToolsCommandResult::GetProperty(field_value_result) =+ let AutomationResult::GetProperty(field_value_result) =field_value_result.expect("field value property should succeed")else {panic!("expected field value property result");@@ -643,9 +655,9 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {assert_eq!(field_value_result.value, json!("changed"));let (resolve_result, _, resolve_events) = conn- .execute_devtools_command_with_protocol_events(DevToolsCommand::ResolveNode(+ .execute_automation_command_with_protocol_events(AutomationCommand::ResolveNode(DevToolsResolveNodeCommand {- context: DevToolsCommandContext {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -662,7 +674,7 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {.all(|event| event.protocol_message().is_none()),"direct DOM.resolveNode must not route its command response as a protocol event");- let DevToolsCommandResult::ResolveNode(resolve_result) =+ let AutomationResult::ResolveNode(resolve_result) =resolve_result.expect("resolve node should succeed")else {panic!("expected resolve node result");@@ -674,9 +686,9 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {.to_owned();let (content_quads_result, _, content_quads_events) = conn- .execute_devtools_command_with_protocol_events(DevToolsCommand::DomGeometry(+ .execute_automation_command_with_protocol_events(AutomationCommand::DomGeometry(DevToolsDomGeometryCommand {- context: DevToolsCommandContext {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -692,7 +704,7 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {.all(|event| event.protocol_message().is_none()),"direct DOM.getContentQuads must not route its command response as a protocol event");- let DevToolsCommandResult::DomGeometry(content_quads_result) =+ let AutomationResult::DomGeometry(content_quads_result) =content_quads_result.expect("DOM content quads should succeed")else {panic!("expected DOM geometry result");@@ -702,15 +714,14 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {assert!(content_quads_result.height.is_none());let (object_geometry_result, _, object_geometry_events) = conn- .execute_devtools_command_with_protocol_events(DevToolsCommand::DomObjectReference(- crate::devtools_runtime::DevToolsDomObjectReferenceCommand {- context: DevToolsCommandContext {+ .execute_automation_command_with_protocol_events(AutomationCommand::DomObjectReference(+ crate::automation::DevToolsDomObjectReferenceCommand {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},object_id: DevToolsRemoteHandleId::from(resolved_object_id.clone()),- operation:- crate::devtools_runtime::DevToolsDomObjectReferenceOperation::GetBoxModel,+ operation: crate::automation::DevToolsDomObjectReferenceOperation::GetBoxModel,},)).await@@ -721,7 +732,7 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {.all(|event| event.protocol_message().is_none()),"direct object-reference DOM.getBoxModel must not route its command response as a protocol event");- let DevToolsCommandResult::DomGeometry(object_geometry_result) =+ let AutomationResult::DomGeometry(object_geometry_result) =object_geometry_result.expect("object-reference DOM geometry should succeed")else {panic!("expected DOM geometry result");@@ -737,9 +748,9 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {let _ = conn;let resolved_property_result = ctx- .execute_devtools_command_through_renderer_fence_for_test(DevToolsCommand::CallFunction(- DevToolsCallFunctionCommand {- context: DevToolsCommandContext {+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -757,8 +768,8 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {preserve_remote_metadata: false,materialize_bidi_script_result: false,serialization_options: None,- },- ))+ }),+ ).await;let resolved_property = expect_script_value_result(resolved_property_result.expect("resolved call function should succeed"),@@ -768,9 +779,9 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {let conn = &mut ctx.conn;let (scroll_result, _) = conn- .execute_devtools_command(DevToolsCommand::ScrollIntoViewIfNeeded(+ .execute_automation_command(AutomationCommand::ScrollIntoViewIfNeeded(DevToolsScrollIntoViewIfNeededCommand {- context: DevToolsCommandContext {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -782,12 +793,12 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {.into_parts();assert_eq!(scroll_result.expect("scroll into view should succeed"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);let (geometry_result, _) = conn- .execute_devtools_command(DevToolsCommand::DomGeometry(DevToolsDomGeometryCommand {- context: DevToolsCommandContext {+ .execute_automation_command(AutomationCommand::DomGeometry(DevToolsDomGeometryCommand {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -796,7 +807,7 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {})).await.into_parts();- let DevToolsCommandResult::DomGeometry(geometry_result) =+ let AutomationResult::DomGeometry(geometry_result) =geometry_result.expect("DOM geometry should succeed")else {panic!("expected DOM geometry result");@@ -811,9 +822,9 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {assert!(geometry_result.quads.is_empty());let (multiple_result, _) = conn- .execute_devtools_command(DevToolsCommand::QuerySelector(+ .execute_automation_command(AutomationCommand::QuerySelector(DevToolsQuerySelectorCommand {- context: DevToolsCommandContext {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -824,7 +835,7 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {)).await.into_parts();- let DevToolsCommandResult::QuerySelector(multiple_result) =+ let AutomationResult::QuerySelector(multiple_result) =multiple_result.expect("query selector all should succeed")else {panic!("expected query selector result");@@ -834,9 +845,9 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {let _ = conn;let xpath_result = ctx- .execute_devtools_command_through_renderer_fence_for_test(DevToolsCommand::LocateNodes(+ .execute_automation_command_through_renderer_fence_for_test(AutomationCommand::LocateNodes(DevToolsLocateNodesCommand {- context: DevToolsCommandContext {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -848,7 +859,7 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {},)).await;- let DevToolsCommandResult::LocateNodes(xpath_result) =+ let AutomationResult::LocateNodes(xpath_result) =xpath_result.expect("xpath locate nodes should succeed")else {panic!("expected locate nodes result");@@ -864,9 +875,9 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {assert_eq!(xpath_result.node_ids, vec![target_node_id]);let link_result = ctx- .execute_devtools_command_through_renderer_fence_for_test(DevToolsCommand::LocateNodes(+ .execute_automation_command_through_renderer_fence_for_test(AutomationCommand::LocateNodes(DevToolsLocateNodesCommand {- context: DevToolsCommandContext {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -881,7 +892,7 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {},)).await;- let DevToolsCommandResult::LocateNodes(link_result) =+ let AutomationResult::LocateNodes(link_result) =link_result.expect("link text locate nodes should succeed")else {panic!("expected locate nodes result");@@ -889,19 +900,19 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {assert_eq!(link_result.node_ids.len(), 1);let root_result = ctx- .execute_devtools_command_through_renderer_fence_for_test(DevToolsCommand::QuerySelector(- DevToolsQuerySelectorCommand {- context: DevToolsCommandContext {+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::QuerySelector(DevToolsQuerySelectorCommand {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},root: None,selector: "#root".to_owned(),multiple: false,- },- ))+ }),+ ).await;- let DevToolsCommandResult::QuerySelector(root_result) =+ let AutomationResult::QuerySelector(root_result) =root_result.expect("root query selector should succeed")else {panic!("expected query selector result");@@ -910,17 +921,17 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {let sent_before_rooted_query = ctx.sent.len();let rooted_query_result = ctx- .execute_devtools_command_through_renderer_fence_for_test(DevToolsCommand::QuerySelector(- DevToolsQuerySelectorCommand {- context: DevToolsCommandContext {+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::QuerySelector(DevToolsQuerySelectorCommand {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},root: Some(DevToolsDomNodeReference::FrontendNodeId(root_node_id)),selector: "a".to_owned(),multiple: false,- },- ))+ }),+ ).await;assert!(ctx.sent[sent_before_rooted_query..]@@ -928,7 +939,7 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {.all(|message| message.get("id").is_none()),"direct rooted DOM.querySelector must not route child-node sidecars as protocol events");- let DevToolsCommandResult::QuerySelector(rooted_query_result) =+ let AutomationResult::QuerySelector(rooted_query_result) =rooted_query_result.expect("rooted query selector should succeed")else {panic!("expected query selector result");@@ -937,9 +948,9 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {assert_ne!(rooted_query_result.node_ids[0], link_result.node_ids[0]);let root_link_result = ctx- .execute_devtools_command_through_renderer_fence_for_test(DevToolsCommand::LocateNodes(+ .execute_automation_command_through_renderer_fence_for_test(AutomationCommand::LocateNodes(DevToolsLocateNodesCommand {- context: DevToolsCommandContext {+ context: AutomationContext {target_id: Some(target_id),..context},@@ -954,7 +965,7 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {},)).await;- let DevToolsCommandResult::LocateNodes(root_link_result) =+ let AutomationResult::LocateNodes(root_link_result) =root_link_result.expect("rooted link text locate nodes should succeed")else {panic!("expected locate nodes result");@@ -964,31 +975,33 @@ async fn devtools_command_executes_dom_query_selector_for_document_root() {}#[tokio::test]-async fn devtools_command_executes_input_key_command_without_cdp_sidecar() {+async fn automation_command_executes_input_key_command_without_cdp_sidecar() {let mut ctx = crate::testing::TestContext::from_conn(CdpConnection::new());- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from("classic-session-1")),target_id: None,browser_context_id: None,};let (create_result, _) = ctx.conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");};let target_id = create_result.target_id.clone();- let target_context = DevToolsCommandContext {+ let target_context = AutomationContext {target_id: Some(target_id.clone()),..context.clone()};@@ -998,7 +1011,7 @@ async fn devtools_command_executes_input_key_command_without_cdp_sidecar() {let url = "data:text/html,<input id='field'><script>document.getElementById('field').focus()</script>";let (navigate_result, scheduler_events, protocol_events) = ctx.conn- .execute_devtools_command(DevToolsCommand::Navigate(DevToolsNavigateCommand {+ .execute_automation_command(AutomationCommand::Navigate(DevToolsNavigateCommand {context: target_context.clone(),url: url.to_owned(),referrer: None,@@ -1021,7 +1034,7 @@ async fn devtools_command_executes_input_key_command_without_cdp_sidecar() {let (key_result, _scheduler_events, protocol_events) = ctx.conn- .execute_devtools_command(DevToolsCommand::DispatchKeyEvent(+ .execute_automation_command(AutomationCommand::DispatchKeyEvent(DevToolsDispatchKeyEventCommand {context: target_context.clone(),event_type: DevToolsKeyEventType::KeyPress,@@ -1037,7 +1050,7 @@ async fn devtools_command_executes_input_key_command_without_cdp_sidecar() {.into_parts_with_protocol_events();assert_eq!(key_result.expect("key dispatch should succeed"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);assert!(protocol_events.is_empty(),@@ -1045,8 +1058,8 @@ async fn devtools_command_executes_input_key_command_without_cdp_sidecar() {);let value_result = ctx- .execute_devtools_command_through_renderer_fence_for_test(DevToolsCommand::EvaluateScript(- DevToolsEvaluateScriptCommand {+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {context: target_context,realm_id: None,world_name: None,@@ -1058,8 +1071,8 @@ async fn devtools_command_executes_input_key_command_without_cdp_sidecar() {preserve_remote_metadata: false,materialize_bidi_script_result: false,serialization_options: None,- },- ))+ }),+ ).await;let value_result = expect_script_value_result(value_result.expect("value evaluation should succeed"),@@ -1069,17 +1082,17 @@ async fn devtools_command_executes_input_key_command_without_cdp_sidecar() {}#[tokio::test]-async fn devtools_command_executes_context_preload_add_and_remove() {+async fn automation_command_executes_context_preload_add_and_remove() {let mut ctx = crate::testing::TestContext::from_conn(CdpConnection::new());- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};- let create_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let create_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: context.clone(),url: "about:blank".to_owned(),browser_context_id: None,@@ -1087,19 +1100,19 @@ async fn devtools_command_executes_context_preload_add_and_remove() {}),).await;- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");};- let target_context = DevToolsCommandContext {+ let target_context = AutomationContext {target_id: Some(create_result.target_id.clone()),..context.clone()};- let add_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let add_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::AddPreloadScript(DevToolsAddPreloadScriptCommand {+ AutomationCommand::AddPreloadScript(DevToolsAddPreloadScriptCommand {context: target_context.clone(),source: DevToolsPreloadScriptSource::FunctionDeclaration {function_declaration: "() => { globalThis.__bidiPreload = 'from-preload'; }"@@ -1114,7 +1127,7 @@ async fn devtools_command_executes_context_preload_add_and_remove() {}),).await;- let DevToolsCommandResult::AddPreloadScript(add_result) =+ let AutomationResult::AddPreloadScript(add_result) =add_result.expect("addPreloadScript should succeed")else {panic!("expected add preload script result");@@ -1127,9 +1140,9 @@ async fn devtools_command_executes_context_preload_add_and_remove() {"BiDi preload ids should be target-qualified");- let navigate_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let navigate_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::Navigate(DevToolsNavigateCommand {+ AutomationCommand::Navigate(DevToolsNavigateCommand {context: target_context.clone(),url: "data:text/html,bidi-preload".to_owned(),referrer: None,@@ -1139,9 +1152,9 @@ async fn devtools_command_executes_context_preload_add_and_remove() {.await;navigate_result.expect("navigate should run preload script");- let evaluate_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let evaluate_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::EvaluateScript(DevToolsEvaluateScriptCommand {+ AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {context: target_context.clone(),realm_id: None,world_name: None,@@ -1162,9 +1175,9 @@ async fn devtools_command_executes_context_preload_add_and_remove() {);assert_eq!(evaluate_result.value, json!("from-preload"));- let remove_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let remove_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::RemovePreloadScript(DevToolsRemovePreloadScriptCommand {+ AutomationCommand::RemovePreloadScript(DevToolsRemovePreloadScriptCommand {context,script_id: add_result.script_id.clone(),}),@@ -1172,13 +1185,13 @@ async fn devtools_command_executes_context_preload_add_and_remove() {.await;assert_eq!(remove_result.expect("removePreloadScript should succeed"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);let navigate_after_remove_result =- execute_direct_devtools_command_through_renderer_fence_for_test(+ execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::Navigate(DevToolsNavigateCommand {+ AutomationCommand::Navigate(DevToolsNavigateCommand {context: target_context.clone(),url: "data:text/html,bidi-preload-removed".to_owned(),referrer: None,@@ -1189,9 +1202,9 @@ async fn devtools_command_executes_context_preload_add_and_remove() {navigate_after_remove_result.expect("navigate after remove should succeed");let evaluate_after_remove_result =- execute_direct_devtools_command_through_renderer_fence_for_test(+ execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::EvaluateScript(DevToolsEvaluateScriptCommand {+ AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {context: target_context,realm_id: None,world_name: None,@@ -1212,11 +1225,11 @@ async fn devtools_command_executes_context_preload_add_and_remove() {);assert_eq!(after_remove_result.value, json!("undefined"));- let remove_again_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let remove_again_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::RemovePreloadScript(DevToolsRemovePreloadScriptCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ AutomationCommand::RemovePreloadScript(DevToolsRemovePreloadScriptCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,@@ -1234,17 +1247,17 @@ async fn devtools_command_executes_context_preload_add_and_remove() {}#[tokio::test]-async fn devtools_command_executes_script_evaluate_and_call_function() {+async fn automation_command_executes_script_evaluate_and_call_function() {let mut ctx = crate::testing::TestContext::from_conn(CdpConnection::new());- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};- let create_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let create_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: context.clone(),url: "about:blank".to_owned(),browser_context_id: None,@@ -1252,18 +1265,18 @@ async fn devtools_command_executes_script_evaluate_and_call_function() {}),).await;- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");};- let target_context = DevToolsCommandContext {+ let target_context = AutomationContext {target_id: Some(create_result.target_id.clone()),..context.clone()};- let navigate_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let navigate_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::Navigate(DevToolsNavigateCommand {+ AutomationCommand::Navigate(DevToolsNavigateCommand {context: target_context.clone(),url: "data:text/html,bidi-script".to_owned(),referrer: None,@@ -1273,16 +1286,15 @@ async fn devtools_command_executes_script_evaluate_and_call_function() {.await;navigate_result.expect("navigate should succeed before script evaluation");- let realms_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let realms_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::GetRealms(DevToolsGetRealmsCommand {+ AutomationCommand::GetRealms(DevToolsGetRealmsCommand {context: target_context.clone(),realm_type: Some("window".to_owned()),}),).await;- let DevToolsCommandResult::Realms(realms_result) =- realms_result.expect("getRealms should succeed")+ let AutomationResult::Realms(realms_result) = realms_result.expect("getRealms should succeed")else {panic!("expected realms result");};@@ -1298,9 +1310,9 @@ async fn devtools_command_executes_script_evaluate_and_call_function() {.and_then(|realm| realm.realm_id.clone()).expect("getRealms should expose the target default window realm");- let evaluate_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let evaluate_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::EvaluateScript(DevToolsEvaluateScriptCommand {+ AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {context: target_context.clone(),realm_id: None,world_name: None,@@ -1322,13 +1334,13 @@ async fn devtools_command_executes_script_evaluate_and_call_function() {assert_eq!(evaluate_result.value, json!(3));assert!(evaluate_result.handle.is_none());- let realm_context = DevToolsCommandContext {+ let realm_context = AutomationContext {target_id: None,..context.clone()};- let realm_evaluate_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let realm_evaluate_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::EvaluateScript(DevToolsEvaluateScriptCommand {+ AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {context: realm_context.clone(),realm_id: Some(default_realm_id.clone()),world_name: None,@@ -1350,9 +1362,9 @@ async fn devtools_command_executes_script_evaluate_and_call_function() {assert_eq!(realm_evaluate_result.value, json!(5));assert!(realm_evaluate_result.handle.is_none());- let realm_call_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let realm_call_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: realm_context,realm_id: Some(default_realm_id),world_name: None,@@ -1378,9 +1390,9 @@ async fn devtools_command_executes_script_evaluate_and_call_function() {assert_eq!(realm_call_result.value, json!(12));assert!(realm_call_result.handle.is_none());- let owned_evaluate_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let owned_evaluate_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::EvaluateScript(DevToolsEvaluateScriptCommand {+ AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {context: target_context.clone(),realm_id: None,world_name: None,@@ -1403,9 +1415,9 @@ async fn devtools_command_executes_script_evaluate_and_call_function() {.handle.expect("root-owned object result should return a handle");- let unknown_release_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let unknown_release_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::ReleaseObjects(DevToolsReleaseObjectsCommand {+ AutomationCommand::ReleaseObjects(DevToolsReleaseObjectsCommand {context: target_context.clone(),realm_id: None,world_name: None,@@ -1415,30 +1427,31 @@ async fn devtools_command_executes_script_evaluate_and_call_function() {.await;assert_eq!(unknown_release_result.expect("unknown releaseObjects should be ignored"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);- let still_owned_call_result = execute_direct_devtools_command_through_renderer_fence_for_test(- &mut ctx,- DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {- context: target_context.clone(),- realm_id: None,- world_name: None,- object_id: Some(handle.clone()),- this_parameter: None,- function_declaration: "function() { return this.value; }".to_owned(),- arguments: Vec::new(),- await_promise: false,- user_gesture: false,- webdriver_bidi_file_prompt_handler: None,- result_ownership: DevToolsResultOwnership::None,- object_group: None,- preserve_remote_metadata: false,- materialize_bidi_script_result: false,- serialization_options: None,- }),- )- .await;+ let still_owned_call_result =+ execute_direct_automation_command_through_renderer_fence_for_test(+ &mut ctx,+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {+ context: target_context.clone(),+ realm_id: None,+ world_name: None,+ object_id: Some(handle.clone()),+ this_parameter: None,+ function_declaration: "function() { return this.value; }".to_owned(),+ arguments: Vec::new(),+ await_promise: false,+ user_gesture: false,+ webdriver_bidi_file_prompt_handler: None,+ result_ownership: DevToolsResultOwnership::None,+ object_group: None,+ preserve_remote_metadata: false,+ materialize_bidi_script_result: false,+ serialization_options: None,+ }),+ )+ .await;let still_owned_result = expect_script_value_result(still_owned_call_result.expect("unknown release should not drop known handle"),"expected still-owned callFunction value result",@@ -1446,9 +1459,9 @@ async fn devtools_command_executes_script_evaluate_and_call_function() {assert_eq!(still_owned_result.value, json!(42));let this_parameter_call_result =- execute_direct_devtools_command_through_renderer_fence_for_test(+ execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: target_context.clone(),realm_id: None,world_name: None,@@ -1473,9 +1486,9 @@ async fn devtools_command_executes_script_evaluate_and_call_function() {);assert_eq!(this_parameter_result.value, json!(42));- let release_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let release_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::ReleaseObjects(DevToolsReleaseObjectsCommand {+ AutomationCommand::ReleaseObjects(DevToolsReleaseObjectsCommand {context: target_context.clone(),realm_id: None,world_name: None,@@ -1485,12 +1498,12 @@ async fn devtools_command_executes_script_evaluate_and_call_function() {.await;assert_eq!(release_result.expect("releaseObjects should succeed"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);- let released_call_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let released_call_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: target_context.clone(),realm_id: None,world_name: None,@@ -1514,9 +1527,9 @@ async fn devtools_command_executes_script_evaluate_and_call_function() {"released handle should no longer be valid for shared runtime calls");- let call_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let call_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: target_context,realm_id: None,world_name: None,diff --git a/moli-protocol/src/conn/dispatch_tests/dom.rs b/moli-protocol/src/conn/dispatch_tests/dom.rsindex 953c44be0..9f480b7db 100644--- a/moli-protocol/src/conn/dispatch_tests/dom.rs+++ b/moli-protocol/src/conn/dispatch_tests/dom.rs@@ -3,16 +3,16 @@ use super::*;#[tokio::test]async fn element_screenshot_reports_unsupported_without_placeholder_payload() {let mut ctx = crate::testing::TestContext::from_conn(CdpConnection::new());- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("SID-element-shot")),target_id: None,browser_context_id: None,};- let create_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let create_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: context.clone(),url: "about:blank".to_owned(),browser_context_id: None,@@ -20,19 +20,19 @@ async fn element_screenshot_reports_unsupported_without_placeholder_payload() {}),).await;- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");};- let target_context = DevToolsCommandContext {+ let target_context = AutomationContext {target_id: Some(create_result.target_id.clone()),..context};- let navigate_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let navigate_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::Navigate(DevToolsNavigateCommand {+ AutomationCommand::Navigate(DevToolsNavigateCommand {context: target_context.clone(),url: "data:text/html,<div id='target' style='width:120px;height:80px'>shot</div>".to_owned(),@@ -43,9 +43,9 @@ async fn element_screenshot_reports_unsupported_without_placeholder_payload() {.await;navigate_result.expect("navigate should succeed");- let evaluate_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let evaluate_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::EvaluateScript(DevToolsEvaluateScriptCommand {+ AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {context: target_context.clone(),realm_id: None,world_name: None,@@ -60,7 +60,7 @@ async fn element_screenshot_reports_unsupported_without_placeholder_payload() {}),).await;- let DevToolsCommandResult::Script(evaluate_result) =+ let AutomationResult::Script(evaluate_result) =evaluate_result.expect("element evaluate should succeed")else {panic!("expected script result");@@ -72,9 +72,9 @@ async fn element_screenshot_reports_unsupported_without_placeholder_payload() {.shared_id.expect("element remote value should expose sharedId");- let screenshot_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let screenshot_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::CaptureScreenshot(DevToolsCaptureScreenshotCommand {+ AutomationCommand::CaptureScreenshot(DevToolsCaptureScreenshotCommand {context: target_context,format: Some("png".to_owned()),quality: None,@@ -105,10 +105,10 @@ async fn element_screenshot_reports_unsupported_without_initial_document_repair(conn.install_browser_context_fixture_for_test(browser_context);let (screenshot_result, _) = conn- .execute_devtools_command(DevToolsCommand::CaptureScreenshot(+ .execute_automation_command(AutomationCommand::CaptureScreenshot(DevToolsCaptureScreenshotCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("SID-no-page-element-shot")),target_id: Some(DevToolsTargetId::from("TID-no-page-element-shot")),browser_context_id: None,@@ -143,35 +143,37 @@ async fn element_screenshot_reports_unsupported_without_initial_document_repair(}#[tokio::test]-async fn devtools_command_low_backend_node_refs_miss_without_backend_binding() {+async fn automation_command_low_backend_node_refs_miss_without_backend_binding() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from("classic-session-1")),target_id: None,browser_context_id: None,};let (create_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");};let target_id = create_result.target_id.clone();- let target_context = DevToolsCommandContext {+ let target_context = AutomationContext {target_id: Some(target_id),..context};let _ = conn- .execute_devtools_command(DevToolsCommand::Navigate(DevToolsNavigateCommand {+ .execute_automation_command(AutomationCommand::Navigate(DevToolsNavigateCommand {context: target_context.clone(),url: "data:text/html,<!doctype html><html><body></body></html>".to_owned(),referrer: None,@@ -207,7 +209,7 @@ async fn devtools_command_low_backend_node_refs_miss_without_backend_binding() {.expect("runtime mutation should complete");let (attributes_result, _) = conn- .execute_devtools_command(DevToolsCommand::GetAttributes(+ .execute_automation_command(AutomationCommand::GetAttributes(DevToolsGetAttributesCommand {context: target_context.clone(),reference: DevToolsDomNodeReference::BackendNodeId(backend_node_id),@@ -220,7 +222,7 @@ async fn devtools_command_low_backend_node_refs_miss_without_backend_binding() {assert_eq!(error.message, "Could not find node with given id");let (text_result, _) = conn- .execute_devtools_command(DevToolsCommand::GetText(DevToolsGetTextCommand {+ .execute_automation_command(AutomationCommand::GetText(DevToolsGetTextCommand {context: target_context.clone(),reference: DevToolsDomNodeReference::BackendNodeId(backend_node_id),}))@@ -231,7 +233,7 @@ async fn devtools_command_low_backend_node_refs_miss_without_backend_binding() {assert_eq!(error.message, "Could not find node with given id");let (property_result, _) = conn- .execute_devtools_command(DevToolsCommand::GetProperty(DevToolsGetPropertyCommand {+ .execute_automation_command(AutomationCommand::GetProperty(DevToolsGetPropertyCommand {context: target_context.clone(),reference: DevToolsDomNodeReference::BackendNodeId(backend_node_id),name: "id".to_owned(),@@ -243,11 +245,13 @@ async fn devtools_command_low_backend_node_refs_miss_without_backend_binding() {assert_eq!(error.message, "Could not find node with given id");let (outer_html_result, _) = conn- .execute_devtools_command(DevToolsCommand::GetOuterHtml(DevToolsGetOuterHtmlCommand {- context: target_context.clone(),- reference: Some(DevToolsDomNodeReference::BackendNodeId(backend_node_id)),- include_shadow_dom: false,- }))+ .execute_automation_command(AutomationCommand::GetOuterHtml(+ DevToolsGetOuterHtmlCommand {+ context: target_context.clone(),+ reference: Some(DevToolsDomNodeReference::BackendNodeId(backend_node_id)),+ include_shadow_dom: false,+ },+ )).await.into_parts();let error = outer_html_result.expect_err("low backendNodeId get outerHTML should miss");@@ -255,12 +259,14 @@ async fn devtools_command_low_backend_node_refs_miss_without_backend_binding() {assert_eq!(error.message, "Could not find node with given id");let (describe_result, _) = conn- .execute_devtools_command(DevToolsCommand::DescribeNode(DevToolsDescribeNodeCommand {- context: target_context.clone(),- reference: Some(DevToolsDomNodeReference::BackendNodeId(backend_node_id)),- depth: 0,- pierce: false,- }))+ .execute_automation_command(AutomationCommand::DescribeNode(+ DevToolsDescribeNodeCommand {+ context: target_context.clone(),+ reference: Some(DevToolsDomNodeReference::BackendNodeId(backend_node_id)),+ depth: 0,+ pierce: false,+ },+ )).await.into_parts();let error = describe_result.expect_err("low backendNodeId describe should miss");@@ -268,7 +274,7 @@ async fn devtools_command_low_backend_node_refs_miss_without_backend_binding() {assert_eq!(error.message, "Could not find node with given id");let (rooted_query_result, _) = conn- .execute_devtools_command(DevToolsCommand::QuerySelector(+ .execute_automation_command(AutomationCommand::QuerySelector(DevToolsQuerySelectorCommand {context: target_context,root: Some(DevToolsDomNodeReference::BackendNodeId(backend_node_id)),diff --git a/moli-protocol/src/conn/dispatch_tests/fetch.rs b/moli-protocol/src/conn/dispatch_tests/fetch.rsindex 80959b3d4..0c7e19a72 100644--- a/moli-protocol/src/conn/dispatch_tests/fetch.rs+++ b/moli-protocol/src/conn/dispatch_tests/fetch.rs@@ -7,21 +7,19 @@ async fn devtools_fetch_control_command_routes_through_fetch_owner() {"BID-fetch-control","TID-fetch-control",));- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let outcome = conn- .execute_devtools_command(DevToolsCommand::FailInterceptedRequest(+ .execute_automation_command(AutomationCommand::FailInterceptedRequest(DevToolsFailInterceptedRequestCommand {context: context.clone(),request_id: DevToolsRequestId::from("INT-99"),- failure: crate::devtools_runtime::DevToolsRequestFailure::Failed(- "Failed".to_owned(),- ),+ failure: crate::automation::DevToolsRequestFailure::Failed("Failed".to_owned()),},)).await;@@ -33,7 +31,7 @@ async fn devtools_fetch_control_command_routes_through_fetch_owner() {assert_eq!(error.message, "RequestNotFound");let outcome = conn- .execute_devtools_command(DevToolsCommand::ContinueWithAuth(+ .execute_automation_command(AutomationCommand::ContinueWithAuth(DevToolsContinueWithAuthCommand {context,request_id: DevToolsRequestId::from("foo"),@@ -53,17 +51,17 @@ async fn devtools_fetch_control_command_routes_through_fetch_owner() {}#[tokio::test]-async fn devtools_command_navigates_explicit_about_blank_without_fetch() {+async fn automation_command_navigates_explicit_about_blank_without_fetch() {let mut ctx = crate::testing::TestContext::from_conn(CdpConnection::new());- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};- let create_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let create_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: context.clone(),url: "about:blank".to_owned(),browser_context_id: None,@@ -71,20 +69,20 @@ async fn devtools_command_navigates_explicit_about_blank_without_fetch() {}),).await;- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");};let target_id = create_result.target_id.clone();- let target_context = DevToolsCommandContext {+ let target_context = AutomationContext {target_id: Some(target_id),..context};- let data_navigate = execute_direct_devtools_command_through_renderer_fence_for_test(+ let data_navigate = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::Navigate(DevToolsNavigateCommand {+ AutomationCommand::Navigate(DevToolsNavigateCommand {context: target_context.clone(),url: "data:text/html,<script>window.marker='old'</script><p>old</p>".to_owned(),referrer: None,@@ -105,9 +103,9 @@ async fn devtools_command_navigates_explicit_about_blank_without_fetch() {"old");- let blank_navigate = execute_direct_devtools_command_through_renderer_fence_for_test(+ let blank_navigate = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::Navigate(DevToolsNavigateCommand {+ AutomationCommand::Navigate(DevToolsNavigateCommand {context: target_context.clone(),url: "about:blank".to_owned(),referrer: None,@@ -115,7 +113,7 @@ async fn devtools_command_navigates_explicit_about_blank_without_fetch() {}),).await;- let DevToolsCommandResult::Navigate(blank_navigate) =+ let AutomationResult::Navigate(blank_navigate) =blank_navigate.expect("about:blank navigate should succeed")else {panic!("expected navigate result");@@ -144,17 +142,17 @@ async fn devtools_network_intercept_commands_route_to_fetch_owner() {let mut browser_context = BrowserContext::new("BID-bidi-intercept".to_owned());browser_context.set_active_target_id("TID-bidi-intercept".to_owned());conn.install_browser_context_fixture_for_test(browser_context);- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("BIDI-SID")),target_id: None,browser_context_id: None,};let (unknown_target_result, _) = conn- .execute_devtools_command(DevToolsCommand::AddNetworkIntercept(+ .execute_automation_command(AutomationCommand::AddNetworkIntercept(DevToolsAddNetworkInterceptCommand {- context: DevToolsCommandContext {+ context: AutomationContext {target_id: Some(DevToolsTargetId::from("missing-target")),..context.clone()},@@ -183,7 +181,7 @@ async fn devtools_network_intercept_commands_route_to_fetch_owner() {);let (result, _) = conn- .execute_devtools_command(DevToolsCommand::AddNetworkIntercept(+ .execute_automation_command(AutomationCommand::AddNetworkIntercept(DevToolsAddNetworkInterceptCommand {context: context.clone(),intercept_id: DevToolsNetworkInterceptId::from("intercept-1"),@@ -199,7 +197,7 @@ async fn devtools_network_intercept_commands_route_to_fetch_owner() {)).await.into_parts();- let DevToolsCommandResult::AddNetworkIntercept(result) =+ let AutomationResult::AddNetworkIntercept(result) =result.expect("add intercept should succeed")else {panic!("expected AddNetworkIntercept result");@@ -225,7 +223,7 @@ async fn devtools_network_intercept_commands_route_to_fetch_owner() {);let (result, _) = conn- .execute_devtools_command(DevToolsCommand::RemoveNetworkIntercept(+ .execute_automation_command(AutomationCommand::RemoveNetworkIntercept(DevToolsRemoveNetworkInterceptCommand {context: context.clone(),intercept_id: DevToolsNetworkInterceptId::from("intercept-1"),@@ -235,7 +233,7 @@ async fn devtools_network_intercept_commands_route_to_fetch_owner() {.into_parts();assert_eq!(result.expect("remove intercept should succeed"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);assert!(!conn@@ -256,9 +254,9 @@ async fn devtools_network_intercept_commands_route_to_fetch_owner() {"https://example.test/background".to_owned(),));let (result, _) = conn- .execute_devtools_command(DevToolsCommand::AddNetworkIntercept(+ .execute_automation_command(AutomationCommand::AddNetworkIntercept(DevToolsAddNetworkInterceptCommand {- context: DevToolsCommandContext {+ context: AutomationContext {target_id: Some(DevToolsTargetId::from("TID-bidi-intercept-background")),..context.clone()},@@ -281,7 +279,7 @@ async fn devtools_network_intercept_commands_route_to_fetch_owner() {);let (result, _) = conn- .execute_devtools_command(DevToolsCommand::RemoveNetworkIntercept(+ .execute_automation_command(AutomationCommand::RemoveNetworkIntercept(DevToolsRemoveNetworkInterceptCommand {context: context.clone(),intercept_id: DevToolsNetworkInterceptId::from("intercept-background"),@@ -291,7 +289,7 @@ async fn devtools_network_intercept_commands_route_to_fetch_owner() {.into_parts();assert_eq!(result.expect("target-less remove should find background intercept"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);assert!(conn.browser_context@@ -304,9 +302,9 @@ async fn devtools_network_intercept_commands_route_to_fetch_owner() {);let (auth_only_result, _) = conn- .execute_devtools_command(DevToolsCommand::AddNetworkIntercept(+ .execute_automation_command(AutomationCommand::AddNetworkIntercept(DevToolsAddNetworkInterceptCommand {- context: DevToolsCommandContext {+ context: AutomationContext {target_id: Some(DevToolsTargetId::from("TID-bidi-intercept")),..context.clone()},diff --git a/moli-protocol/src/conn/dispatch_tests/mod.rs b/moli-protocol/src/conn/dispatch_tests/mod.rsindex 0b61630b5..a40a35ed7 100644--- a/moli-protocol/src/conn/dispatch_tests/mod.rs+++ b/moli-protocol/src/conn/dispatch_tests/mod.rs@@ -1,34 +1,35 @@use crate::DevToolsRuntimeCommandTaskStep;-use crate::devtools_runtime::{- AutomationEvent, DevToolsActivateTargetCommand, DevToolsAddNetworkInterceptCommand,+use crate::automation::{+ AutomationCommand, AutomationContext, AutomationEvent, AutomationResult,+ DevToolsActivateTargetCommand, DevToolsAddNetworkInterceptCommand,DevToolsAddPreloadScriptCommand, DevToolsAuthChallengeAction, DevToolsBrowserContextId,DevToolsCallFunctionCommand, DevToolsCaptureScreenshotClip, DevToolsCaptureScreenshotCommand,- DevToolsCloseTargetCommand, DevToolsCommand, DevToolsCommandContext, DevToolsCommandResult,- DevToolsContinueInterceptedRequestCommand, DevToolsContinueInterceptedResponseCommand,- DevToolsContinueWithAuthCommand, DevToolsCookieParam, DevToolsCreateBrowserContextCommand,- DevToolsCreateTargetCommand, DevToolsDeleteCookiesCommand, DevToolsDescribeNodeCommand,- DevToolsDevicePixelRatioSetting, DevToolsDispatchKeyEventCommand,- DevToolsDispatchMouseEventCommand, DevToolsDomGeometryCommand, DevToolsDomGeometryOperation,- DevToolsDomNodeReference, DevToolsErrorKind, DevToolsEvaluateScriptCommand,- DevToolsFailInterceptedRequestCommand, DevToolsFulfillInterceptedRequestCommand,- DevToolsGetAttributesCommand, DevToolsGetBrowserContextsCommand, DevToolsGetCookiesCommand,- DevToolsGetFrameTreeCommand, DevToolsGetLayoutMetricsCommand,- DevToolsGetNavigationHistoryCommand, DevToolsGetOuterHtmlCommand, DevToolsGetPropertyCommand,- DevToolsGetRealmsCommand, DevToolsGetTargetsCommand, DevToolsGetTextCommand,- DevToolsHistoryTraversalDestination, DevToolsKeyEventType, DevToolsLocateNodesCommand,- DevToolsLocateNodesLocator, DevToolsLocateNodesTextMatch, DevToolsMouseEventType,- DevToolsNavigateCommand, DevToolsNavigationWait, DevToolsNetworkInterceptId,- DevToolsNetworkInterceptPattern, DevToolsNetworkInterceptPhase, DevToolsPointerType,- DevToolsPreloadScriptSource, DevToolsPrintToPdfCommand, DevToolsPrintToPdfTransferMode,- DevToolsProtocol, DevToolsQuerySelectorCommand, DevToolsReleaseObjectsCommand,- DevToolsReloadCommand, DevToolsRemoteHandleId, DevToolsRemoteValue,- DevToolsRemoveBrowserContextCommand, DevToolsRemoveNetworkInterceptCommand,- DevToolsRemovePreloadScriptCommand, DevToolsRequestId, DevToolsResolveNodeCommand,- DevToolsResultOwnership, DevToolsScreenshotElementClip, DevToolsScriptResult,- DevToolsScrollIntoViewIfNeededCommand, DevToolsSerializationOptions, DevToolsSessionId,- DevToolsSetCookiesCommand, DevToolsSetFileInputFilesCommand, DevToolsSetViewportCommand,- DevToolsSetWindowStateCommand, DevToolsTargetId, DevToolsTraverseHistoryCommand,- DevToolsTraverseHistoryResult, DevToolsViewportSetting, DevToolsWindowState,+ DevToolsCloseTargetCommand, DevToolsContinueInterceptedRequestCommand,+ DevToolsContinueInterceptedResponseCommand, DevToolsContinueWithAuthCommand,+ DevToolsCookieParam, DevToolsCreateBrowserContextCommand, DevToolsCreateTargetCommand,+ DevToolsDeleteCookiesCommand, DevToolsDescribeNodeCommand, DevToolsDevicePixelRatioSetting,+ DevToolsDispatchKeyEventCommand, DevToolsDispatchMouseEventCommand, DevToolsDomGeometryCommand,+ DevToolsDomGeometryOperation, DevToolsDomNodeReference, DevToolsErrorKind,+ DevToolsEvaluateScriptCommand, DevToolsFailInterceptedRequestCommand,+ DevToolsFulfillInterceptedRequestCommand, DevToolsGetAttributesCommand,+ DevToolsGetBrowserContextsCommand, DevToolsGetCookiesCommand, DevToolsGetFrameTreeCommand,+ DevToolsGetLayoutMetricsCommand, DevToolsGetNavigationHistoryCommand,+ DevToolsGetOuterHtmlCommand, DevToolsGetPropertyCommand, DevToolsGetRealmsCommand,+ DevToolsGetTargetsCommand, DevToolsGetTextCommand, DevToolsHistoryTraversalDestination,+ DevToolsKeyEventType, DevToolsLocateNodesCommand, DevToolsLocateNodesLocator,+ DevToolsLocateNodesTextMatch, DevToolsMouseEventType, DevToolsNavigateCommand,+ DevToolsNavigationWait, DevToolsNetworkInterceptId, DevToolsNetworkInterceptPattern,+ DevToolsNetworkInterceptPhase, DevToolsPointerType, DevToolsPreloadScriptSource,+ DevToolsPrintToPdfCommand, DevToolsPrintToPdfTransferMode, DevToolsQuerySelectorCommand,+ DevToolsReleaseObjectsCommand, DevToolsReloadCommand, DevToolsRemoteHandleId,+ DevToolsRemoteValue, DevToolsRemoveBrowserContextCommand,+ DevToolsRemoveNetworkInterceptCommand, DevToolsRemovePreloadScriptCommand, DevToolsRequestId,+ DevToolsResolveNodeCommand, DevToolsResultOwnership, DevToolsScreenshotElementClip,+ DevToolsScriptResult, DevToolsScrollIntoViewIfNeededCommand, DevToolsSerializationOptions,+ DevToolsSessionId, DevToolsSetCookiesCommand, DevToolsSetFileInputFilesCommand,+ DevToolsSetViewportCommand, DevToolsSetWindowStateCommand, DevToolsTargetId,+ DevToolsTraverseHistoryCommand, DevToolsTraverseHistoryResult, DevToolsViewportSetting,+ DevToolsWindowState, FrontendProtocol,};use serde_json::json;@@ -41,8 +42,8 @@ fn complete_messages(step: CdpCommandTaskStep) -> Vec<Value> {}}-fn expect_script_value_result(result: DevToolsCommandResult, message: &str) -> DevToolsRemoteValue {- let DevToolsCommandResult::Script(result) = result else {+fn expect_script_value_result(result: AutomationResult, message: &str) -> DevToolsRemoteValue {+ let AutomationResult::Script(result) = result else {panic!("{message}");};let DevToolsScriptResult::Value(value) = *result else {@@ -58,32 +59,32 @@ fn is_command_response_sidecar_event(event: &BackgroundProtocolEvent) -> bool {})}-fn bidi_fetch_command_context() -> DevToolsCommandContext {- DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+fn bidi_fetch_command_context() -> AutomationContext {+ AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,}}-async fn execute_direct_devtools_command_through_renderer_fence_for_test(+async fn execute_direct_automation_command_through_renderer_fence_for_test(ctx: &mut crate::testing::TestContext,- command: DevToolsCommand,-) -> Result<DevToolsCommandResult, crate::devtools_runtime::DevToolsError> {- ctx.execute_devtools_command_through_renderer_fence_for_test(command)+ command: AutomationCommand,+) -> Result<AutomationResult, crate::automation::DevToolsError> {+ ctx.execute_automation_command_through_renderer_fence_for_test(command).await}async fn evaluate_string_through_renderer_fence_for_test(ctx: &mut crate::testing::TestContext,- context: DevToolsCommandContext,+ context: AutomationContext,expression: &str,label: &str,) -> String {- let result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let result = execute_direct_automation_command_through_renderer_fence_for_test(ctx,- DevToolsCommand::EvaluateScript(DevToolsEvaluateScriptCommand {+ AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {context,realm_id: None,world_name: None,@@ -111,13 +112,13 @@ async fn evaluate_string_through_renderer_fence_for_test(async fn create_target_in_browser_context_through_renderer_fence_for_test(ctx: &mut crate::testing::TestContext,- context: &DevToolsCommandContext,+ context: &AutomationContext,browser_context_id: &str,label: &str,) -> DevToolsTargetId {- let create_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let create_result = execute_direct_automation_command_through_renderer_fence_for_test(ctx,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: context.clone(),url: "about:blank".to_owned(),browser_context_id: Some(DevToolsBrowserContextId::from(browser_context_id)),@@ -125,7 +126,7 @@ async fn create_target_in_browser_context_through_renderer_fence_for_test(}),).await;- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.unwrap_or_else(|error| panic!("create {label} should succeed: {error:?}"))else {panic!("expected create target result for {label}");@@ -137,35 +138,35 @@ async fn materialize_bidi_target_node_for_test(ctx: &mut crate::testing::TestContext,html: &str,selector: &str,-) -> (DevToolsCommandContext, DevToolsRemoteHandleId, u32) {- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+) -> (AutomationContext, DevToolsRemoteHandleId, u32) {+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let create_result = ctx- .execute_devtools_command_through_renderer_fence_for_test(DevToolsCommand::CreateTarget(- DevToolsCreateTargetCommand {+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: context.clone(),url: "about:blank".to_owned(),browser_context_id: None,activate: false,- },- ))+ }),+ ).await;- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");};- let target_context = DevToolsCommandContext {+ let target_context = AutomationContext {target_id: Some(create_result.target_id),..context};let navigate_result = ctx- .execute_devtools_command_through_renderer_fence_for_test(DevToolsCommand::Navigate(+ .execute_automation_command_through_renderer_fence_for_test(AutomationCommand::Navigate(DevToolsNavigateCommand {context: target_context.clone(),url: format!("data:text/html,{html}"),@@ -177,8 +178,8 @@ async fn materialize_bidi_target_node_for_test(navigate_result.expect("navigate should succeed");let evaluate_result = ctx- .execute_devtools_command_through_renderer_fence_for_test(DevToolsCommand::EvaluateScript(- DevToolsEvaluateScriptCommand {+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {context: target_context.clone(),realm_id: None,world_name: None,@@ -190,10 +191,10 @@ async fn materialize_bidi_target_node_for_test(preserve_remote_metadata: false,materialize_bidi_script_result: false,serialization_options: None,- },- ))+ }),+ ).await;- let DevToolsCommandResult::Script(evaluate_result) =+ let AutomationResult::Script(evaluate_result) =evaluate_result.expect("node evaluate should succeed")else {panic!("expected script result");@@ -213,7 +214,7 @@ async fn materialize_bidi_target_node_for_test(async fn materialize_bidi_target_input_node_for_test(ctx: &mut crate::testing::TestContext,html: &str,-) -> (DevToolsCommandContext, DevToolsRemoteHandleId, u32) {+) -> (AutomationContext, DevToolsRemoteHandleId, u32) {materialize_bidi_target_node_for_test(ctx, html, "#target").await}@@ -247,12 +248,12 @@ async fn ensure_initial_document_for_target_id_for_test(async fn evaluate_string_for_test(conn: &mut CdpConnection,- context: DevToolsCommandContext,+ context: AutomationContext,expression: &str,label: &str,) -> String {let (evaluate_result, _) = conn- .execute_devtools_command(DevToolsCommand::EvaluateScript(+ .execute_automation_command(AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {context,realm_id: None,@@ -301,7 +302,7 @@ fn connection_with_background_pending_fetch_action(request_id: &str) -> CdpConne}async fn assert_bidi_fetch_action_consumes_background_request(- command: DevToolsCommand,+ command: AutomationCommand,request_id: &str,) {let mut conn = connection_with_background_pending_fetch_action(request_id);@@ -311,7 +312,7 @@ async fn assert_bidi_fetch_action_consumes_background_request());let (result, events, protocol_events, renderer_output_predecessor) = conn- .execute_devtools_command(command)+ .execute_automation_command(command).await.into_complete_parts();@@ -320,7 +321,7 @@ async fn assert_bidi_fetch_action_consumes_background_request(assert!(renderer_output_predecessor.is_none());assert_eq!(result.expect("BiDi request action should resolve background owner"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);assert!(conn.pending_fetch_request_session_route(request_id)@@ -395,10 +396,10 @@ async fn attach_page_session_for_test(conn: &mut CdpConnection, target_id: &str)async fn evaluate_document_surface_payload(conn: &mut CdpConnection,- context: DevToolsCommandContext,+ context: AutomationContext,) -> serde_json::Value {let (result, _) = conn- .execute_devtools_command(DevToolsCommand::EvaluateScript(+ .execute_automation_command(AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {context,realm_id: None,diff --git a/moli-protocol/src/conn/dispatch_tests/page.rs b/moli-protocol/src/conn/dispatch_tests/page.rsindex 7ecc0ba76..c072cdf49 100644--- a/moli-protocol/src/conn/dispatch_tests/page.rs+++ b/moli-protocol/src/conn/dispatch_tests/page.rs@@ -3,20 +3,22 @@ use super::*;#[tokio::test]async fn devtools_script_navigation_exact_cursor_rejects_replaced_page_owner_action() {let mut ctx = crate::testing::TestContext::new_with_target_discovery(false);- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from("classic-session-1")),target_id: None,browser_context_id: None,};let create_outcome = ctx.conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: true,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: true,+ },+ )).await;let create_predecessor = create_outcome.renderer_output_predecessor();let (create_result, create_events) = create_outcome.into_parts();@@ -25,7 +27,7 @@ async fn devtools_script_navigation_exact_cursor_rejects_replaced_page_owner_actctx.route_direct_command_renderer_predecessor_for_test(predecessor).await;}- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");@@ -33,14 +35,14 @@ async fn devtools_script_navigation_exact_cursor_rejects_replaced_page_owner_actlet target_id = create_result.target_id;ctx.install_navigation_fixture_for_session_owner("about:blank", None).await;- let target_context = DevToolsCommandContext {+ let target_context = AutomationContext {target_id: Some(target_id.clone()),..context};let outcome = ctx.conn- .execute_devtools_command_with_protocol_events(DevToolsCommand::EvaluateScript(+ .execute_automation_command_with_protocol_events(AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {context: target_context,realm_id: None,@@ -100,8 +102,8 @@ async fn devtools_script_navigation_exact_cursor_rejects_replaced_page_owner_act#[tokio::test]async fn page_enable_uses_background_initial_document_through_attached_session() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-page-normal-route")),target_id: None,browser_context_id: None,@@ -110,14 +112,14 @@ async fn page_enable_uses_background_initial_document_through_attached_session()let (first_result, _) =crate::domains::target::execute_immediate_devtools_target_command_with_protocol_events(&mut conn,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: context.clone(),url: "about:blank".to_owned(),browser_context_id: None,activate: false,}),);- let DevToolsCommandResult::CreateTarget(first_result) =+ let AutomationResult::CreateTarget(first_result) =first_result.expect("initial target create should succeed")else {panic!("expected create target result");@@ -127,14 +129,14 @@ async fn page_enable_uses_background_initial_document_through_attached_session()let (second_result, _) =crate::domains::target::execute_immediate_devtools_target_command_with_protocol_events(&mut conn,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context,url: "about:blank".to_owned(),browser_context_id: None,activate: false,}),);- let DevToolsCommandResult::CreateTarget(second_result) =+ let AutomationResult::CreateTarget(second_result) =second_result.expect("background target create should succeed")else {panic!("expected create target result");@@ -202,8 +204,8 @@ async fn page_enable_uses_background_initial_document_through_attached_session()#[tokio::test]async fn initial_document_page_ensure_completion_uses_captured_owner() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-initial-owner")),target_id: None,browser_context_id: None,@@ -212,14 +214,14 @@ async fn initial_document_page_ensure_completion_uses_captured_owner() {let (first_result, _) =crate::domains::target::execute_immediate_devtools_target_command_with_protocol_events(&mut conn,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: context.clone(),url: "about:blank".to_owned(),browser_context_id: None,activate: false,}),);- let DevToolsCommandResult::CreateTarget(first_result) =+ let AutomationResult::CreateTarget(first_result) =first_result.expect("initial target create should succeed")else {panic!("expected create target result");@@ -229,14 +231,14 @@ async fn initial_document_page_ensure_completion_uses_captured_owner() {let (second_result, _) =crate::domains::target::execute_immediate_devtools_target_command_with_protocol_events(&mut conn,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context,url: "about:blank".to_owned(),browser_context_id: None,activate: false,}),);- let DevToolsCommandResult::CreateTarget(second_result) =+ let AutomationResult::CreateTarget(second_result) =second_result.expect("background target create should succeed")else {panic!("expected create target result");@@ -284,8 +286,8 @@ async fn initial_document_page_ensure_completion_uses_captured_owner() {#[tokio::test]async fn stale_initial_document_page_build_does_not_overwrite_committed_page() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-lifecycle-stale-initial")),target_id: None,browser_context_id: None,@@ -294,14 +296,14 @@ async fn stale_initial_document_page_build_does_not_overwrite_committed_page() {let (create_result, _) =crate::domains::target::execute_immediate_devtools_target_command_with_protocol_events(&mut conn,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context,url: "about:blank".to_owned(),browser_context_id: None,activate: true,}),);- let DevToolsCommandResult::CreateTarget(_) =+ let AutomationResult::CreateTarget(_) =create_result.expect("active target create should succeed")else {panic!("expected create target result");@@ -505,24 +507,26 @@ async fn stale_initial_document_page_build_does_not_overwrite_committed_page() {}#[tokio::test]-async fn devtools_command_executes_page_navigation_and_reload() {+async fn automation_command_executes_page_navigation_and_reload() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (create_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");@@ -531,8 +535,8 @@ async fn devtools_command_executes_page_navigation_and_reload() {let target_id = create_result.target_id.clone();let (navigate_result, _, _, _) = conn- .execute_devtools_command(DevToolsCommand::Navigate(DevToolsNavigateCommand {- context: DevToolsCommandContext {+ .execute_automation_command(AutomationCommand::Navigate(DevToolsNavigateCommand {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -542,7 +546,7 @@ async fn devtools_command_executes_page_navigation_and_reload() {})).await.into_complete_parts();- let DevToolsCommandResult::Navigate(navigate_result) =+ let AutomationResult::Navigate(navigate_result) =navigate_result.expect("navigate should succeed")else {panic!("expected navigate result");@@ -550,8 +554,8 @@ async fn devtools_command_executes_page_navigation_and_reload() {assert_eq!(navigate_result.url, url);let (reload_result, _, _, _) = conn- .execute_devtools_command(DevToolsCommand::Reload(DevToolsReloadCommand {- context: DevToolsCommandContext {+ .execute_automation_command(AutomationCommand::Reload(DevToolsReloadCommand {+ context: AutomationContext {target_id: Some(target_id),..context},@@ -561,8 +565,7 @@ async fn devtools_command_executes_page_navigation_and_reload() {})).await.into_complete_parts();- let DevToolsCommandResult::Navigate(reload_result) =- reload_result.expect("reload should succeed")+ let AutomationResult::Navigate(reload_result) = reload_result.expect("reload should succeed")else {panic!("expected reload navigation result");};@@ -570,36 +573,38 @@ async fn devtools_command_executes_page_navigation_and_reload() {}#[tokio::test]-async fn devtools_command_executes_page_navigation_without_cdp_response_sidecar() {+async fn automation_command_executes_page_navigation_without_cdp_response_sidecar() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (create_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");};- let target_context = DevToolsCommandContext {+ let target_context = AutomationContext {target_id: Some(create_result.target_id),..context};let url = "data:text/html,direct-nav-no-sidecar".to_owned();let (navigate_result, _scheduler_events, protocol_events, _renderer_output_predecessor) = conn- .execute_devtools_command_with_protocol_events(DevToolsCommand::Navigate(+ .execute_automation_command_with_protocol_events(AutomationCommand::Navigate(DevToolsNavigateCommand {context: target_context,url: url.clone(),@@ -609,7 +614,7 @@ async fn devtools_command_executes_page_navigation_without_cdp_response_sidecar()).await.into_complete_parts();- let DevToolsCommandResult::Navigate(navigate_result) =+ let AutomationResult::Navigate(navigate_result) =navigate_result.expect("navigate should succeed")else {panic!("expected navigate result");@@ -624,34 +629,36 @@ async fn devtools_command_executes_page_navigation_without_cdp_response_sidecar(}#[tokio::test]-async fn devtools_command_executes_child_frame_navigation_without_cdp_response_sidecar() {+async fn automation_command_executes_child_frame_navigation_without_cdp_response_sidecar() {let mut ctx = crate::testing::TestContext::new_with_target_discovery(false);- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let create_outcome = ctx.conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await;let (create_result, _, _, create_predecessor) = create_outcome.into_complete_parts();if let Some(predecessor) = create_predecessor {ctx.route_direct_command_renderer_predecessor_for_test(predecessor).await;}- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");};- let target_context = DevToolsCommandContext {+ let target_context = AutomationContext {target_id: Some(create_result.target_id.clone()),..context.clone()};@@ -660,7 +667,7 @@ async fn devtools_command_executes_child_frame_navigation_without_cdp_response_s"data:text/html,<iframe srcdoc='<p id=\"child\">initial</p>'></iframe>".to_owned();let parent_outcome = ctx.conn- .execute_devtools_command(DevToolsCommand::Navigate(DevToolsNavigateCommand {+ .execute_automation_command(AutomationCommand::Navigate(DevToolsNavigateCommand {context: target_context.clone(),url: parent_url,referrer: None,@@ -676,13 +683,15 @@ async fn devtools_command_executes_child_frame_navigation_without_cdp_response_slet (frame_tree_result, _) = ctx.conn- .execute_devtools_command(DevToolsCommand::GetFrameTree(DevToolsGetFrameTreeCommand {- context: target_context,- max_depth: None,- }))+ .execute_automation_command(AutomationCommand::GetFrameTree(+ DevToolsGetFrameTreeCommand {+ context: target_context,+ max_depth: None,+ },+ )).await.into_parts();- let DevToolsCommandResult::GetFrameTree(frame_tree_result) =+ let AutomationResult::GetFrameTree(frame_tree_result) =frame_tree_result.expect("frame tree should be readable")else {panic!("expected frame tree result");@@ -701,9 +710,9 @@ async fn devtools_command_executes_child_frame_navigation_without_cdp_response_slet child_url = "data:text/html,<p id='child'>updated</p>".to_owned();let child_outcome = ctx.conn- .execute_devtools_command_with_protocol_events(DevToolsCommand::Navigate(+ .execute_automation_command_with_protocol_events(AutomationCommand::Navigate(DevToolsNavigateCommand {- context: DevToolsCommandContext {+ context: AutomationContext {target_id: Some(DevToolsTargetId::from(child_frame_id)),..context},@@ -719,7 +728,7 @@ async fn devtools_command_executes_child_frame_navigation_without_cdp_response_sctx.route_direct_command_renderer_predecessor_for_test(predecessor).await;}- let DevToolsCommandResult::Navigate(navigate_result) =+ let AutomationResult::Navigate(navigate_result) =navigate_result.expect("child frame navigate should succeed")else {panic!("expected navigate result");@@ -734,35 +743,37 @@ async fn devtools_command_executes_child_frame_navigation_without_cdp_response_s}#[tokio::test]-async fn devtools_command_reports_invalid_navigation_without_cdp_response_parser() {+async fn automation_command_reports_invalid_navigation_without_cdp_response_parser() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (create_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");};- let target_context = DevToolsCommandContext {+ let target_context = AutomationContext {target_id: Some(create_result.target_id),..context};let (navigate_result, _scheduler_events, protocol_events) = conn- .execute_devtools_command_with_protocol_events(DevToolsCommand::Navigate(+ .execute_automation_command_with_protocol_events(AutomationCommand::Navigate(DevToolsNavigateCommand {context: target_context,url: "not a valid navigation url".to_owned(),@@ -784,24 +795,26 @@ async fn devtools_command_reports_invalid_navigation_without_cdp_response_parser}#[tokio::test]-async fn devtools_command_rejects_page_print_to_pdf_without_placeholder_payload() {+async fn automation_command_rejects_page_print_to_pdf_without_placeholder_payload() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (create_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");@@ -809,8 +822,8 @@ async fn devtools_command_rejects_page_print_to_pdf_without_placeholder_payload(let target_id = create_result.target_id.clone();let url = "data:text/html,bidi-print".to_owned();let (navigate_result, _, _, _) = conn- .execute_devtools_command(DevToolsCommand::Navigate(DevToolsNavigateCommand {- context: DevToolsCommandContext {+ .execute_automation_command(AutomationCommand::Navigate(DevToolsNavigateCommand {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -823,8 +836,8 @@ async fn devtools_command_rejects_page_print_to_pdf_without_placeholder_payload(navigate_result.expect("navigate should succeed");let (print_result, _) = conn- .execute_devtools_command(DevToolsCommand::PrintToPdf(DevToolsPrintToPdfCommand {- context: DevToolsCommandContext {+ .execute_automation_command(AutomationCommand::PrintToPdf(DevToolsPrintToPdfCommand {+ context: AutomationContext {target_id: Some(target_id),..context},@@ -852,24 +865,26 @@ async fn devtools_command_rejects_page_print_to_pdf_without_placeholder_payload(}#[tokio::test]-async fn devtools_command_executes_context_viewport_override() {+async fn automation_command_executes_context_viewport_override() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (create_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");@@ -877,8 +892,8 @@ async fn devtools_command_executes_context_viewport_override() {let target_id = create_result.target_id.clone();let (viewport_result, _) = conn- .execute_devtools_command(DevToolsCommand::SetViewport(DevToolsSetViewportCommand {- context: DevToolsCommandContext {+ .execute_automation_command(AutomationCommand::SetViewport(DevToolsSetViewportCommand {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -895,7 +910,7 @@ async fn devtools_command_executes_context_viewport_override() {.into_parts();assert_eq!(viewport_result.expect("set viewport should succeed"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);let owner = CommandOwnerScope::capture(&conn, None);@@ -907,9 +922,9 @@ async fn devtools_command_executes_context_viewport_override() {assert_eq!(metrics.device_scale_factor, 2.0);let (layout_result, _) = conn- .execute_devtools_command(DevToolsCommand::GetLayoutMetrics(+ .execute_automation_command(AutomationCommand::GetLayoutMetrics(DevToolsGetLayoutMetricsCommand {- context: DevToolsCommandContext {+ context: AutomationContext {target_id: Some(target_id),..context},@@ -917,7 +932,7 @@ async fn devtools_command_executes_context_viewport_override() {)).await.into_parts();- let DevToolsCommandResult::LayoutMetrics(layout_metrics) =+ let AutomationResult::LayoutMetrics(layout_metrics) =layout_result.expect("target layout metrics should succeed")else {panic!("expected layout metrics result");@@ -928,30 +943,32 @@ async fn devtools_command_executes_context_viewport_override() {}#[tokio::test]-async fn devtools_command_executes_navigation_history_and_traverse() {+async fn automation_command_executes_navigation_history_and_traverse() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from("classic-session-1")),target_id: None,browser_context_id: None,};let (create_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");};let target_id = create_result.target_id;- let target_context = DevToolsCommandContext {+ let target_context = AutomationContext {target_id: Some(target_id.clone()),..context};@@ -960,7 +977,7 @@ async fn devtools_command_executes_navigation_history_and_traverse() {for url in [&first_url, &second_url] {let (navigate_result, _, _, _) = conn- .execute_devtools_command(DevToolsCommand::Navigate(DevToolsNavigateCommand {+ .execute_automation_command(AutomationCommand::Navigate(DevToolsNavigateCommand {context: target_context.clone(),url: (*url).clone(),referrer: None,@@ -972,14 +989,14 @@ async fn devtools_command_executes_navigation_history_and_traverse() {}let (history_result, _) = conn- .execute_devtools_command(DevToolsCommand::GetNavigationHistory(+ .execute_automation_command(AutomationCommand::GetNavigationHistory(DevToolsGetNavigationHistoryCommand {context: target_context.clone(),},)).await.into_parts();- let DevToolsCommandResult::GetNavigationHistory(history) =+ let AutomationResult::GetNavigationHistory(history) =history_result.expect("history should succeed")else {panic!("expected navigation history result");@@ -989,7 +1006,7 @@ async fn devtools_command_executes_navigation_history_and_traverse() {let previous = history.entries[history.current_index - 1].clone();let (traverse_result, _, _, _) = conn- .execute_devtools_command(DevToolsCommand::TraverseHistory(+ .execute_automation_command(AutomationCommand::TraverseHistory(DevToolsTraverseHistoryCommand {context: target_context.clone(),destination: DevToolsHistoryTraversalDestination::Entry {@@ -1003,20 +1020,20 @@ async fn devtools_command_executes_navigation_history_and_traverse() {.into_complete_parts();assert!(matches!(traverse_result.expect("traverse should succeed"),- DevToolsCommandResult::TraverseHistory(DevToolsTraverseHistoryResult {+ AutomationResult::TraverseHistory(DevToolsTraverseHistoryResult {same_document: false})));let (history_result, _) = conn- .execute_devtools_command(DevToolsCommand::GetNavigationHistory(+ .execute_automation_command(AutomationCommand::GetNavigationHistory(DevToolsGetNavigationHistoryCommand {context: target_context.clone(),},)).await.into_parts();- let DevToolsCommandResult::GetNavigationHistory(history) =+ let AutomationResult::GetNavigationHistory(history) =history_result.expect("history after traverse should succeed")else {panic!("expected navigation history result after traverse");@@ -1024,7 +1041,7 @@ async fn devtools_command_executes_navigation_history_and_traverse() {assert_eq!(history.entries[history.current_index].id, previous.id);let (delta_result, _, _, _) = conn- .execute_devtools_command(DevToolsCommand::TraverseHistory(+ .execute_automation_command(AutomationCommand::TraverseHistory(DevToolsTraverseHistoryCommand {context: target_context.clone(),destination: DevToolsHistoryTraversalDestination::Delta(1),@@ -1035,20 +1052,20 @@ async fn devtools_command_executes_navigation_history_and_traverse() {.into_complete_parts();assert!(matches!(delta_result.expect("delta traverse should succeed"),- DevToolsCommandResult::TraverseHistory(DevToolsTraverseHistoryResult {+ AutomationResult::TraverseHistory(DevToolsTraverseHistoryResult {same_document: false})));let (history_result, _) = conn- .execute_devtools_command(DevToolsCommand::GetNavigationHistory(+ .execute_automation_command(AutomationCommand::GetNavigationHistory(DevToolsGetNavigationHistoryCommand {context: target_context.clone(),},)).await.into_parts();- let DevToolsCommandResult::GetNavigationHistory(history) =+ let AutomationResult::GetNavigationHistory(history) =history_result.expect("history after delta traverse should succeed")else {panic!("expected navigation history result after delta traverse");@@ -1056,7 +1073,7 @@ async fn devtools_command_executes_navigation_history_and_traverse() {assert_eq!(history.entries[history.current_index].url, second_url);let (out_of_range_result, _) = conn- .execute_devtools_command(DevToolsCommand::TraverseHistory(+ .execute_automation_command(AutomationCommand::TraverseHistory(DevToolsTraverseHistoryCommand {context: target_context,destination: DevToolsHistoryTraversalDestination::Delta(1),diff --git a/moli-protocol/src/conn/dispatch_tests/runtime.rs b/moli-protocol/src/conn/dispatch_tests/runtime.rsindex 9d8b9bb37..f6149684c 100644--- a/moli-protocol/src/conn/dispatch_tests/runtime.rs+++ b/moli-protocol/src/conn/dispatch_tests/runtime.rs@@ -22,15 +22,15 @@ async fn devtools_runtime_call_function_popup_activity_drains_from_protocol_neut.runtime_slot.set_loaded_page_for_test(page);- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("SID-neutral-popup-opener")),target_id: Some(DevToolsTargetId::from("TID-neutral-popup-opener")),browser_context_id: None,};let (call_result, scheduler_events, protocol_events, renderer_output_predecessor) = ctx.conn- .execute_devtools_command_with_protocol_events(DevToolsCommand::CallFunction(+ .execute_automation_command_with_protocol_events(AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context,realm_id: None,@@ -83,11 +83,11 @@ async fn devtools_runtime_call_function_popup_activity_drains_from_protocol_neut.expect("popup target id").to_owned();let popup_url = "data:text/html,<main>neutral popup</main>".to_owned();- let popup_navigate = execute_direct_devtools_command_through_renderer_fence_for_test(+ let popup_navigate = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::Navigate(DevToolsNavigateCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ AutomationCommand::Navigate(DevToolsNavigateCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("SID-neutral-popup-opener")),target_id: Some(DevToolsTargetId::from(popup_target_id.clone())),browser_context_id: None,@@ -99,11 +99,11 @@ async fn devtools_runtime_call_function_popup_activity_drains_from_protocol_neut).await;popup_navigate.expect("popup target navigate should load inline document");- let popup_eval_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let popup_eval_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::EvaluateScript(DevToolsEvaluateScriptCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("SID-neutral-popup-opener")),target_id: Some(DevToolsTargetId::from(popup_target_id)),browser_context_id: None,@@ -131,8 +131,8 @@ async fn devtools_runtime_call_function_popup_activity_drains_from_protocol_neut#[tokio::test]async fn devtools_runtime_command_uses_background_initial_document_without_resolver_fallback() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from("classic-session-1")),target_id: None,browser_context_id: None,@@ -141,14 +141,14 @@ async fn devtools_runtime_command_uses_background_initial_document_without_resollet (first_result, _) =crate::domains::target::execute_immediate_devtools_target_command_with_protocol_events(&mut conn,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: context.clone(),url: "about:blank".to_owned(),browser_context_id: None,activate: false,}),);- let DevToolsCommandResult::CreateTarget(first_result) =+ let AutomationResult::CreateTarget(first_result) =first_result.expect("initial target create should succeed")else {panic!("expected create target result");@@ -157,15 +157,17 @@ async fn devtools_runtime_command_uses_background_initial_document_without_resolensure_initial_document_for_target_id_for_test(&mut conn, &first_target_id).await;let (second_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank#background".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank#background".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(second_result) =+ let AutomationResult::CreateTarget(second_result) =second_result.expect("background target create should succeed")else {panic!("expected create target result");@@ -206,27 +208,29 @@ async fn devtools_runtime_command_uses_background_initial_document_without_resol);let (name_result, _) = conn- .execute_devtools_command(DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {- context: DevToolsCommandContext {- target_id: Some(second_target_id.clone()),- ..context.clone()+ .execute_automation_command(AutomationCommand::CallFunction(+ DevToolsCallFunctionCommand {+ context: AutomationContext {+ target_id: Some(second_target_id.clone()),+ ..context.clone()+ },+ realm_id: None,+ world_name: None,+ object_id: None,+ this_parameter: None,+ function_declaration:+ "function() { return [location.href, window.name, window.opener]; }".to_owned(),+ arguments: Vec::new(),+ await_promise: true,+ user_gesture: false,+ webdriver_bidi_file_prompt_handler: None,+ result_ownership: DevToolsResultOwnership::None,+ object_group: None,+ preserve_remote_metadata: false,+ materialize_bidi_script_result: false,+ serialization_options: None,},- realm_id: None,- world_name: None,- object_id: None,- this_parameter: None,- function_declaration:- "function() { return [location.href, window.name, window.opener]; }".to_owned(),- arguments: Vec::new(),- await_promise: true,- user_gesture: false,- webdriver_bidi_file_prompt_handler: None,- result_ownership: DevToolsResultOwnership::None,- object_group: None,- preserve_remote_metadata: false,- materialize_bidi_script_result: false,- serialization_options: None,- }))+ )).await.into_parts();let name_result = expect_script_value_result(@@ -239,9 +243,9 @@ async fn devtools_runtime_command_uses_background_initial_document_without_resol);let (surface_result, _) = conn- .execute_devtools_command(DevToolsCommand::EvaluateScript(+ .execute_automation_command(AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {- context: DevToolsCommandContext {+ context: AutomationContext {target_id: Some(second_target_id.clone()),..context.clone()},@@ -298,8 +302,8 @@ async fn devtools_runtime_command_uses_background_initial_document_without_resolasync fn pending_runtime_binding_page_phase_keeps_background_owner_route_across_completion() {let mut ctx = crate::testing::TestContext::from_conn(CdpConnection::new());let conn = &mut ctx.conn;- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-binding-owner-route")),target_id: None,browser_context_id: None,@@ -308,14 +312,14 @@ async fn pending_runtime_binding_page_phase_keeps_background_owner_route_across_let (first_result, _) =crate::domains::target::execute_immediate_devtools_target_command_with_protocol_events(conn,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: context.clone(),url: "about:blank".to_owned(),browser_context_id: None,activate: false,}),);- let DevToolsCommandResult::CreateTarget(first_result) =+ let AutomationResult::CreateTarget(first_result) =first_result.expect("initial target create should succeed")else {panic!("expected create target result");@@ -324,15 +328,17 @@ async fn pending_runtime_binding_page_phase_keeps_background_owner_route_across_ensure_initial_document_for_target_id_for_test(conn, &first_target_id).await;let (second_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(second_result) =+ let AutomationResult::CreateTarget(second_result) =second_result.expect("background target create should succeed")else {panic!("expected create target result");@@ -340,11 +346,11 @@ async fn pending_runtime_binding_page_phase_keeps_background_owner_route_across_let second_target_id = second_result.target_id;ensure_initial_document_for_target_id_for_test(conn, &second_target_id).await;- let first_context = DevToolsCommandContext {+ let first_context = AutomationContext {target_id: Some(first_target_id.clone()),..context.clone()};- let second_context = DevToolsCommandContext {+ let second_context = AutomationContext {target_id: Some(second_target_id.clone()),..context};@@ -417,8 +423,8 @@ async fn pending_runtime_binding_page_phase_keeps_background_owner_route_across_#[tokio::test]async fn runtime_enable_uses_background_initial_document_through_attached_session() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-runtime-enable-normal-route")),target_id: None,browser_context_id: None,@@ -427,14 +433,14 @@ async fn runtime_enable_uses_background_initial_document_through_attached_sessiolet (first_result, _) =crate::domains::target::execute_immediate_devtools_target_command_with_protocol_events(&mut conn,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: context.clone(),url: "about:blank".to_owned(),browser_context_id: None,activate: false,}),);- let DevToolsCommandResult::CreateTarget(first_result) =+ let AutomationResult::CreateTarget(first_result) =first_result.expect("initial target create should succeed")else {panic!("expected create target result");@@ -444,14 +450,14 @@ async fn runtime_enable_uses_background_initial_document_through_attached_sessiolet (second_result, _) =crate::domains::target::execute_immediate_devtools_target_command_with_protocol_events(&mut conn,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context,url: "about:blank".to_owned(),browser_context_id: None,activate: false,}),);- let DevToolsCommandResult::CreateTarget(second_result) =+ let AutomationResult::CreateTarget(second_result) =second_result.expect("background target create should succeed")else {panic!("expected create target result");@@ -533,23 +539,25 @@ async fn runtime_enable_uses_background_initial_document_through_attached_sessio#[tokio::test]async fn devtools_get_realms_observes_create_target_initial_about_blank_page() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (create_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: true,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: true,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");@@ -568,8 +576,8 @@ async fn devtools_get_realms_observes_create_target_initial_about_blank_page() {);let (realms_result, _) = conn- .execute_devtools_command(DevToolsCommand::GetRealms(DevToolsGetRealmsCommand {- context: DevToolsCommandContext {+ .execute_automation_command(AutomationCommand::GetRealms(DevToolsGetRealmsCommand {+ context: AutomationContext {target_id: Some(create_result.target_id.clone()),..context},@@ -577,7 +585,7 @@ async fn devtools_get_realms_observes_create_target_initial_about_blank_page() {})).await.into_parts();- let DevToolsCommandResult::Realms(realms_result) =+ let AutomationResult::Realms(realms_result) =realms_result.expect("getRealms should observe initial about:blank")else {panic!("expected realms result");@@ -623,9 +631,9 @@ async fn devtools_get_realms_succeeds_when_page_loaded_before_session_attach() {.attach_active_session("SID-late-realms".to_owned());let (realms_result, _) = conn- .execute_devtools_command(DevToolsCommand::GetRealms(DevToolsGetRealmsCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ .execute_automation_command(AutomationCommand::GetRealms(DevToolsGetRealmsCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("SID-late-realms")),target_id: Some(DevToolsTargetId::from("TID-late-realms")),browser_context_id: None,@@ -634,7 +642,7 @@ async fn devtools_get_realms_succeeds_when_page_loaded_before_session_attach() {})).await.into_parts();- let DevToolsCommandResult::Realms(realms_result) =+ let AutomationResult::Realms(realms_result) =realms_result.expect("getRealms should not fail when realm uniqueId was never captured")else {panic!("expected realms result");@@ -652,32 +660,34 @@ async fn devtools_get_realms_succeeds_when_page_loaded_before_session_attach() {#[tokio::test]async fn devtools_runtime_evaluate_uses_fresh_initial_document_without_resolver_fallback() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (create_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: true,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: true,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");};let (evaluate_result, _) = conn- .execute_devtools_command(DevToolsCommand::EvaluateScript(+ .execute_automation_command(AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {- context: DevToolsCommandContext {+ context: AutomationContext {target_id: Some(create_result.target_id.clone()),..context},@@ -712,10 +722,10 @@ async fn devtools_runtime_evaluate_reports_no_document_without_resolver_fallbackconn.install_browser_context_fixture_for_test(browser_context);let (evaluate_result, _) = conn- .execute_devtools_command(DevToolsCommand::EvaluateScript(+ .execute_automation_command(AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("SID-no-page-runtime")),target_id: Some(DevToolsTargetId::from("TID-no-page-runtime")),browser_context_id: None,@@ -750,31 +760,33 @@ async fn devtools_runtime_evaluate_reports_no_document_without_resolver_fallback#[tokio::test]async fn devtools_runtime_call_function_channel_does_not_emit_direct_script_message_sidecar() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (create_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");};- let target_context = DevToolsCommandContext {+ let target_context = AutomationContext {target_id: Some(create_result.target_id.clone()),..context};- conn.execute_devtools_command(DevToolsCommand::Navigate(DevToolsNavigateCommand {+ conn.execute_automation_command(AutomationCommand::Navigate(DevToolsNavigateCommand {context: target_context.clone(),url: "data:text/html,bidi-script-channel".to_owned(),referrer: None,@@ -786,28 +798,30 @@ async fn devtools_runtime_call_function_channel_does_not_emit_direct_script_mess.expect("navigate should succeed before script message channel call");let call = conn- .execute_devtools_command(DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {- context: target_context.clone(),- realm_id: None,- world_name: None,- object_id: None,- this_parameter: None,- function_declaration: "(channel) => channel('foo')".to_owned(),- arguments: vec![json!({- "type": "channel",- "value": {- "channel": "channel_name"- }- })],- await_promise: false,- user_gesture: false,- webdriver_bidi_file_prompt_handler: None,- result_ownership: DevToolsResultOwnership::None,- object_group: None,- preserve_remote_metadata: false,- materialize_bidi_script_result: false,- serialization_options: None,- }))+ .execute_automation_command(AutomationCommand::CallFunction(+ DevToolsCallFunctionCommand {+ context: target_context.clone(),+ realm_id: None,+ world_name: None,+ object_id: None,+ this_parameter: None,+ function_declaration: "(channel) => channel('foo')".to_owned(),+ arguments: vec![json!({+ "type": "channel",+ "value": {+ "channel": "channel_name"+ }+ })],+ await_promise: false,+ user_gesture: false,+ webdriver_bidi_file_prompt_handler: None,+ result_ownership: DevToolsResultOwnership::None,+ object_group: None,+ preserve_remote_metadata: false,+ materialize_bidi_script_result: false,+ serialization_options: None,+ },+ )).await;let (call_result, _, protocol_events, _renderer_output_predecessor) =call.into_complete_parts();diff --git a/moli-protocol/src/conn/dispatch_tests/storage.rs b/moli-protocol/src/conn/dispatch_tests/storage.rsindex 9abdb081d..a00333642 100644--- a/moli-protocol/src/conn/dispatch_tests/storage.rs+++ b/moli-protocol/src/conn/dispatch_tests/storage.rs@@ -1,36 +1,38 @@use super::*;#[tokio::test]-async fn devtools_command_executes_storage_cookie_commands_for_webdriver_context() {+async fn automation_command_executes_storage_cookie_commands_for_webdriver_context() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from("classic-session-1")),target_id: None,browser_context_id: None,};let (create_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");};- let target_context = DevToolsCommandContext {+ let target_context = AutomationContext {target_id: Some(create_result.target_id),..context};let cookie_url = "https://example.com/path".to_owned();let (set_result, set_events) = conn- .execute_devtools_command(DevToolsCommand::SetCookies(DevToolsSetCookiesCommand {+ .execute_automation_command(AutomationCommand::SetCookies(DevToolsSetCookiesCommand {context: target_context.clone(),browser_context_id: None,cookies: vec![DevToolsCookieParam {@@ -56,15 +58,14 @@ async fn devtools_command_executes_storage_cookie_commands_for_webdriver_contextset_events.is_empty(),"direct storage setCookies must not emit CDP-shaped sidecar messages: {set_events:?}");- let DevToolsCommandResult::SetCookies(set_result) =- set_result.expect("set cookies should succeed")+ let AutomationResult::SetCookies(set_result) = set_result.expect("set cookies should succeed")else {panic!("expected set cookies result");};assert!(set_result.success);let (get_result, get_events) = conn- .execute_devtools_command(DevToolsCommand::GetCookies(DevToolsGetCookiesCommand {+ .execute_automation_command(AutomationCommand::GetCookies(DevToolsGetCookiesCommand {context: target_context.clone(),browser_context_id: None,urls: Some(vec![cookie_url.clone()]),@@ -76,8 +77,7 @@ async fn devtools_command_executes_storage_cookie_commands_for_webdriver_contextget_events.is_empty(),"direct storage getCookies must not emit CDP-shaped sidecar messages: {get_events:?}");- let DevToolsCommandResult::GetCookies(get_result) =- get_result.expect("get cookies should succeed")+ let AutomationResult::GetCookies(get_result) = get_result.expect("get cookies should succeed")else {panic!("expected get cookies result");};@@ -86,7 +86,7 @@ async fn devtools_command_executes_storage_cookie_commands_for_webdriver_contextassert_eq!(get_result.cookies[0]["value"], json!("abc"));let (delete_result, delete_events) = conn- .execute_devtools_command(DevToolsCommand::DeleteCookies(+ .execute_automation_command(AutomationCommand::DeleteCookies(DevToolsDeleteCookiesCommand {context: target_context.clone(),browser_context_id: None,@@ -106,11 +106,11 @@ async fn devtools_command_executes_storage_cookie_commands_for_webdriver_context);assert!(matches!(delete_result.expect("delete cookie should succeed"),- DevToolsCommandResult::DeleteCookies(_)+ AutomationResult::DeleteCookies(_)));let (after_delete, after_delete_events) = conn- .execute_devtools_command(DevToolsCommand::GetCookies(DevToolsGetCookiesCommand {+ .execute_automation_command(AutomationCommand::GetCookies(DevToolsGetCookiesCommand {context: target_context,browser_context_id: None,urls: Some(vec![cookie_url]),@@ -122,7 +122,7 @@ async fn devtools_command_executes_storage_cookie_commands_for_webdriver_contextafter_delete_events.is_empty(),"direct storage getCookies after delete must not emit CDP-shaped sidecar messages: {after_delete_events:?}");- let DevToolsCommandResult::GetCookies(after_delete) =+ let AutomationResult::GetCookies(after_delete) =after_delete.expect("get cookies after delete should succeed")else {panic!("expected get cookies result");diff --git a/moli-protocol/src/conn/dispatch_tests/target.rs b/moli-protocol/src/conn/dispatch_tests/target.rsindex 375b25750..e0c9fb8f2 100644--- a/moli-protocol/src/conn/dispatch_tests/target.rs+++ b/moli-protocol/src/conn/dispatch_tests/target.rs@@ -1,26 +1,28 @@use super::*;#[tokio::test]-async fn devtools_command_executes_target_create_and_get_targets() {+async fn automation_command_executes_target_create_and_get_targets() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let create = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await;let (create_result, create_events) = create.into_parts();assert!(create_events.is_empty());- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");@@ -28,7 +30,7 @@ async fn devtools_command_executes_target_create_and_get_targets() {assert_eq!(create_result.target_id.as_str(), "TID-1");let get_targets = conn- .execute_devtools_command(DevToolsCommand::GetTargets(DevToolsGetTargetsCommand {+ .execute_automation_command(AutomationCommand::GetTargets(DevToolsGetTargetsCommand {context,root: Some(create_result.target_id.clone()),max_depth: None,@@ -37,7 +39,7 @@ async fn devtools_command_executes_target_create_and_get_targets() {.await;let (get_targets_result, get_targets_events) = get_targets.into_parts();assert!(get_targets_events.is_empty());- let DevToolsCommandResult::GetTargets(get_targets_result) =+ let AutomationResult::GetTargets(get_targets_result) =get_targets_result.expect("get targets should succeed")else {panic!("expected get targets result");@@ -64,17 +66,19 @@ async fn devtools_create_target_rejects_unknown_reference_target() {conn.insert_browser_context(default_context);let (create_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,- session_id: Some(DevToolsSessionId::from("bidi-session-1")),- target_id: Some(DevToolsTargetId::from("TID-missing")),+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,+ session_id: Some(DevToolsSessionId::from("bidi-session-1")),+ target_id: Some(DevToolsTargetId::from("TID-missing")),+ browser_context_id: None,+ },+ url: "about:blank".to_owned(),browser_context_id: None,+ activate: true,},- url: "about:blank".to_owned(),- browser_context_id: None,- activate: true,- }))+ )).await.into_parts();let error = create_result.expect_err("unknown reference context should fail");@@ -82,23 +86,25 @@ async fn devtools_create_target_rejects_unknown_reference_target() {}#[tokio::test]-async fn devtools_command_preserves_target_create_typed_sidecar() {+async fn automation_command_preserves_target_create_typed_sidecar() {let mut conn = CdpConnection::new();conn.set_root_target_discovery_enabled(true);- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (result, scheduler_events, mut protocol_events) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts_with_protocol_events();@@ -113,21 +119,21 @@ async fn devtools_command_preserves_target_create_typed_sidecar() {}#[tokio::test]-async fn devtools_command_preserves_target_close_detached_typed_sidecar() {+async fn automation_command_preserves_target_close_detached_typed_sidecar() {let mut conn = CdpConnection::new();let mut browser_context = BrowserContext::new("BID-close-sidecar".to_owned());browser_context.set_active_target_id("TID-close-sidecar".to_owned());browser_context.attach_active_session("SID-close-sidecar".to_owned());conn.install_browser_context_fixture_for_test(browser_context);- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: Some(DevToolsTargetId::from("TID-close-sidecar")),browser_context_id: None,};let (result, scheduler_events, protocol_events) = conn- .execute_devtools_command_with_protocol_events(DevToolsCommand::CloseTarget(+ .execute_automation_command_with_protocol_events(AutomationCommand::CloseTarget(DevToolsCloseTargetCommand {context,target_id: DevToolsTargetId::from("TID-close-sidecar"),@@ -139,7 +145,7 @@ async fn devtools_command_preserves_target_close_detached_typed_sidecar() {assert!(scheduler_events.is_empty());assert_eq!(result.expect("close target should succeed"),- DevToolsCommandResult::CloseTarget(crate::devtools_runtime::DevToolsCloseTargetResult {+ AutomationResult::CloseTarget(crate::automation::DevToolsCloseTargetResult {success: true,}));@@ -164,29 +170,31 @@ async fn devtools_command_preserves_target_close_detached_typed_sidecar() {}#[tokio::test]-async fn devtools_command_executes_target_pending_activate_and_close() {+async fn automation_command_executes_target_pending_activate_and_close() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};for _ in 0..2 {let (result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts();result.expect("create target should succeed");}let (activate_result, _) = conn- .execute_devtools_command(DevToolsCommand::ActivateTarget(+ .execute_automation_command(AutomationCommand::ActivateTarget(DevToolsActivateTargetCommand {context: context.clone(),target_id: DevToolsTargetId::from("TID-2"),@@ -196,25 +204,24 @@ async fn devtools_command_executes_target_pending_activate_and_close() {.into_parts();assert_eq!(activate_result.expect("activate should succeed"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);let (close_result, _) = conn- .execute_devtools_command(DevToolsCommand::CloseTarget(DevToolsCloseTargetCommand {+ .execute_automation_command(AutomationCommand::CloseTarget(DevToolsCloseTargetCommand {context: context.clone(),target_id: DevToolsTargetId::from("TID-2"),})).await.into_parts();- let DevToolsCommandResult::CloseTarget(close_result) =- close_result.expect("close should succeed")+ let AutomationResult::CloseTarget(close_result) = close_result.expect("close should succeed")else {panic!("expected close target result");};assert!(close_result.success);let (remaining_result, _) = conn- .execute_devtools_command(DevToolsCommand::GetTargets(DevToolsGetTargetsCommand {+ .execute_automation_command(AutomationCommand::GetTargets(DevToolsGetTargetsCommand {context,root: Some(DevToolsTargetId::from("TID-2")),max_depth: None,@@ -222,7 +229,7 @@ async fn devtools_command_executes_target_pending_activate_and_close() {})).await.into_parts();- let DevToolsCommandResult::GetTargets(remaining_result) =+ let AutomationResult::GetTargets(remaining_result) =remaining_result.expect("get targets should succeed")else {panic!("expected get targets result");@@ -233,8 +240,8 @@ async fn devtools_command_executes_target_pending_activate_and_close() {#[tokio::test]async fn target_lifecycle_ensure_installs_initial_about_blank_page_for_active_target() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-lifecycle-active")),target_id: None,browser_context_id: None,@@ -243,14 +250,14 @@ async fn target_lifecycle_ensure_installs_initial_about_blank_page_for_active_talet (create_result, _) =crate::domains::target::execute_immediate_devtools_target_command_with_protocol_events(&mut conn,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context,url: "about:blank".to_owned(),browser_context_id: None,activate: true,}),);- let DevToolsCommandResult::CreateTarget(_) =+ let AutomationResult::CreateTarget(_) =create_result.expect("active target create should succeed")else {panic!("expected create target result");@@ -306,8 +313,8 @@ async fn target_lifecycle_ensure_installs_initial_about_blank_page_for_active_ta#[tokio::test]async fn target_lifecycle_ensure_installs_initial_about_blank_page_for_background_target() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-lifecycle-background")),target_id: None,browser_context_id: None,@@ -316,14 +323,14 @@ async fn target_lifecycle_ensure_installs_initial_about_blank_page_for_backgrounlet (first_result, _) =crate::domains::target::execute_immediate_devtools_target_command_with_protocol_events(&mut conn,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: context.clone(),url: "about:blank".to_owned(),browser_context_id: None,activate: false,}),);- let DevToolsCommandResult::CreateTarget(first_result) =+ let AutomationResult::CreateTarget(first_result) =first_result.expect("initial target create should succeed")else {panic!("expected create target result");@@ -333,14 +340,14 @@ async fn target_lifecycle_ensure_installs_initial_about_blank_page_for_backgrounlet (second_result, _) =crate::domains::target::execute_immediate_devtools_target_command_with_protocol_events(&mut conn,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context,url: "about:blank".to_owned(),browser_context_id: None,activate: false,}),);- let DevToolsCommandResult::CreateTarget(second_result) =+ let AutomationResult::CreateTarget(second_result) =second_result.expect("background target create should succeed")else {panic!("expected create target result");@@ -388,23 +395,25 @@ async fn target_lifecycle_ensure_installs_initial_about_blank_page_for_backgroun#[tokio::test]async fn classic_create_target_ensures_fresh_initial_document_without_resolver_fallback() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from("classic-session-1")),target_id: None,browser_context_id: None,};let (create_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("classic create target should succeed")else {panic!("expected create target result");@@ -418,9 +427,9 @@ async fn classic_create_target_ensures_fresh_initial_document_without_resolver_f);let (evaluate_result, _) = conn- .execute_devtools_command(DevToolsCommand::EvaluateScript(+ .execute_automation_command(AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {- context: DevToolsCommandContext {+ context: AutomationContext {target_id: Some(create_result.target_id.clone()),..context},@@ -448,23 +457,25 @@ async fn classic_create_target_ensures_fresh_initial_document_without_resolver_f#[tokio::test]async fn devtools_create_target_can_activate_created_target() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (first_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: false,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: false,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(first_result) =+ let AutomationResult::CreateTarget(first_result) =first_result.expect("first create target should succeed")else {panic!("expected first create target result");@@ -472,8 +483,8 @@ async fn devtools_create_target_can_activate_created_target() {let first_target_id = first_result.target_id.clone();let (first_navigate, _, _, _) = conn- .execute_devtools_command(DevToolsCommand::Navigate(DevToolsNavigateCommand {- context: DevToolsCommandContext {+ .execute_automation_command(AutomationCommand::Navigate(DevToolsNavigateCommand {+ context: AutomationContext {target_id: Some(first_target_id.clone()),..context.clone()},@@ -486,15 +497,17 @@ async fn devtools_create_target_can_activate_created_target() {first_navigate.expect("first navigate should succeed");let (second_result, _) = conn- .execute_devtools_command(DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {- context: context.clone(),- url: "about:blank".to_owned(),- browser_context_id: None,- activate: true,- }))+ .execute_automation_command(AutomationCommand::CreateTarget(+ DevToolsCreateTargetCommand {+ context: context.clone(),+ url: "about:blank".to_owned(),+ browser_context_id: None,+ activate: true,+ },+ )).await.into_parts();- let DevToolsCommandResult::CreateTarget(second_result) =+ let AutomationResult::CreateTarget(second_result) =second_result.expect("second create target should succeed")else {panic!("expected second create target result");@@ -522,8 +535,8 @@ async fn devtools_create_target_can_activate_created_target() {);let (first_realms_before_second_navigation, _) = conn- .execute_devtools_command(DevToolsCommand::GetRealms(DevToolsGetRealmsCommand {- context: DevToolsCommandContext {+ .execute_automation_command(AutomationCommand::GetRealms(DevToolsGetRealmsCommand {+ context: AutomationContext {target_id: Some(first_target_id.clone()),..context.clone()},@@ -534,8 +547,8 @@ async fn devtools_create_target_can_activate_created_target() {first_realms_before_second_navigation.expect("deactivated first target realms should remain readable before second navigation");let (second_navigate, _, _, _) = conn- .execute_devtools_command(DevToolsCommand::Navigate(DevToolsNavigateCommand {- context: DevToolsCommandContext {+ .execute_automation_command(AutomationCommand::Navigate(DevToolsNavigateCommand {+ context: AutomationContext {target_id: Some(second_target_id.clone()),..context.clone()},@@ -548,8 +561,8 @@ async fn devtools_create_target_can_activate_created_target() {second_navigate.expect("second navigate should succeed");let (first_realms, _) = conn- .execute_devtools_command(DevToolsCommand::GetRealms(DevToolsGetRealmsCommand {- context: DevToolsCommandContext {+ .execute_automation_command(AutomationCommand::GetRealms(DevToolsGetRealmsCommand {+ context: AutomationContext {target_id: Some(first_target_id.clone()),..context.clone()},@@ -557,7 +570,7 @@ async fn devtools_create_target_can_activate_created_target() {})).await.into_parts();- let DevToolsCommandResult::Realms(first_realms) =+ let AutomationResult::Realms(first_realms) =first_realms.expect("deactivated first target realms should remain readable")else {panic!("expected realms result");@@ -570,13 +583,13 @@ async fn devtools_create_target_can_activate_created_target() {);let (all_realms, _) = conn- .execute_devtools_command(DevToolsCommand::GetRealms(DevToolsGetRealmsCommand {+ .execute_automation_command(AutomationCommand::GetRealms(DevToolsGetRealmsCommand {context,realm_type: Some("window".to_owned()),})).await.into_parts();- let DevToolsCommandResult::Realms(all_realms) =+ let AutomationResult::Realms(all_realms) =all_realms.expect("all-context getRealms should enumerate active and background targets")else {panic!("expected realms result");@@ -608,18 +621,18 @@ async fn devtools_create_target_can_activate_created_target() {}#[tokio::test]-async fn devtools_command_dispatches_coordinate_mouse_input_for_target() {+async fn automation_command_dispatches_coordinate_mouse_input_for_target() {let mut ctx =crate::testing::TestContext::from_conn(crate::testing::real_layout_test_connection());- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from("classic-session-1")),target_id: None,browser_context_id: None,};- let create_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let create_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: context.clone(),url: "about:blank".to_owned(),browser_context_id: None,@@ -627,17 +640,17 @@ async fn devtools_command_dispatches_coordinate_mouse_input_for_target() {}),).await;- let DevToolsCommandResult::CreateTarget(create_result) =+ let AutomationResult::CreateTarget(create_result) =create_result.expect("create target should succeed")else {panic!("expected create target result");};let target_id = create_result.target_id.clone();let url = "data:text/html,<body style='margin:0'><button style='width:80px;height:80px' onclick='window.__clicked = true'>go</button></body>";- execute_direct_devtools_command_through_renderer_fence_for_test(+ execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::Navigate(DevToolsNavigateCommand {- context: DevToolsCommandContext {+ AutomationCommand::Navigate(DevToolsNavigateCommand {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -649,10 +662,10 @@ async fn devtools_command_dispatches_coordinate_mouse_input_for_target() {.await.expect("navigation should succeed");- execute_direct_devtools_command_through_renderer_fence_for_test(+ execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::CaptureScreenshot(DevToolsCaptureScreenshotCommand {- context: DevToolsCommandContext {+ AutomationCommand::CaptureScreenshot(DevToolsCaptureScreenshotCommand {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -670,10 +683,10 @@ async fn devtools_command_dispatches_coordinate_mouse_input_for_target() {(DevToolsMouseEventType::Pressed, Some(1)),(DevToolsMouseEventType::Released, Some(0)),] {- let result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::DispatchMouseEvent(DevToolsDispatchMouseEventCommand {- context: DevToolsCommandContext {+ AutomationCommand::DispatchMouseEvent(DevToolsDispatchMouseEventCommand {+ context: AutomationContext {target_id: Some(target_id.clone()),..context.clone()},@@ -696,15 +709,15 @@ async fn devtools_command_dispatches_coordinate_mouse_input_for_target() {).await;assert!(- matches!(result, Ok(DevToolsCommandResult::Empty)),+ matches!(result, Ok(AutomationResult::Empty)),"coordinate mouse dispatch should complete through the target renderer: {result:?}");}- let clicked_result = execute_direct_devtools_command_through_renderer_fence_for_test(+ let clicked_result = execute_direct_automation_command_through_renderer_fence_for_test(&mut ctx,- DevToolsCommand::EvaluateScript(DevToolsEvaluateScriptCommand {- context: DevToolsCommandContext {+ AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {+ context: AutomationContext {target_id: Some(target_id),..context},@@ -729,17 +742,17 @@ async fn devtools_command_dispatches_coordinate_mouse_input_for_target() {}#[tokio::test]-async fn devtools_command_executes_default_preload_add_and_remove_without_loaded_target() {+async fn automation_command_executes_default_preload_add_and_remove_without_loaded_target() {let mut conn = CdpConnection::new();- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,};let (add_result, _) = conn- .execute_devtools_command(DevToolsCommand::AddPreloadScript(+ .execute_automation_command(AutomationCommand::AddPreloadScript(DevToolsAddPreloadScriptCommand {context: context.clone(),source: DevToolsPreloadScriptSource::FunctionDeclaration {@@ -756,7 +769,7 @@ async fn devtools_command_executes_default_preload_add_and_remove_without_loaded)).await.into_parts();- let DevToolsCommandResult::AddPreloadScript(add_result) =+ let AutomationResult::AddPreloadScript(add_result) =add_result.expect("default addPreloadScript should succeed")else {panic!("expected add preload script result");@@ -773,7 +786,7 @@ async fn devtools_command_executes_default_preload_add_and_remove_without_loadedassert_eq!(browser_context.default_document_start_scripts.len(), 1);let (remove_result, _) = conn- .execute_devtools_command(DevToolsCommand::RemovePreloadScript(+ .execute_automation_command(AutomationCommand::RemovePreloadScript(DevToolsRemovePreloadScriptCommand {context: context.clone(),script_id: add_result.script_id.clone(),@@ -783,7 +796,7 @@ async fn devtools_command_executes_default_preload_add_and_remove_without_loaded.into_parts();assert_eq!(remove_result.expect("default removePreloadScript should succeed"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);assert!(conn.browser_context@@ -795,7 +808,7 @@ async fn devtools_command_executes_default_preload_add_and_remove_without_loaded);let (remove_again_result, _) = conn- .execute_devtools_command(DevToolsCommand::RemovePreloadScript(+ .execute_automation_command(AutomationCommand::RemovePreloadScript(DevToolsRemovePreloadScriptCommand {context,script_id: add_result.script_id,diff --git a/moli-protocol/src/conn/downloads.rs b/moli-protocol/src/conn/downloads.rsindex b27baf96e..d0d6177f2 100644--- a/moli-protocol/src/conn/downloads.rs+++ b/moli-protocol/src/conn/downloads.rs@@ -1505,11 +1505,11 @@ mod tests {use moli_fetch::FetchCancelHandle;use crate::{+ automation::AutomationEvent,conn::{BackgroundProtocolEvent, BrowserContext, CdpConnection, CommandOwnerScope,PageTargetHost,},- devtools_runtime::AutomationEvent,};use super::{diff --git a/moli-protocol/src/conn/fetch_support.rs b/moli-protocol/src/conn/fetch_support.rsindex 210575b33..d0eac91d3 100644--- a/moli-protocol/src/conn/fetch_support.rs+++ b/moli-protocol/src/conn/fetch_support.rs@@ -9,7 +9,7 @@ use super::{CapturedBody, CapturedBodyWriter, CdpConnection, CommandOwnerScope, DocumentNavigationToken,NavigationDispatchState, NavigationLoadOutcome,};-use crate::devtools_runtime::{DevToolsNetworkInterceptId, DevToolsNetworkResourceType};+use crate::automation::{DevToolsNetworkInterceptId, DevToolsNetworkResourceType};use crate::domains::network::MainDocumentBodyProgressSource;use moli_cookie_jar::StoredCookieQueryReport;use moli_core::page::{@@ -161,7 +161,7 @@ mod tests {FetchInterceptionPattern, FetchRequestStage, FetchResourceTypeFilter,fetch_subresource_interception_config_for_patterns, matching_fetch_pattern,};- use crate::devtools_runtime::DevToolsNetworkResourceType;+ use crate::automation::DevToolsNetworkResourceType;use moli_core::page::SubresourceResourceType;use url::Url;diff --git a/moli-protocol/src/conn/output.rs b/moli-protocol/src/conn/output.rsindex db3feb769..a956e3d88 100644--- a/moli-protocol/src/conn/output.rs+++ b/moli-protocol/src/conn/output.rs@@ -1,4 +1,4 @@-use crate::devtools_runtime::{+use crate::automation::{AutomationEvent, BrowserDownloadProgressEvent, BrowserDownloadWillBeginEvent, DevToolsFrameId,DevToolsNetworkResourceType, DevToolsRealmId, DevToolsRemoteHandleId, DevToolsTargetInfo,DomSetChildNodesEvent, LogEntryEvent, NavigationFrameEvent, NavigationFrameEventKind,@@ -495,12 +495,12 @@ impl BackgroundProtocolEventPayload {.event.parent_session_id.as_ref()- .map(crate::devtools_runtime::DevToolsSessionId::as_str),+ .map(crate::automation::DevToolsSessionId::as_str),Self::TargetDetached(event) => event.event.parent_session_id.as_ref()- .map(crate::devtools_runtime::DevToolsSessionId::as_str),+ .map(crate::automation::DevToolsSessionId::as_str),Self::TargetDestroyed(event) => event.session_id.as_deref(),Self::TargetCrashed(event) => event.session_id.as_deref(),Self::TargetReceivedMessageFromTarget(_) | Self::AutomationOnly(_) => None,@@ -4234,9 +4234,7 @@ fn runtime_exception_thrown_protocol_params(event: ScriptExceptionEvent) -> Valu})}-fn runtime_exception_remote_object(- exception: crate::devtools_runtime::DevToolsScriptException,-) -> Value {+fn runtime_exception_remote_object(exception: crate::automation::DevToolsScriptException) -> Value {exception.value.map(crate::cdp_projection::remote_object_from_devtools)@@ -4368,7 +4366,7 @@ pub fn build_event(method: &str, params: Value, session_id: Option<&str>) -> Val#[cfg(test)]mod tests {- use crate::devtools_runtime::{+ use crate::automation::{AutomationEvent, DevToolsBrowserContextId, DevToolsFrameId, DevToolsLoaderId,DevToolsNetworkResourceType, DevToolsSessionId, DevToolsTargetId, DevToolsTargetInfo,DevToolsTargetKind, NavigationFrameEvent, NavigationFrameEventKind,@@ -5484,7 +5482,7 @@ mod tests {),BackgroundProtocolEvent::page_javascript_dialog_opening(Some("SID-page"),- crate::devtools_runtime::PageJavaScriptDialogOpeningEvent {+ crate::automation::PageJavaScriptDialogOpeningEvent {frame_id: Some(DevToolsFrameId::from("FRAME-dialog")),url: "https://example.test/dialog".to_owned(),message: "confirm?".to_owned(),@@ -5542,7 +5540,7 @@ mod tests {#[test]fn background_event_waits_for_navigation_completion_only_for_non_document_network() {- use crate::devtools_runtime::{DevToolsRequestId, NetworkRequestEvent};+ use crate::automation::{DevToolsRequestId, NetworkRequestEvent};let network_event = |resource_type: Option<DevToolsNetworkResourceType>| {AutomationEvent::NetworkResponseStarted(NetworkRequestEvent {diff --git a/moli-protocol/src/conn/page_state/page_targets.rs b/moli-protocol/src/conn/page_state/page_targets.rsindex facc195ff..b5a489e42 100644--- a/moli-protocol/src/conn/page_state/page_targets.rs+++ b/moli-protocol/src/conn/page_state/page_targets.rs@@ -8,7 +8,7 @@ use super::super::{SharedWorkerTargetState, TargetIdentityState, TargetInitialEmptyDocumentCreator,TargetOwnerState,};-use crate::devtools_runtime::{+use crate::automation::{DevToolsBrowserContextId, DevToolsTargetId, DevToolsTargetInfo, DevToolsTargetKind,};use moli_core::network::SharedWebStorageStore;@@ -728,7 +728,7 @@ impl BrowserContext {opener_frame_id: self.target_opener_frame_ids.get(target_id)- .map(|id| crate::devtools_runtime::DevToolsFrameId::from(id.as_str())),+ .map(|id| crate::automation::DevToolsFrameId::from(id.as_str())),can_access_opener: self.target_can_access_opener.contains(target_id),browser_context_id: Some(DevToolsBrowserContextId::from(self.id.as_str())),moli_popup_id: None,diff --git a/moli-protocol/src/conn/runtime_eval.rs b/moli-protocol/src/conn/runtime_eval.rsindex 5543e15ee..8bb42db5b 100644--- a/moli-protocol/src/conn/runtime_eval.rs+++ b/moli-protocol/src/conn/runtime_eval.rs@@ -5,7 +5,7 @@ use moli_protocol_cdp::CdpRendererCommandReplayDispatch;use moli_shared_worker::SharedWorkerInstanceId;use serde_json::{Map, Value, json};-use crate::devtools_runtime::{+use crate::automation::{AutomationEvent, DevToolsFrameId, DevToolsRealmId, DevToolsRemoteValue,DevToolsResultOwnership, DevToolsTargetId, RuntimeExecutionContextEvent, ScriptMessageEvent,};diff --git a/moli-protocol/src/conn/runtime_eval/tests.rs b/moli-protocol/src/conn/runtime_eval/tests.rsindex e6aed2991..5d892cc6f 100644--- a/moli-protocol/src/conn/runtime_eval/tests.rs+++ b/moli-protocol/src/conn/runtime_eval/tests.rs@@ -232,12 +232,10 @@ fn runtime_remote_object_validation_tolerates_an_empty_browser_context() {fn bidi_channel_listener_for_test(channel: &str) -> PendingBidiChannelListener {PendingBidiChannelListener::new(Some(DevToolsTargetId::from("TID-active")),- Some(crate::devtools_runtime::DevToolsRealmId::from(- "realm-active",- )),- crate::devtools_runtime::DevToolsRemoteHandleId::from(format!("channel-proxy-{channel}")),+ Some(crate::automation::DevToolsRealmId::from("realm-active")),+ crate::automation::DevToolsRemoteHandleId::from(format!("channel-proxy-{channel}")),format!("webdriver-bidi-channel-{channel}"),- crate::devtools_runtime::DevToolsBidiChannelProperties {+ crate::automation::DevToolsBidiChannelProperties {channel: channel.to_owned(),ownership: DevToolsResultOwnership::None,serialization_options: None,@@ -1910,12 +1908,10 @@ fn stale_bidi_listener_reply_does_not_emit_or_restart_on_replacement_page() {fn bidi_listener_result_handles_stay_in_user_object_group() {let listener = PendingBidiChannelListener::new(Some(DevToolsTargetId::from("TID-active")),- Some(crate::devtools_runtime::DevToolsRealmId::from(- "realm-active",- )),- crate::devtools_runtime::DevToolsRemoteHandleId::from("channel-proxy"),+ Some(crate::automation::DevToolsRealmId::from("realm-active")),+ crate::automation::DevToolsRemoteHandleId::from("channel-proxy"),"webdriver-bidi-channel-infra".to_owned(),- crate::devtools_runtime::DevToolsBidiChannelProperties {+ crate::automation::DevToolsBidiChannelProperties {channel: "preload".to_owned(),ownership: DevToolsResultOwnership::Root,serialization_options: None,@@ -1940,15 +1936,13 @@ fn bidi_listener_result_handles_stay_in_user_object_group() {fn bidi_listener_uses_deep_serialization_additional_parameters() {let listener = PendingBidiChannelListener::new(Some(DevToolsTargetId::from("TID-active")),- Some(crate::devtools_runtime::DevToolsRealmId::from(- "realm-active",- )),- crate::devtools_runtime::DevToolsRemoteHandleId::from("channel-proxy"),+ Some(crate::automation::DevToolsRealmId::from("realm-active")),+ crate::automation::DevToolsRemoteHandleId::from("channel-proxy"),"webdriver-bidi-channel-infra".to_owned(),- crate::devtools_runtime::DevToolsBidiChannelProperties {+ crate::automation::DevToolsBidiChannelProperties {channel: "preload".to_owned(),ownership: DevToolsResultOwnership::None,- serialization_options: Some(crate::devtools_runtime::DevToolsSerializationOptions {+ serialization_options: Some(crate::automation::DevToolsSerializationOptions {max_object_depth: Some(1),max_dom_depth: Some(2),include_shadow_tree: Some("open".to_owned()),diff --git a/moli-protocol/src/conn/scheduler_state.rs b/moli-protocol/src/conn/scheduler_state.rsindex 6c05d6cdc..4c943eb87 100644--- a/moli-protocol/src/conn/scheduler_state.rs+++ b/moli-protocol/src/conn/scheduler_state.rs@@ -230,7 +230,7 @@ impl CdpRendererOwnerTurnOutcome {#[cfg(test)]mod tests {use super::*;- use crate::devtools_runtime::AutomationEvent;+ use crate::automation::AutomationEvent;#[test]fn turn_outcome_raw_protocol_messages_regain_typed_sidecars() {diff --git a/moli-protocol/src/conn/state/fetch.rs b/moli-protocol/src/conn/state/fetch.rsindex e3d6c3761..6168ffc01 100644--- a/moli-protocol/src/conn/state/fetch.rs+++ b/moli-protocol/src/conn/state/fetch.rs@@ -19,7 +19,7 @@ pub(super) use super::super::fetch_support::{use super::DocumentNavigationToken;use super::navigation_outcome::NavigationDispatchState;use super::runtime_slot::TargetRuntimeSlot;-use crate::devtools_runtime::{DevToolsNetworkInterceptId, DevToolsNetworkResourceType};+use crate::automation::{DevToolsNetworkInterceptId, DevToolsNetworkResourceType};use moli_fetch::url_pattern_matches;#[derive(Debug, Default)]diff --git a/moli-protocol/src/conn/state/navigation_outcome.rs b/moli-protocol/src/conn/state/navigation_outcome.rsindex f59a48cf6..dc3ba5074 100644--- a/moli-protocol/src/conn/state/navigation_outcome.rs+++ b/moli-protocol/src/conn/state/navigation_outcome.rs@@ -8,8 +8,8 @@ use serde_json::Value;use std::sync::Arc;use url::Url;+use crate::automation::FrontendProtocol;use crate::conn::{CommandOwnerScope, ResponseCommitReady};-use crate::devtools_runtime::DevToolsProtocol;use crate::domains::network::{CompletedDocumentProgressTransfer, CompletedDownloadProgressTransfer,};@@ -252,19 +252,19 @@ pub(crate) enum NavigationResultProjection {}impl NavigationResultProjection {- pub(crate) fn new(protocol: DevToolsProtocol, payload: Value) -> Self {+ pub(crate) fn new(protocol: FrontendProtocol, payload: Value) -> Self {match protocol {- DevToolsProtocol::Cdp => Self::Cdp(payload),- DevToolsProtocol::WebDriverClassic => Self::WebDriverClassic(payload),- DevToolsProtocol::WebDriverBidi => Self::WebDriverBidi(payload),+ FrontendProtocol::Cdp => Self::Cdp(payload),+ FrontendProtocol::WebDriverClassic => Self::WebDriverClassic(payload),+ FrontendProtocol::WebDriverBidi => Self::WebDriverBidi(payload),}}- pub(crate) fn protocol(&self) -> DevToolsProtocol {+ pub(crate) fn protocol(&self) -> FrontendProtocol {match self {- Self::Cdp(_) => DevToolsProtocol::Cdp,- Self::WebDriverClassic(_) => DevToolsProtocol::WebDriverClassic,- Self::WebDriverBidi(_) => DevToolsProtocol::WebDriverBidi,+ Self::Cdp(_) => FrontendProtocol::Cdp,+ Self::WebDriverClassic(_) => FrontendProtocol::WebDriverClassic,+ Self::WebDriverBidi(_) => FrontendProtocol::WebDriverBidi,}}diff --git a/moli-protocol/src/conn/state/service_worker_target.rs b/moli-protocol/src/conn/state/service_worker_target.rsindex 468d77a5c..4ad4b5bcd 100644--- a/moli-protocol/src/conn/state/service_worker_target.rs+++ b/moli-protocol/src/conn/state/service_worker_target.rs@@ -7,7 +7,7 @@ use moli_core::page::{};use serde_json::Value;-use crate::devtools_runtime::RuntimeExecutionContextEvent;+use crate::automation::RuntimeExecutionContextEvent;use super::service_worker_lifetime::{TargetServiceWorkerProtocolAttachmentIdentity, TargetServiceWorkerProtocolAttachmentRetirement,diff --git a/moli-protocol/src/conn/state/shared_worker_target.rs b/moli-protocol/src/conn/state/shared_worker_target.rsindex c96d2a80d..9e527eaa5 100644--- a/moli-protocol/src/conn/state/shared_worker_target.rs+++ b/moli-protocol/src/conn/state/shared_worker_target.rs@@ -6,7 +6,7 @@ use moli_core::{};use moli_shared_worker::SharedWorkerInstanceId;-use crate::devtools_runtime::RuntimeExecutionContextEvent;+use crate::automation::RuntimeExecutionContextEvent;#[cfg(test)]use super::session::InspectorSessionState;@@ -755,7 +755,7 @@ impl SharedWorkerTargetState {#[cfg(test)]mod tests {use super::SharedWorkerTargetState;- use crate::devtools_runtime::RuntimeExecutionContextEvent;+ use crate::automation::RuntimeExecutionContextEvent;use moli_core::{RendererOwnerLocalHostId, page::RendererSharedWorkerConsoleMessage};use moli_shared_worker::SharedWorkerInstanceId;diff --git a/moli-protocol/src/conn/state/target_state.rs b/moli-protocol/src/conn/state/target_state.rsindex d17f6b788..0f1ee110e 100644--- a/moli-protocol/src/conn/state/target_state.rs+++ b/moli-protocol/src/conn/state/target_state.rs@@ -6,7 +6,7 @@ use moli_page_types::{DevToolsSessionKey, FrontendCommandId};use serde_json::{Value, json};use crate::{- devtools_runtime::{+ automation::{DevToolsBidiChannelProperties, DevToolsRealmId, DevToolsRemoteHandleId, DevToolsTargetId,},domains::{diff --git a/moli-protocol/src/conn/state/tests.rs b/moli-protocol/src/conn/state/tests.rsindex a8c889622..48250247c 100644--- a/moli-protocol/src/conn/state/tests.rs+++ b/moli-protocol/src/conn/state/tests.rs@@ -1,4 +1,4 @@-use crate::devtools_runtime::DevToolsNetworkResourceType;+use crate::automation::DevToolsNetworkResourceType;use moli_cookie_jar::new_shared_browser_cookie_store;use moli_core::page::{SessionHistoryUpdateKind, SubresourceResourceType};diff --git a/moli-protocol/src/conn/target/control.rs b/moli-protocol/src/conn/target/control.rsindex 18a2ac44b..99ccd05a1 100644--- a/moli-protocol/src/conn/target/control.rs+++ b/moli-protocol/src/conn/target/control.rs@@ -1,7 +1,7 @@use std::collections::HashSet;use super::graph::{TabTarget, TargetGraph};-use crate::devtools_runtime::{+use crate::automation::{DevToolsSessionId, DevToolsTargetFilterEntry, DevToolsTargetId, DevToolsTargetInfo,DevToolsTargetKind, TargetAttachmentEvent, TargetDetachmentEvent,};@@ -567,8 +567,8 @@ fn target_detached_event(#[cfg(test)]mod tests {+ use crate::automation::{DevToolsTargetId, DevToolsTargetInfo, DevToolsTargetKind};use crate::conn::{CdpSessionRoute, CdpTargetFilter, TargetControlPlane};- use crate::devtools_runtime::{DevToolsTargetId, DevToolsTargetInfo, DevToolsTargetKind};fn target_info(target_id: &str, kind: DevToolsTargetKind) -> DevToolsTargetInfo {DevToolsTargetInfo {diff --git a/moli-protocol/src/conn/target/default_target.rs b/moli-protocol/src/conn/target/default_target.rsindex 4c9d6f7ad..72ffeb099 100644--- a/moli-protocol/src/conn/target/default_target.rs+++ b/moli-protocol/src/conn/target/default_target.rs@@ -1,4 +1,4 @@-use crate::devtools_runtime::{+use crate::automation::{DevToolsBrowserContextId, DevToolsTargetId, DevToolsTargetInfo, DevToolsTargetKind,};diff --git a/moli-protocol/src/conn/target/observer.rs b/moli-protocol/src/conn/target/observer.rsindex 0f6542931..5636752f0 100644--- a/moli-protocol/src/conn/target/observer.rs+++ b/moli-protocol/src/conn/target/observer.rs@@ -1,10 +1,10 @@use std::collections::{HashMap, HashSet};-use crate::conn::{BackgroundProtocolEvent, CdpTargetFilter};-use crate::devtools_runtime::{+use crate::automation::{AutomationEvent, DevToolsTargetFilterEntry, DevToolsTargetId, DevToolsTargetInfo,TargetLifecycleEvent,};+use crate::conn::{BackgroundProtocolEvent, CdpTargetFilter};#[derive(Clone, Debug, Default, PartialEq, Eq)]pub(crate) struct TargetHandlerState {@@ -289,10 +289,10 @@ fn target_lifecycle_event(target_info: DevToolsTargetInfo) -> Option<TargetLifec#[cfg(test)]mod tests {- use crate::conn::{CdpTargetFilter, CdpTargetFilterEntry};- use crate::devtools_runtime::{+ use crate::automation::{AutomationEvent, DevToolsTargetId, DevToolsTargetInfo, DevToolsTargetKind,};+ use crate::conn::{CdpTargetFilter, CdpTargetFilterEntry};use super::TargetHandlerStore;diff --git a/moli-protocol/src/conn/target/projection.rs b/moli-protocol/src/conn/target/projection.rsindex ceeea064c..c9bff804f 100644--- a/moli-protocol/src/conn/target/projection.rs+++ b/moli-protocol/src/conn/target/projection.rs@@ -1,5 +1,5 @@use super::graph::TabTarget;-use crate::devtools_runtime::{DevToolsTargetId, DevToolsTargetInfo, DevToolsTargetKind};+use crate::automation::{DevToolsTargetId, DevToolsTargetInfo, DevToolsTargetKind};pub(crate) fn tab_target_info_from_page_target_info(target: &TabTarget,@@ -37,7 +37,7 @@ pub(crate) fn project_page_tab_target_infos_for_destruction(#[cfg(test)]mod tests {- use crate::devtools_runtime::{+ use crate::automation::{DevToolsBrowserContextId, DevToolsFrameId, DevToolsTargetId, DevToolsTargetInfo,DevToolsTargetKind,};diff --git a/moli-protocol/src/conn/target/session_binding.rs b/moli-protocol/src/conn/target/session_binding.rsindex 8f4339dd6..6519c379d 100644--- a/moli-protocol/src/conn/target/session_binding.rs+++ b/moli-protocol/src/conn/target/session_binding.rs@@ -1,7 +1,7 @@+use crate::automation::DevToolsTargetInfo;#[cfg(test)]use crate::conn::BrowserContext;use crate::conn::CdpConnection;-use crate::devtools_runtime::DevToolsTargetInfo;use super::{CdpSessionRoute, PreparedTargetAttach, SessionDisposalPlan, SessionDisposalTarget,diff --git a/moli-protocol/src/conn/target/transaction.rs b/moli-protocol/src/conn/target/transaction.rsindex 8af7348cf..1e09e2d1b 100644--- a/moli-protocol/src/conn/target/transaction.rs+++ b/moli-protocol/src/conn/target/transaction.rs@@ -1,5 +1,5 @@+use crate::automation::DevToolsTargetInfo;use crate::conn::{BackgroundProtocolEvent, CdpSessionRoute};-use crate::devtools_runtime::DevToolsTargetInfo;use moli_page_types::DevToolsSessionKey;use super::{CommittedAttachSession, DetachedTargetSession, TargetHostDelta};@@ -600,8 +600,8 @@ mod tests {TargetAttachRollbackPlan, TargetAttachSessionCommit, TargetAutoAttachedSessionDetachPlan,TargetClosureCleanupPlan, TargetEventPlan, TargetSessionDetachCleanupPlan,};+ use crate::automation::{DevToolsTargetId, DevToolsTargetInfo, DevToolsTargetKind};use crate::conn::CdpSessionRoute;- use crate::devtools_runtime::{DevToolsTargetId, DevToolsTargetInfo, DevToolsTargetKind};use moli_page_types::DevToolsSessionKey;#[test]diff --git a/moli-protocol/src/conn/tests/mod.rs b/moli-protocol/src/conn/tests/mod.rsindex 219ede092..67ea6f78c 100644--- a/moli-protocol/src/conn/tests/mod.rs+++ b/moli-protocol/src/conn/tests/mod.rs@@ -11,7 +11,7 @@ use super::{CommandResponseFlushContext, NavigationBackgroundEvent, NavigationDispatchState,NavigationResultProjection, ServiceWorkerTargetState, SharedWorkerTargetState, build_event,};-use crate::devtools_runtime::{+use crate::automation::{AutomationEvent, DevToolsFrameId, DevToolsLoaderId, DevToolsTargetFilterEntry,DevToolsTargetId, NavigationFrameEvent, NavigationFrameEventKind,};diff --git a/moli-protocol/src/conn/tests/navigation_error.rs b/moli-protocol/src/conn/tests/navigation_error.rsindex 7ad2d6b0f..cf3084632 100644--- a/moli-protocol/src/conn/tests/navigation_error.rs+++ b/moli-protocol/src/conn/tests/navigation_error.rs@@ -95,7 +95,7 @@ async fn context_wrapped_cancellation_preserves_the_committed_page_and_releases_for error in [anyhow::Error::new(moli_fetch::FetchCancelled),- anyhow::Error::new(crate::devtools_runtime::DevToolsRequestFailure::Aborted),+ anyhow::Error::new(crate::automation::DevToolsRequestFailure::Aborted),] {let token = ctx.conndiff --git a/moli-protocol/src/conn/tests/resource_runtime.rs b/moli-protocol/src/conn/tests/resource_runtime.rsindex aa9247ee7..81c44b2dd 100644--- a/moli-protocol/src/conn/tests/resource_runtime.rs+++ b/moli-protocol/src/conn/tests/resource_runtime.rs@@ -1630,12 +1630,12 @@ fn devtools_document_lifecycle_wait_key_observes_interruption_and_target_loss());assert_eq!(accepted, vec![started, dcl]);- let context = crate::devtools_runtime::DevToolsCommandContext {- protocol: crate::devtools_runtime::DevToolsProtocol::WebDriverBidi,- session_id: Some(crate::devtools_runtime::DevToolsSessionId::from(+ let context = crate::automation::AutomationContext {+ protocol: crate::automation::FrontendProtocol::WebDriverBidi,+ session_id: Some(crate::automation::DevToolsSessionId::from("SID-lifecycle-wait",)),- target_id: Some(crate::devtools_runtime::DevToolsTargetId::from(+ target_id: Some(crate::automation::DevToolsTargetId::from("TID-lifecycle-wait",)),browser_context_id: None,@@ -1772,12 +1772,10 @@ fn devtools_target_context_resolves_background_page_without_ambient_route() {.start_document_navigation("TID-background".to_owned(), "LID-background".to_owned());conn.install_browser_context_fixture_for_test(browser_context);- let context = crate::devtools_runtime::DevToolsCommandContext {- protocol: crate::devtools_runtime::DevToolsProtocol::WebDriverBidi,+ let context = crate::automation::AutomationContext {+ protocol: crate::automation::FrontendProtocol::WebDriverBidi,session_id: None,- target_id: Some(crate::devtools_runtime::DevToolsTargetId::from(- "TID-background",- )),+ target_id: Some(crate::automation::DevToolsTargetId::from("TID-background")),browser_context_id: None,};diff --git a/moli-protocol/src/domains/accessibility/native.rs b/moli-protocol/src/domains/accessibility/native.rsindex b32030788..10b7f8ea9 100644--- a/moli-protocol/src/domains/accessibility/native.rs+++ b/moli-protocol/src/domains/accessibility/native.rs@@ -1,5 +1,5 @@use super::*;-use crate::devtools_runtime::DevToolsDomNodeReference;+use crate::automation::DevToolsDomNodeReference;use crate::domains::native::{self, NativeCommandStep, NodeLookupExecution};use moli_core::{RendererNativeOperation as Operation, RendererNativeProtocolResponse as Response,diff --git a/moli-protocol/src/domains/activity/main_document.rs b/moli-protocol/src/domains/activity/main_document.rsindex 96ea8ee1c..632b69861 100644--- a/moli-protocol/src/domains/activity/main_document.rs+++ b/moli-protocol/src/domains/activity/main_document.rs@@ -3,6 +3,7 @@ use url::Url;use moli_fetch::NET_ERR_ABORTED_ERROR_TEXT;+use crate::automation::FrontendProtocol;use crate::conn::{BackgroundProtocolEvent, CdpConnection, CommandDispatchContext, CommandOwnerScope,CommittedRendererDocumentBinding, CompletedDownloadBodyArtifact,@@ -10,7 +11,6 @@ use crate::conn::{RendererDocumentLifecycleObservation, RendererDocumentLifecycleObserver,RendererPageResidenceIdentity,};-use crate::devtools_runtime::DevToolsProtocol;use crate::domains::command_output::{BackgroundProtocolEventBuffer, CommandOutputBuffer};use crate::domains::network::{self, FailedNavigationResponseMode, MainDocumentProgressBackgroundEventBarrier,@@ -355,7 +355,7 @@ impl MainDocumentNavigationActivity {return;}match self.state.result_projection.protocol() {- DevToolsProtocol::Cdp => {+ FrontendProtocol::Cdp => {let mut result_payload = self.state.result_projection.payload().clone();if let Some(payload) = result_payload.as_object_mut() {payload.insert("errorText".to_owned(), json!(error_text));@@ -363,7 +363,7 @@ impl MainDocumentNavigationActivity {}out.push_result_after_messages(result_payload);}- DevToolsProtocol::WebDriverClassic | DevToolsProtocol::WebDriverBidi => {+ FrontendProtocol::WebDriverClassic | FrontendProtocol::WebDriverBidi => {out.push_error_after_messages(-32000, error_text);}}@@ -870,7 +870,7 @@ impl MainDocumentFailedNavigationActivity {}if navigate_id.is_some() {if self.response_mode == FailedNavigationResponseMode::CdpErrorTextResult- && self.state.result_projection.protocol() == DevToolsProtocol::Cdp+ && self.state.result_projection.protocol() == FrontendProtocol::Cdp{let mut result_payload = self.state.result_projection.into_payload();if let Some(payload) = result_payload.as_object_mut() {diff --git a/moli-protocol/src/domains/activity/scheduler_work.rs b/moli-protocol/src/domains/activity/scheduler_work.rsindex 194add533..7e961744b 100644--- a/moli-protocol/src/domains/activity/scheduler_work.rs+++ b/moli-protocol/src/domains/activity/scheduler_work.rs@@ -3,13 +3,13 @@ use std::fmt;use moli_core::RendererOutputTransportMessage;use crate::{+ automation::AutomationContext,conn::{BidiChannelOwnerAction, CdpConnection, DeferredMainDocumentLoadCompletionOutputAction,DeferredMainDocumentLoadCompletionOutputInterest,PendingDeferredMainDocumentLoadCompletion, PopupTargetActivationAction,PopupTargetNavigationOwnerAction, TopLevelLocationNavigationOwnerAction,},- devtools_runtime::DevToolsCommandContext,};use super::{@@ -412,7 +412,7 @@ impl ProtocolSchedulerWork {pub fn observes_main_document_load_for_devtools_context(&self,conn: &CdpConnection,- context: &DevToolsCommandContext,+ context: &AutomationContext,) -> bool {let ProtocolSchedulerWorkPayload::MainDocumentLoadOwnerAction(completion) = &self.payloadelse {diff --git a/moli-protocol/src/domains/activity/subresource.rs b/moli-protocol/src/domains/activity/subresource.rsindex d912e77c9..1fcf9e4dc 100644--- a/moli-protocol/src/domains/activity/subresource.rs+++ b/moli-protocol/src/domains/activity/subresource.rs@@ -1,3 +1,4 @@+use crate::automation::DevToolsNetworkInterceptId;use crate::conn::{BackgroundProtocolEvent, CdpConnection, ClaimedSubresourceContinueRequest, CommandOwnerScope,FetchAuthChallenge, FetchRequestStage, PendingSubresourceFetchAuthRequest,@@ -6,7 +7,6 @@ use crate::conn::{PendingSubresourceFetchResponseRequest, PendingSubresourceFetchResponseStage,PendingSubresourceFetchResponseStageChain, TargetPageResidenceIdentity,};-use crate::devtools_runtime::DevToolsNetworkInterceptId;use crate::domains::fetch;use moli_core::page::{PendingSubresourceAuthInfo, PendingSubresourceContinueEvent, PendingSubresourceResponseInfo,diff --git a/moli-protocol/src/domains/audits.rs b/moli-protocol/src/domains/audits.rsindex c600d3d65..75111a14e 100644--- a/moli-protocol/src/domains/audits.rs+++ b/moli-protocol/src/domains/audits.rs@@ -1,7 +1,7 @@use moli_core::page::InspectorIssueSnapshot;+use crate::automation::{DevToolsError, DevToolsErrorKind};use crate::conn::{CdpConnection, Cmd};-use crate::devtools_runtime::{DevToolsError, DevToolsErrorKind};use crate::domains::actions::AuditsAction;use crate::domains::command_output::CommandOutputPlan;diff --git a/moli-protocol/src/domains/browser.rs b/moli-protocol/src/domains/browser.rsindex 2825e8caf..8d35a8936 100644--- a/moli-protocol/src/domains/browser.rs+++ b/moli-protocol/src/domains/browser.rs@@ -5,11 +5,11 @@ use serde::Deserialize;use serde_json::{Value, json};use std::str::FromStr;-use crate::conn::{BrowserWindowBounds, CdpConnection, Cmd};-use crate::devtools_runtime::{- DevToolsCommand, DevToolsCommandResult, DevToolsError, DevToolsErrorKind,+use crate::automation::{+ AutomationCommand, AutomationResult, DevToolsError, DevToolsErrorKind,DevToolsSetDownloadBehaviorCommand, DevToolsSetPermissionCommand,};+use crate::conn::{BrowserWindowBounds, CdpConnection, Cmd};use crate::domains::actions::BrowserAction;use crate::domains::command_output::CommandOutputPlan;use crate::version;@@ -350,10 +350,10 @@ pub(crate) fn set_download_behavior_command_output_plan(pub(crate) fn execute_devtools_browser_command(conn: &mut CdpConnection,- command: DevToolsCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+ command: AutomationCommand,+) -> Result<AutomationResult, DevToolsError> {match command {- DevToolsCommand::SetDownloadBehavior(command) => {+ AutomationCommand::SetDownloadBehavior(command) => {execute_devtools_set_download_behavior(conn, command)}_ => Err(DevToolsError::new(@@ -365,10 +365,10 @@ pub(crate) fn execute_devtools_browser_command(pub(crate) async fn execute_devtools_browser_command_async(conn: &mut CdpConnection,- command: DevToolsCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+ command: AutomationCommand,+) -> Result<AutomationResult, DevToolsError> {match command {- DevToolsCommand::SetPermission(command) => {+ AutomationCommand::SetPermission(command) => {execute_devtools_set_permission_command_async(conn, command).await}_ => Err(DevToolsError::new(@@ -381,7 +381,7 @@ pub(crate) async fn execute_devtools_browser_command_async(fn execute_devtools_set_download_behavior(conn: &mut CdpConnection,command: DevToolsSetDownloadBehaviorCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let target_contexts = match command.user_contexts {Some(user_contexts) => {if user_contexts.is_empty() {@@ -413,7 +413,7 @@ fn execute_devtools_set_download_behavior(}None => conn.download_behavior.reset_global(),}- return Ok(DevToolsCommandResult::Empty);+ return Ok(AutomationResult::Empty);};if !is_valid_download_behavior(behavior.behavior.as_str()) {@@ -440,13 +440,13 @@ fn execute_devtools_set_download_behavior(behavior.events_enabled,),}- Ok(DevToolsCommandResult::Empty)+ Ok(AutomationResult::Empty)}async fn execute_devtools_set_permission_command_async(conn: &mut CdpConnection,command: DevToolsSetPermissionCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let browser_context_id = command.browser_context_id.as_ref().map(|id| id.as_str());if validate_browser_context_id(conn, browser_context_id).is_err() {return Err(DevToolsError::new(@@ -476,7 +476,7 @@ async fn execute_devtools_set_permission_command_async(let pending = start_loaded_page_permission_override_commands(conn).map_err(|error| DevToolsError::new(DevToolsErrorKind::Internal, error))?;if pending.is_empty() {- return Ok(DevToolsCommandResult::Empty);+ return Ok(AutomationResult::Empty);}let completed = PendingBrowserCommandDispatch {command_id: None,@@ -501,7 +501,7 @@ async fn execute_devtools_set_permission_command_async(finish_pending_permission_override_command(conn, command.target, completion).map_err(|error| DevToolsError::new(DevToolsErrorKind::Internal, error))?;}- Ok(DevToolsCommandResult::Empty)+ Ok(AutomationResult::Empty)}fn cancel_download(conn: &mut CdpConnection, cmd: &Cmd<'_>) -> CommandOutputPlan {diff --git a/moli-protocol/src/domains/command_output.rs b/moli-protocol/src/domains/command_output.rsindex 0ad537d3b..d7c084304 100644--- a/moli-protocol/src/domains/command_output.rs+++ b/moli-protocol/src/domains/command_output.rs@@ -1,13 +1,13 @@use base64::{Engine as _, engine::general_purpose::STANDARD as BASE64_STANDARD};use serde_json::{Value, json};-use crate::devtools_runtime::{- AutomationEvent, BrowserDownloadProgressEvent, BrowserDownloadWillBeginEvent,- DevToolsCommandResult, DevToolsError, DevToolsErrorKind, DevToolsFetchRequestId,- DevToolsFrameId, DevToolsLoaderId, DevToolsNetworkDataBytesType, DevToolsNetworkInterceptId,- DevToolsNetworkResourceType, DevToolsRealmId, DevToolsRemoteValue, DevToolsRequestId,- DevToolsScriptException, DevToolsScriptResult, DevToolsStackTrace, DevToolsTargetId,- DevToolsTargetInfo, NavigationFrameEvent, NavigationFrameEventKind, NetworkAuthChallengeEvent,+use crate::automation::{+ AutomationEvent, AutomationResult, BrowserDownloadProgressEvent, BrowserDownloadWillBeginEvent,+ DevToolsError, DevToolsErrorKind, DevToolsFetchRequestId, DevToolsFrameId, DevToolsLoaderId,+ DevToolsNetworkDataBytesType, DevToolsNetworkInterceptId, DevToolsNetworkResourceType,+ DevToolsRealmId, DevToolsRemoteValue, DevToolsRequestId, DevToolsScriptException,+ DevToolsScriptResult, DevToolsStackTrace, DevToolsTargetId, DevToolsTargetInfo,+ NavigationFrameEvent, NavigationFrameEventKind, NetworkAuthChallengeEvent,NetworkRedirectResponseEvent, NetworkRequestEvent, PageFileChooserOpenedEvent,PageJavaScriptDialogOpeningEvent, PageLifecycleEvent, RuntimeConsoleEvent,RuntimeExecutionContextEvent, SameDocumentNavigationEvent, ScriptExceptionEvent,@@ -79,7 +79,7 @@ enum CommandOwnerEvent {impl CommandOutputPlan {pub(crate) fn success() -> Self {- Self::from_devtools_result(DevToolsCommandResult::Empty)+ Self::from_devtools_result(AutomationResult::Empty)}pub(crate) fn error(code: i32, message: impl Into<String>) -> Self {@@ -100,11 +100,11 @@ impl CommandOutputPlan {plan}- pub(crate) fn from_devtools_result(result: DevToolsCommandResult) -> Self {+ pub(crate) fn from_devtools_result(result: AutomationResult) -> Self {Self::result(Self::devtools_result_payload(result))}- pub(crate) fn devtools_result_payload(result: DevToolsCommandResult) -> Value {+ pub(crate) fn devtools_result_payload(result: AutomationResult) -> Value {cdp_result_payload_from_devtools_result(result)}@@ -1605,14 +1605,14 @@ fn blocked_intercepts_from_cdp_params(params: &Value) -> Vec<DevToolsNetworkInte.collect()}-fn cdp_result_payload_from_devtools_result(result: DevToolsCommandResult) -> Value {+fn cdp_result_payload_from_devtools_result(result: AutomationResult) -> Value {match result {- DevToolsCommandResult::ElementClickPreparation(_)- | DevToolsCommandResult::ElementClickDispatch(_) => {+ AutomationResult::ElementClickPreparation(_)+ | AutomationResult::ElementClickDispatch(_) => {unreachable!("element click is an internal automation operation with no CDP method")}- DevToolsCommandResult::Empty | DevToolsCommandResult::TraverseHistory(_) => json!({}),- DevToolsCommandResult::Navigate(result) => {+ AutomationResult::Empty | AutomationResult::TraverseHistory(_) => json!({}),+ AutomationResult::Navigate(result) => {let mut payload = json!({});if let Some(frame_id) = result.frame_id {payload["frameId"] = json!(frame_id.into_string());@@ -1628,7 +1628,7 @@ fn cdp_result_payload_from_devtools_result(result: DevToolsCommandResult) -> Val}payload}- DevToolsCommandResult::GetNavigationHistory(result) => json!({+ AutomationResult::GetNavigationHistory(result) => json!({"currentIndex": result.current_index,"entries": result.entries@@ -1644,77 +1644,75 @@ fn cdp_result_payload_from_devtools_result(result: DevToolsCommandResult) -> Val}).collect::<Vec<_>>(),}),- DevToolsCommandResult::GetFrameTree(result) => json!({+ AutomationResult::GetFrameTree(result) => json!({"frameTree": result.frame_tree,}),- DevToolsCommandResult::GetFrameTrees(result) => json!({+ AutomationResult::GetFrameTrees(result) => json!({"frameTrees": result.frame_trees.into_iter().map(|result| result.frame_tree).collect::<Vec<_>>(),}),- DevToolsCommandResult::CreateTarget(result) => json!({+ AutomationResult::CreateTarget(result) => json!({"targetId": result.target_id.into_string(),}),- DevToolsCommandResult::CloseTarget(result) => json!({+ AutomationResult::CloseTarget(result) => json!({"success": result.success,}),- DevToolsCommandResult::GetTargets(result) => json!({+ AutomationResult::GetTargets(result) => json!({"targetInfos": result.targets.into_iter().map(cdp_target_info).collect::<Vec<_>>(),}),- DevToolsCommandResult::ServiceWorkerLogs(result) => json!({+ AutomationResult::ServiceWorkerLogs(result) => json!({"entries": result.entries.into_iter().map(service_worker_log_entry_json).collect::<Vec<_>>(),}),- DevToolsCommandResult::ClientWindows(result) => json!({+ AutomationResult::ClientWindows(result) => json!({"clientWindows": result.client_windows.into_iter().map(client_window_info_json).collect::<Vec<_>>(),}),- DevToolsCommandResult::ClientWindow(result) => {- client_window_info_json(result.client_window)- }- DevToolsCommandResult::CreateBrowserContext(result) => json!({+ AutomationResult::ClientWindow(result) => client_window_info_json(result.client_window),+ AutomationResult::CreateBrowserContext(result) => json!({"browserContextId": result.browser_context_id.into_string(),}),- DevToolsCommandResult::GetBrowserContexts(result) => json!({+ AutomationResult::GetBrowserContexts(result) => json!({"browserContextIds": result.browser_context_ids.into_iter().map(|id| id.into_string()).collect::<Vec<_>>(),}),- DevToolsCommandResult::GetTargetInfo(result) => json!({+ AutomationResult::GetTargetInfo(result) => json!({"targetInfo": cdp_target_info(result.target_info),}),- DevToolsCommandResult::GetCookies(result) => json!({+ AutomationResult::GetCookies(result) => json!({"cookies": result.cookies,}),- DevToolsCommandResult::DeleteCookies(_) => json!({}),- DevToolsCommandResult::SetCookies(result) => json!({+ AutomationResult::DeleteCookies(_) => json!({}),+ AutomationResult::SetCookies(result) => json!({"success": result.success,"cookieReports": result.cookie_reports,}),- DevToolsCommandResult::AddPreloadScript(result) => json!({+ AutomationResult::AddPreloadScript(result) => json!({"identifier": result.script_id.into_string(),}),- DevToolsCommandResult::AddNetworkIntercept(result) => json!({+ AutomationResult::AddNetworkIntercept(result) => json!({"intercept": result.intercept_id.into_string(),}),- DevToolsCommandResult::AddNetworkDataCollector(result) => json!({+ AutomationResult::AddNetworkDataCollector(result) => json!({"collector": result.collector_id.into_string(),}),- DevToolsCommandResult::NetworkData(result) => json!({+ AutomationResult::NetworkData(result) => json!({"bytes": {"type": match result.bytes_type {DevToolsNetworkDataBytesType::String => "string",@@ -1723,14 +1721,14 @@ fn cdp_result_payload_from_devtools_result(result: DevToolsCommandResult) -> Val"value": result.value,},}),- DevToolsCommandResult::Realms(result) => json!({+ AutomationResult::Realms(result) => json!({"realms": result.realms.into_iter().map(cdp_realm_info).collect::<Vec<_>>(),}),- DevToolsCommandResult::Script(result) => match *result {+ AutomationResult::Script(result) => match *result {DevToolsScriptResult::Value(value) => json!({"result": crate::cdp_projection::remote_object_from_devtools(value),}),@@ -1761,53 +1759,51 @@ fn cdp_result_payload_from_devtools_result(result: DevToolsCommandResult) -> Val})}},- DevToolsCommandResult::LocateNodes(result) => json!({+ AutomationResult::LocateNodes(result) => json!({"nodes": result.nodes.into_iter().map(crate::cdp_projection::remote_object_from_devtools).collect::<Vec<_>>(),}),- DevToolsCommandResult::DescribeNode(result) => json!({+ AutomationResult::DescribeNode(result) => json!({"node": result.node,}),- DevToolsCommandResult::GetFrameOwner(result) => json!({+ AutomationResult::GetFrameOwner(result) => json!({"nodeId": result.node_id,"backendNodeId": result.backend_node_id,}),- DevToolsCommandResult::QuerySelector(result) => {+ AutomationResult::QuerySelector(result) => {if result.multiple {json!({ "nodeIds": result.node_ids })} else {json!({ "nodeId": result.node_ids.first().copied().unwrap_or(0) })}}- DevToolsCommandResult::ResolveNode(result) => json!({+ AutomationResult::ResolveNode(result) => json!({"object": result.object,}),- DevToolsCommandResult::GetAttributes(result) => json!({+ AutomationResult::GetAttributes(result) => json!({"attributes": result.attributes.into_iter().flat_map(|attribute| [attribute.name, attribute.value]).collect::<Vec<_>>(),}),- DevToolsCommandResult::GetText(result) => json!({+ AutomationResult::GetText(result) => json!({"text": result.text,}),- DevToolsCommandResult::GetProperty(result) => json!({+ AutomationResult::GetProperty(result) => json!({"value": result.value,}),- DevToolsCommandResult::PushNodesByBackendIds(result) => json!({+ AutomationResult::PushNodesByBackendIds(result) => json!({"nodeIds": result.node_ids,}),- DevToolsCommandResult::GetOuterHtml(result) => {- Value::Object(serde_json::Map::from_iter([(- "outerHTML".to_owned(),- Value::String(result.outer_html),- )]))- }- DevToolsCommandResult::GetNodeForLocation(result) => {+ AutomationResult::GetOuterHtml(result) => Value::Object(serde_json::Map::from_iter([(+ "outerHTML".to_owned(),+ Value::String(result.outer_html),+ )])),+ AutomationResult::GetNodeForLocation(result) => {let mut value = json!({"backendNodeId": result.backend_node_id,"frameId": result.frame_id.as_str(),@@ -1817,7 +1813,7 @@ fn cdp_result_payload_from_devtools_result(result: DevToolsCommandResult) -> Val}value}- DevToolsCommandResult::DomGeometry(result) => {+ AutomationResult::DomGeometry(result) => {if let Some(model) = result.box_model {return json!({"model": {@@ -1852,7 +1848,7 @@ fn cdp_result_payload_from_devtools_result(result: DevToolsCommandResult) -> Valjson!({ "quads": quads })}}- DevToolsCommandResult::LayoutMetrics(result) => {+ AutomationResult::LayoutMetrics(result) => {let viewport = json!({"pageX": result.page_x,"pageY": result.page_y,@@ -1884,12 +1880,12 @@ fn cdp_result_payload_from_devtools_result(result: DevToolsCommandResult) -> Val"cssContentSize": content,})}- DevToolsCommandResult::JavaScriptDialog(result) => json!({+ AutomationResult::JavaScriptDialog(result) => json!({"type": result.dialog_type,"message": result.message,"defaultPrompt": result.default_prompt,}),- DevToolsCommandResult::CaptureScreenshot(result) => json!({+ AutomationResult::CaptureScreenshot(result) => json!({"data": BASE64_STANDARD.encode(result.bytes.as_ref()),}),}@@ -1955,7 +1951,7 @@ fn service_worker_log_entry_json(entry: RuntimeConsoleEvent) -> Value {payload}-fn client_window_info_json(window: crate::devtools_runtime::DevToolsClientWindowInfo) -> Value {+fn client_window_info_json(window: crate::automation::DevToolsClientWindowInfo) -> Value {json!({"clientWindow": window.client_window.into_string(),"active": window.active,@@ -2183,8 +2179,8 @@ impl CommandOwnerEvent {#[cfg(test)]mod tests {- use crate::devtools_runtime::{- AutomationEvent, DevToolsCaptureScreenshotResult, DevToolsCommandResult, DevToolsErrorKind,+ use crate::automation::{+ AutomationEvent, AutomationResult, DevToolsCaptureScreenshotResult, DevToolsErrorKind,NavigationFrameEventKind,};use base64::{Engine as _, engine::general_purpose::STANDARD as BASE64_STANDARD};@@ -2252,7 +2248,7 @@ mod tests {fn command_output_plan_base64_encodes_owned_screenshot_bytes() {let bytes = vec![0x89, b'P', b'N', b'G', 0x0d, 0x0a, 0x1a, 0x0a];let mut out = Vec::new();- CommandOutputPlan::from_devtools_result(DevToolsCommandResult::CaptureScreenshot(+ CommandOutputPlan::from_devtools_result(AutomationResult::CaptureScreenshot(DevToolsCaptureScreenshotResult {mime_type: "image/png".to_owned(),width: 800,@@ -2276,20 +2272,16 @@ mod tests {#[test]fn command_output_plan_serializes_devtools_navigate_result() {let mut out = Vec::new();- CommandOutputPlan::from_devtools_result(- crate::devtools_runtime::DevToolsCommandResult::Navigate(- crate::devtools_runtime::DevToolsNavigateResult {- navigation_id: Some(crate::devtools_runtime::DevToolsNavigationId::from(- "NAV-1",- )),- frame_id: Some(crate::devtools_runtime::DevToolsFrameId::from("FRAME-1")),- loader_id: Some(crate::devtools_runtime::DevToolsLoaderId::from("LOADER-1")),- url: "https://example.test/".to_owned(),- error_text: None,- is_download: None,- },- ),- )+ CommandOutputPlan::from_devtools_result(crate::automation::AutomationResult::Navigate(+ crate::automation::DevToolsNavigateResult {+ navigation_id: Some(crate::automation::DevToolsNavigationId::from("NAV-1")),+ frame_id: Some(crate::automation::DevToolsFrameId::from("FRAME-1")),+ loader_id: Some(crate::automation::DevToolsLoaderId::from("LOADER-1")),+ url: "https://example.test/".to_owned(),+ error_text: None,+ is_download: None,+ },+ )).emit_into(&mut out, Some(12), Some("SID-1"));assert_eq!(@@ -2308,18 +2300,16 @@ mod tests {#[test]fn command_output_plan_serializes_aborted_cdp_navigate_as_result() {let mut out = Vec::new();- CommandOutputPlan::from_devtools_result(- crate::devtools_runtime::DevToolsCommandResult::Navigate(- crate::devtools_runtime::DevToolsNavigateResult {- navigation_id: None,- frame_id: Some(crate::devtools_runtime::DevToolsFrameId::from("FRAME-1")),- loader_id: None,- url: "https://superseded.example.test/".to_owned(),- error_text: Some("net::ERR_ABORTED".to_owned()),- is_download: Some(false),- },- ),- )+ CommandOutputPlan::from_devtools_result(crate::automation::AutomationResult::Navigate(+ crate::automation::DevToolsNavigateResult {+ navigation_id: None,+ frame_id: Some(crate::automation::DevToolsFrameId::from("FRAME-1")),+ loader_id: None,+ url: "https://superseded.example.test/".to_owned(),+ error_text: Some("net::ERR_ABORTED".to_owned()),+ is_download: Some(false),+ },+ )).emit_into(&mut out, Some(13), Some("SID-1"));assert_eq!(@@ -2339,30 +2329,26 @@ mod tests {#[test]fn command_output_plan_serializes_devtools_script_value_result() {let mut out = Vec::new();- CommandOutputPlan::from_devtools_result(- crate::devtools_runtime::DevToolsCommandResult::Script(Box::new(- crate::devtools_runtime::DevToolsScriptResult::Value(- crate::devtools_runtime::DevToolsRemoteValue {- value: json!("Moli"),- handle: Some(crate::devtools_runtime::DevToolsRemoteHandleId::from(- "OBJ-1",- )),- shared_id: None,- node_id: None,- backend_node_id: None,- window_context: None,- realm: None,- remote_type: None,- remote_subtype: None,- unserializable_value: None,- description: None,- class_name: None,- deep_serialized_value: None,- node_value: None,- },- ),+ CommandOutputPlan::from_devtools_result(crate::automation::AutomationResult::Script(+ Box::new(crate::automation::DevToolsScriptResult::Value(+ crate::automation::DevToolsRemoteValue {+ value: json!("Moli"),+ handle: Some(crate::automation::DevToolsRemoteHandleId::from("OBJ-1")),+ shared_id: None,+ node_id: None,+ backend_node_id: None,+ window_context: None,+ realm: None,+ remote_type: None,+ remote_subtype: None,+ unserializable_value: None,+ description: None,+ class_name: None,+ deep_serialized_value: None,+ node_value: None,+ },)),- )+ )).emit_into(&mut out, Some(13), None);assert_eq!(@@ -2383,13 +2369,11 @@ mod tests {#[test]fn command_output_plan_serializes_devtools_outer_html_result() {let mut out = Vec::new();- CommandOutputPlan::from_devtools_result(- crate::devtools_runtime::DevToolsCommandResult::GetOuterHtml(- crate::devtools_runtime::DevToolsGetOuterHtmlResult {- outer_html: "<html><body>source</body></html>".to_owned(),- },- ),- )+ CommandOutputPlan::from_devtools_result(crate::automation::AutomationResult::GetOuterHtml(+ crate::automation::DevToolsGetOuterHtmlResult {+ outer_html: "<html><body>source</body></html>".to_owned(),+ },+ )).emit_into(&mut out, Some(14), None);assert_eq!(@@ -2410,11 +2394,9 @@ mod tests {let outer_html_pointer = outer_html.as_ptr();let mut out = Vec::new();- CommandOutputPlan::from_devtools_result(- crate::devtools_runtime::DevToolsCommandResult::GetOuterHtml(- crate::devtools_runtime::DevToolsGetOuterHtmlResult { outer_html },- ),- )+ CommandOutputPlan::from_devtools_result(crate::automation::AutomationResult::GetOuterHtml(+ crate::automation::DevToolsGetOuterHtmlResult { outer_html },+ )).emit_into(&mut out, Some(14), None);assert_eq!(@@ -2431,8 +2413,8 @@ mod tests {fn command_output_plan_serializes_devtools_query_selector_result() {let mut out = Vec::new();CommandOutputPlan::from_devtools_result(- crate::devtools_runtime::DevToolsCommandResult::QuerySelector(- crate::devtools_runtime::DevToolsQuerySelectorResult {+ crate::automation::AutomationResult::QuerySelector(+ crate::automation::DevToolsQuerySelectorResult {node_ids: vec![7, 9],multiple: true,},@@ -2452,8 +2434,8 @@ mod tests {let mut out = Vec::new();CommandOutputPlan::from_devtools_result(- crate::devtools_runtime::DevToolsCommandResult::QuerySelector(- crate::devtools_runtime::DevToolsQuerySelectorResult {+ crate::automation::AutomationResult::QuerySelector(+ crate::automation::DevToolsQuerySelectorResult {node_ids: Vec::new(),multiple: false,},@@ -2476,14 +2458,14 @@ mod tests {fn command_output_plan_serializes_devtools_get_attributes_result() {let mut out = Vec::new();CommandOutputPlan::from_devtools_result(- crate::devtools_runtime::DevToolsCommandResult::GetAttributes(- crate::devtools_runtime::DevToolsGetAttributesResult {+ crate::automation::AutomationResult::GetAttributes(+ crate::automation::DevToolsGetAttributesResult {attributes: vec![- crate::devtools_runtime::DevToolsDomAttribute {+ crate::automation::DevToolsDomAttribute {name: "id".to_owned(),value: "target".to_owned(),},- crate::devtools_runtime::DevToolsDomAttribute {+ crate::automation::DevToolsDomAttribute {name: "data-kind".to_owned(),value: "primary".to_owned(),},@@ -2507,13 +2489,11 @@ mod tests {#[test]fn command_output_plan_serializes_devtools_get_text_result() {let mut out = Vec::new();- CommandOutputPlan::from_devtools_result(- crate::devtools_runtime::DevToolsCommandResult::GetText(- crate::devtools_runtime::DevToolsGetTextResult {- text: "element text".to_owned(),- },- ),- )+ CommandOutputPlan::from_devtools_result(crate::automation::AutomationResult::GetText(+ crate::automation::DevToolsGetTextResult {+ text: "element text".to_owned(),+ },+ )).emit_into(&mut out, Some(18), None);assert_eq!(@@ -2530,13 +2510,11 @@ mod tests {#[test]fn command_output_plan_serializes_devtools_get_property_result() {let mut out = Vec::new();- CommandOutputPlan::from_devtools_result(- crate::devtools_runtime::DevToolsCommandResult::GetProperty(- crate::devtools_runtime::DevToolsGetPropertyResult {- value: json!("property value"),- },- ),- )+ CommandOutputPlan::from_devtools_result(crate::automation::AutomationResult::GetProperty(+ crate::automation::DevToolsGetPropertyResult {+ value: json!("property value"),+ },+ )).emit_into(&mut out, Some(19), None);assert_eq!(@@ -2553,13 +2531,11 @@ mod tests {#[test]fn command_output_plan_serializes_devtools_create_target_result() {let mut out = Vec::new();- CommandOutputPlan::from_devtools_result(- crate::devtools_runtime::DevToolsCommandResult::CreateTarget(- crate::devtools_runtime::DevToolsCreateTargetResult {- target_id: crate::devtools_runtime::DevToolsTargetId::from("TARGET-1"),- },- ),- )+ CommandOutputPlan::from_devtools_result(crate::automation::AutomationResult::CreateTarget(+ crate::automation::DevToolsCreateTargetResult {+ target_id: crate::automation::DevToolsTargetId::from("TARGET-1"),+ },+ )).emit_into(&mut out, Some(16), None);assert_eq!(@@ -2574,11 +2550,9 @@ mod tests {#[test]fn command_output_plan_serializes_devtools_close_target_result() {let mut out = Vec::new();- CommandOutputPlan::from_devtools_result(- crate::devtools_runtime::DevToolsCommandResult::CloseTarget(- crate::devtools_runtime::DevToolsCloseTargetResult { success: true },- ),- )+ CommandOutputPlan::from_devtools_result(crate::automation::AutomationResult::CloseTarget(+ crate::automation::DevToolsCloseTargetResult { success: true },+ )).emit_into(&mut out, Some(17), None);assert_eq!(@@ -2594,9 +2568,9 @@ mod tests {fn command_output_plan_serializes_devtools_add_preload_script_result() {let mut out = Vec::new();CommandOutputPlan::from_devtools_result(- crate::devtools_runtime::DevToolsCommandResult::AddPreloadScript(- crate::devtools_runtime::DevToolsAddPreloadScriptResult {- script_id: crate::devtools_runtime::DevToolsPreloadScriptId::from("SCRIPT-1"),+ crate::automation::AutomationResult::AddPreloadScript(+ crate::automation::DevToolsAddPreloadScriptResult {+ script_id: crate::automation::DevToolsPreloadScriptId::from("SCRIPT-1"),},),)@@ -2614,26 +2588,22 @@ mod tests {#[test]fn command_output_plan_serializes_devtools_script_exception_result() {let mut out = Vec::new();- CommandOutputPlan::from_devtools_result(- crate::devtools_runtime::DevToolsCommandResult::Script(Box::new(- crate::devtools_runtime::DevToolsScriptResult::Exception(- crate::devtools_runtime::DevToolsScriptException {- exception_id: Some(42),- script_id: None,- text: "boom".to_owned(),- value: Some(- crate::devtools_runtime::DevToolsRemoteValue::from_json_value(json!(- "boom"- )),- ),- realm: None,- line_number: None,- column_number: None,- stack_trace: None,- },- ),+ CommandOutputPlan::from_devtools_result(crate::automation::AutomationResult::Script(+ Box::new(crate::automation::DevToolsScriptResult::Exception(+ crate::automation::DevToolsScriptException {+ exception_id: Some(42),+ script_id: None,+ text: "boom".to_owned(),+ value: Some(crate::automation::DevToolsRemoteValue::from_json_value(+ json!("boom"),+ )),+ realm: None,+ line_number: None,+ column_number: None,+ stack_trace: None,+ },)),- )+ )).emit_into(&mut out, Some(14), None);assert_eq!(out[0]["id"], json!(14));@@ -2652,26 +2622,22 @@ mod tests {#[test]fn command_output_plan_omits_missing_devtools_script_exception_id() {let mut out = Vec::new();- CommandOutputPlan::from_devtools_result(- crate::devtools_runtime::DevToolsCommandResult::Script(Box::new(- crate::devtools_runtime::DevToolsScriptResult::Exception(- crate::devtools_runtime::DevToolsScriptException {- exception_id: None,- script_id: None,- text: "boom".to_owned(),- value: Some(- crate::devtools_runtime::DevToolsRemoteValue::from_json_value(json!(- "boom"- )),- ),- realm: None,- line_number: None,- column_number: None,- stack_trace: None,- },- ),+ CommandOutputPlan::from_devtools_result(crate::automation::AutomationResult::Script(+ Box::new(crate::automation::DevToolsScriptResult::Exception(+ crate::automation::DevToolsScriptException {+ exception_id: None,+ script_id: None,+ text: "boom".to_owned(),+ value: Some(crate::automation::DevToolsRemoteValue::from_json_value(+ json!("boom"),+ )),+ realm: None,+ line_number: None,+ column_number: None,+ stack_trace: None,+ },)),- )+ )).emit_into(&mut out, Some(14), None);assert_eq!(out[0]["id"], json!(14));@@ -2688,8 +2654,8 @@ mod tests {#[test]fn command_output_plan_serializes_devtools_error() {let mut out = Vec::new();- CommandOutputPlan::from_devtools_error(crate::devtools_runtime::DevToolsError::new(- crate::devtools_runtime::DevToolsErrorKind::NoSuchSession,+ CommandOutputPlan::from_devtools_error(crate::automation::DevToolsError::new(+ crate::automation::DevToolsErrorKind::NoSuchSession,"Unknown sessionId",)).emit_into(&mut out, Some(15), Some("SID-missing"));diff --git a/moli-protocol/src/domains/css/native.rs b/moli-protocol/src/domains/css/native.rsindex 9825e24b0..1122060ec 100644--- a/moli-protocol/src/domains/css/native.rs+++ b/moli-protocol/src/domains/css/native.rs@@ -1,5 +1,5 @@use super::*;-use crate::devtools_runtime::DevToolsDomNodeReference;+use crate::automation::DevToolsDomNodeReference;use crate::domains::native::{self, NativeCommandStep, NodeLookupExecution};use moli_core::{RendererNativeOperation as Operation, RendererNativeProtocolResponse as Response,diff --git a/moli-protocol/src/domains/dom/child_frame.rs b/moli-protocol/src/domains/dom/child_frame.rsindex 831ae56e9..9148d82e9 100644--- a/moli-protocol/src/domains/dom/child_frame.rs+++ b/moli-protocol/src/domains/dom/child_frame.rs@@ -9,15 +9,14 @@ use super::{text_result_from_renderer_resolution,},};-use crate::conn::{CdpConnection, CommandOwnerScope};-use crate::devtools_runtime::{- DevToolsCommand, DevToolsCommandResult, DevToolsDescribeNodeCommand,- DevToolsDescribeNodeResult, DevToolsDomGeometryCommand, DevToolsDomGeometryResult,- DevToolsDomNodeReference, DevToolsGetAttributesResult, DevToolsGetOuterHtmlCommand,- DevToolsGetOuterHtmlResult, DevToolsGetPropertyResult, DevToolsGetTextResult,- DevToolsQuerySelectorResult, DevToolsResolveNodeCommand, DevToolsResolveNodeResult,- DevToolsScrollIntoViewIfNeededCommand,+use crate::automation::{+ AutomationCommand, AutomationResult, DevToolsDescribeNodeCommand, DevToolsDescribeNodeResult,+ DevToolsDomGeometryCommand, DevToolsDomGeometryResult, DevToolsDomNodeReference,+ DevToolsGetAttributesResult, DevToolsGetOuterHtmlCommand, DevToolsGetOuterHtmlResult,+ DevToolsGetPropertyResult, DevToolsGetTextResult, DevToolsQuerySelectorResult,+ DevToolsResolveNodeCommand, DevToolsResolveNodeResult, DevToolsScrollIntoViewIfNeededCommand,};+use crate::conn::{CdpConnection, CommandOwnerScope};use moli_core::page::{DocumentNodeRuntimeObjectResolution, Page, PendingPageCommand, RendererDocumentNodeGeometry,RendererDocumentNodeReference,@@ -42,10 +41,10 @@ pub(super) async fn execute_devtools_dom_command(conn: &mut CdpConnection,frame_id: &str,owner: &CommandOwnerScope,- command: DevToolsCommand,-) -> Result<DevToolsCommandResult, PendingDomCommandStartError> {+ command: AutomationCommand,+) -> Result<AutomationResult, PendingDomCommandStartError> {match command {- DevToolsCommand::QuerySelector(command) => {+ AutomationCommand::QuerySelector(command) => {let result = query_selector_command(conn,owner,@@ -55,21 +54,21 @@ pub(super) async fn execute_devtools_dom_command(command.multiple,).await?;- Ok(DevToolsCommandResult::QuerySelector(result))+ Ok(AutomationResult::QuerySelector(result))}- DevToolsCommand::GetAttributes(command) => {+ AutomationCommand::GetAttributes(command) => {let result = attributes_command(conn, owner, command.reference).await?;- Ok(DevToolsCommandResult::GetAttributes(result))+ Ok(AutomationResult::GetAttributes(result))}- DevToolsCommand::GetText(command) => {+ AutomationCommand::GetText(command) => {let result = text_command(conn, owner, command.reference).await?;- Ok(DevToolsCommandResult::GetText(result))+ Ok(AutomationResult::GetText(result))}- DevToolsCommand::GetProperty(command) => {+ AutomationCommand::GetProperty(command) => {let result = property_command(conn, owner, command.reference, &command.name).await?;- Ok(DevToolsCommandResult::GetProperty(result))+ Ok(AutomationResult::GetProperty(result))}- DevToolsCommand::GetOuterHtml(command) => {+ AutomationCommand::GetOuterHtml(command) => {let DevToolsGetOuterHtmlCommand {context: _,reference,@@ -77,25 +76,25 @@ pub(super) async fn execute_devtools_dom_command(} = command;let outer_html =outer_html_command(conn, owner, frame_id, reference, include_shadow_dom).await?;- Ok(DevToolsCommandResult::GetOuterHtml(- DevToolsGetOuterHtmlResult { outer_html },- ))+ Ok(AutomationResult::GetOuterHtml(DevToolsGetOuterHtmlResult {+ outer_html,+ }))}- DevToolsCommand::DescribeNode(command) => {+ AutomationCommand::DescribeNode(command) => {let result = describe_node_command(conn, owner, frame_id, command).await?;- Ok(DevToolsCommandResult::DescribeNode(result))+ Ok(AutomationResult::DescribeNode(result))}- DevToolsCommand::ResolveNode(command) => {+ AutomationCommand::ResolveNode(command) => {let result = resolve_node_command(conn, owner, command).await?;- Ok(DevToolsCommandResult::ResolveNode(result))+ Ok(AutomationResult::ResolveNode(result))}- DevToolsCommand::DomGeometry(command) => {+ AutomationCommand::DomGeometry(command) => {let result = dom_geometry_command(conn, owner, command).await?;- Ok(DevToolsCommandResult::DomGeometry(result))+ Ok(AutomationResult::DomGeometry(result))}- DevToolsCommand::ScrollIntoViewIfNeeded(command) => {+ AutomationCommand::ScrollIntoViewIfNeeded(command) => {scroll_into_view_if_needed_command(conn, owner, command).await?;- Ok(DevToolsCommandResult::Empty)+ Ok(AutomationResult::Empty)}_ => Err(PendingDomCommandStartError::no_such_target()),}diff --git a/moli-protocol/src/domains/dom/frontend_binding.rs b/moli-protocol/src/domains/dom/frontend_binding.rsindex 5ef3de30a..037bd41f1 100644--- a/moli-protocol/src/domains/dom/frontend_binding.rs+++ b/moli-protocol/src/domains/dom/frontend_binding.rs@@ -1,4 +1,4 @@-use crate::devtools_runtime::DevToolsDomNodeReference;+use crate::automation::DevToolsDomNodeReference;use moli_core::page::{CompletedPageCommand, Page, RendererDomFrontendNodeBindingResolution};pub(super) fn finish_reference(diff --git a/moli-protocol/src/domains/dom/node_references.rs b/moli-protocol/src/domains/dom/node_references.rsindex 4f0b556ed..3d05a6e97 100644--- a/moli-protocol/src/domains/dom/node_references.rs+++ b/moli-protocol/src/domains/dom/node_references.rs@@ -1,4 +1,4 @@-use crate::devtools_runtime::DevToolsDomNodeReference;+use crate::automation::DevToolsDomNodeReference;pub(super) use crate::domains::native::NodeReferenceParams;pub(super) fn devtools_node_reference_from_ids(diff --git a/moli-protocol/src/domains/dom/resolve.rs b/moli-protocol/src/domains/dom/resolve.rsindex 9786489d4..5b9c66f43 100644--- a/moli-protocol/src/domains/dom/resolve.rs+++ b/moli-protocol/src/domains/dom/resolve.rs@@ -5,23 +5,22 @@ use serde_json::{Value, json};use super::node_references::{NodeReferenceParams, devtools_node_reference_from_ids};use super::*;-use crate::conn::BackgroundProtocolEvent;-use crate::devtools_runtime::{- DevToolsCommand, DevToolsCommandResult, DevToolsDescribeNodeCommand,- DevToolsDescribeNodeResult, DevToolsDomAttribute, DevToolsDomBoxModel,- DevToolsDomGeometryCommand, DevToolsDomGeometryOperation, DevToolsDomGeometryResult,- DevToolsDomNodeReference, DevToolsDomObjectReferenceCommand,- DevToolsDomObjectReferenceOperation, DevToolsDomQuad, DevToolsError, DevToolsErrorKind,- DevToolsFrameId, DevToolsGetAttributesCommand, DevToolsGetAttributesResult,- DevToolsGetDocumentCommand, DevToolsGetFrameOwnerCommand, DevToolsGetFrameOwnerResult,- DevToolsGetNodeForLocationCommand, DevToolsGetNodeForLocationResult,- DevToolsGetOuterHtmlCommand, DevToolsGetOuterHtmlResult, DevToolsGetPropertyCommand,- DevToolsGetPropertyResult, DevToolsGetTextCommand, DevToolsGetTextResult,- DevToolsPushNodesByBackendIdsCommand, DevToolsPushNodesByBackendIdsResult,- DevToolsQuerySelectorCommand, DevToolsQuerySelectorResult, DevToolsRemoteHandleId,- DevToolsRemoveNodeCommand, DevToolsRequestChildNodesCommand, DevToolsResolveNodeCommand,- DevToolsResolveNodeResult, DevToolsScrollIntoViewIfNeededCommand,+use crate::automation::{+ AutomationCommand, AutomationResult, DevToolsDescribeNodeCommand, DevToolsDescribeNodeResult,+ DevToolsDomAttribute, DevToolsDomBoxModel, DevToolsDomGeometryCommand,+ DevToolsDomGeometryOperation, DevToolsDomGeometryResult, DevToolsDomNodeReference,+ DevToolsDomObjectReferenceCommand, DevToolsDomObjectReferenceOperation, DevToolsDomQuad,+ DevToolsError, DevToolsErrorKind, DevToolsFrameId, DevToolsGetAttributesCommand,+ DevToolsGetAttributesResult, DevToolsGetDocumentCommand, DevToolsGetFrameOwnerCommand,+ DevToolsGetFrameOwnerResult, DevToolsGetNodeForLocationCommand,+ DevToolsGetNodeForLocationResult, DevToolsGetOuterHtmlCommand, DevToolsGetOuterHtmlResult,+ DevToolsGetPropertyCommand, DevToolsGetPropertyResult, DevToolsGetTextCommand,+ DevToolsGetTextResult, DevToolsPushNodesByBackendIdsCommand,+ DevToolsPushNodesByBackendIdsResult, DevToolsQuerySelectorCommand, DevToolsQuerySelectorResult,+ DevToolsRemoteHandleId, DevToolsRemoveNodeCommand, DevToolsRequestChildNodesCommand,+ DevToolsResolveNodeCommand, DevToolsResolveNodeResult, DevToolsScrollIntoViewIfNeededCommand,};+use crate::conn::BackgroundProtocolEvent;use crate::domains::actions::DomAction;use crate::domains::command_output::CommandOutputPlan;use chromiumoxide_cdp::cdp::browser_protocol::dom::{@@ -164,11 +163,11 @@ pub(crate) enum DomCommandTaskStep {pub(super) enum DevToolsDomCommandTaskStep {Pending(Box<PendingDomCommandDispatch>),- Complete(Box<Result<DevToolsCommandResult, DevToolsError>>),+ Complete(Box<Result<AutomationResult, DevToolsError>>),}pub(super) fn devtools_dom_command_task_complete(- result: Result<DevToolsCommandResult, DevToolsError>,+ result: Result<AutomationResult, DevToolsError>,) -> DevToolsDomCommandTaskStep {DevToolsDomCommandTaskStep::Complete(Box::new(result))}diff --git a/moli-protocol/src/domains/dom/resolve/command_start.rs b/moli-protocol/src/domains/dom/resolve/command_start.rsindex f560c3985..ad6e84047 100644--- a/moli-protocol/src/domains/dom/resolve/command_start.rs+++ b/moli-protocol/src/domains/dom/resolve/command_start.rs@@ -35,7 +35,7 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::GetDocument(command),+ AutomationCommand::GetDocument(command),);}if action == DomAction::GetFlattenedDocument {@@ -48,7 +48,7 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::GetDocument(command),+ AutomationCommand::GetDocument(command),);}if action == DomAction::RequestChildNodes {@@ -57,7 +57,7 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::RequestChildNodes(command),+ AutomationCommand::RequestChildNodes(command),);}if action == DomAction::QuerySelector {@@ -66,7 +66,7 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::QuerySelector(command),+ AutomationCommand::QuerySelector(command),);}if action == DomAction::QuerySelectorAll {@@ -75,7 +75,7 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::QuerySelector(command),+ AutomationCommand::QuerySelector(command),);}if action == DomAction::PerformSearch {@@ -84,7 +84,7 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::PerformSearch(command),+ AutomationCommand::PerformSearch(command),);}if action == DomAction::GetSearchResults {@@ -93,7 +93,7 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::GetSearchResults(command),+ AutomationCommand::GetSearchResults(command),);}if action == DomAction::DiscardSearchResults {@@ -104,7 +104,7 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::DiscardSearchResults(command),+ AutomationCommand::DiscardSearchResults(command),);}if action == DomAction::SetNodeStackTracesEnabled {@@ -119,7 +119,7 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::ResolveNode(command),+ AutomationCommand::ResolveNode(command),);}if action == DomAction::GetFrameOwner {@@ -128,7 +128,7 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::GetFrameOwner(command),+ AutomationCommand::GetFrameOwner(command),);}if action == DomAction::GetAttributes {@@ -137,7 +137,7 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::GetAttributes(command),+ AutomationCommand::GetAttributes(command),);}if action == DomAction::GetNodeForLocation {@@ -146,7 +146,7 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::GetNodeForLocation(command),+ AutomationCommand::GetNodeForLocation(command),);}if action == DomAction::RequestNode {@@ -160,7 +160,7 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::DomObjectReference(command),+ AutomationCommand::DomObjectReference(command),);}if action == DomAction::DescribeNode {@@ -182,14 +182,14 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::DomObjectReference(command),+ AutomationCommand::DomObjectReference(command),);};return start_devtools_dom_command_for_owner(conn,cmd.id,&owner,- DevToolsCommand::DescribeNode(command),+ AutomationCommand::DescribeNode(command),);}if action == DomAction::GetOuterHtml {@@ -212,7 +212,7 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::DomObjectReference(command),+ AutomationCommand::DomObjectReference(command),);}let Some(command) = build_cdp_get_outer_html_command(conn, cmd)? else {@@ -222,7 +222,7 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::GetOuterHtml(command),+ AutomationCommand::GetOuterHtml(command),);}if action == DomAction::ScrollIntoViewIfNeeded {@@ -244,7 +244,7 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::DomObjectReference(command),+ AutomationCommand::DomObjectReference(command),);}let Some(command) = build_cdp_scroll_into_view_if_needed_command(conn, cmd)? else {@@ -254,7 +254,7 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::ScrollIntoViewIfNeeded(command),+ AutomationCommand::ScrollIntoViewIfNeeded(command),);}if action == DomAction::Focus {@@ -269,7 +269,7 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::SetFileInputFiles(command),+ AutomationCommand::SetFileInputFiles(command),);}if matches!(@@ -294,7 +294,7 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::PushNodesByBackendIds(command),+ AutomationCommand::PushNodesByBackendIds(command),);}if matches!(action, DomAction::GetBoxModel | DomAction::GetContentQuads) {@@ -315,14 +315,14 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::DomObjectReference(command),+ AutomationCommand::DomObjectReference(command),);};return start_devtools_dom_command_for_owner(conn,cmd.id,&owner,- DevToolsCommand::DomGeometry(command),+ AutomationCommand::DomGeometry(command),);}if action == DomAction::RemoveNode {@@ -333,7 +333,7 @@ pub(super) fn start_pending_dom_command(conn,cmd.id,&owner,- DevToolsCommand::RemoveNode(command),+ AutomationCommand::RemoveNode(command),);}@@ -525,7 +525,7 @@ pub(super) fn build_cdp_remove_node_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Ok(Some(DevToolsRemoveNodeCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),reference,}))}@@ -575,7 +575,7 @@ pub(super) fn build_cdp_dom_geometry_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Ok(Some(DevToolsDomGeometryCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),reference,operation,}))@@ -631,7 +631,7 @@ pub(super) fn build_cdp_describe_node_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Ok(Some(DevToolsDescribeNodeCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),reference,depth: params.depth,pierce: params.pierce,@@ -712,7 +712,7 @@ pub(super) fn build_cdp_request_child_nodes_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Ok(DevToolsRequestChildNodesCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),reference: DevToolsDomNodeReference::FrontendNodeId(cdp_node_id_value),depth,pierce: params.pierce.unwrap_or(false),@@ -844,7 +844,7 @@ pub(super) fn build_cdp_query_selector_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Ok(DevToolsQuerySelectorCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),root: Some(DevToolsDomNodeReference::FrontendNodeId(cdp_node_id_value)),selector,multiple,@@ -957,7 +957,7 @@ pub(super) fn build_cdp_get_document_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Ok(DevToolsGetDocumentCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),depth,pierce: params.pierce.unwrap_or(false),flattened: matches!(@@ -971,69 +971,69 @@ pub(super) fn start_devtools_dom_command_for_owner(conn: &mut CdpConnection,command_id: Option<u64>,owner: &CommandOwnerScope,- command: DevToolsCommand,+ command: AutomationCommand,) -> Result<Option<PendingDomCommandDispatch>, PendingDomCommandStartError> {match command {- DevToolsCommand::GetFrameOwner(command) => {+ AutomationCommand::GetFrameOwner(command) => {start_devtools_get_frame_owner_command(conn, command_id, owner, command)}- DevToolsCommand::GetAttributes(command) => {+ AutomationCommand::GetAttributes(command) => {start_devtools_get_attributes_command(conn, command_id, owner, command)}- DevToolsCommand::GetText(command) => {+ AutomationCommand::GetText(command) => {start_devtools_get_text_command(conn, command_id, owner, command)}- DevToolsCommand::GetProperty(command) => {+ AutomationCommand::GetProperty(command) => {start_devtools_get_property_command(conn, command_id, owner, command)}- DevToolsCommand::GetDocument(command) => {+ AutomationCommand::GetDocument(command) => {start_devtools_get_document_command(conn, command_id, owner, command)}- DevToolsCommand::RequestChildNodes(command) => {+ AutomationCommand::RequestChildNodes(command) => {start_devtools_request_child_nodes_command(conn, command_id, owner, command)}- DevToolsCommand::QuerySelector(command) => {+ AutomationCommand::QuerySelector(command) => {start_devtools_query_selector_command(conn, command_id, owner, command)}- DevToolsCommand::PerformSearch(command) => {+ AutomationCommand::PerformSearch(command) => {search::start_devtools_perform_search_command(conn, command_id, owner, command)}- DevToolsCommand::GetSearchResults(command) => {+ AutomationCommand::GetSearchResults(command) => {search::start_devtools_get_search_results_command(conn, command_id, owner, command)}- DevToolsCommand::DiscardSearchResults(command) => {+ AutomationCommand::DiscardSearchResults(command) => {search::start_devtools_discard_search_results_command(conn, command_id, owner, command)}- DevToolsCommand::GetNodeForLocation(command) => {+ AutomationCommand::GetNodeForLocation(command) => {start_devtools_get_node_for_location_command(conn, command_id, owner, command)}- DevToolsCommand::ResolveNode(command) => {+ AutomationCommand::ResolveNode(command) => {start_devtools_resolve_node_command(conn, command_id, owner, command)}- DevToolsCommand::DescribeNode(command) => {+ AutomationCommand::DescribeNode(command) => {start_devtools_describe_node_command(conn, command_id, owner, command)}- DevToolsCommand::DomObjectReference(command) => {+ AutomationCommand::DomObjectReference(command) => {start_devtools_dom_object_reference_command(conn, command_id, owner, command)}- DevToolsCommand::SetFileInputFiles(command) => {+ AutomationCommand::SetFileInputFiles(command) => {set_file_input::start_devtools_set_file_input_files_command(conn, command_id, owner, command,)}- DevToolsCommand::PushNodesByBackendIds(command) => {+ AutomationCommand::PushNodesByBackendIds(command) => {start_devtools_push_nodes_by_backend_ids_command(conn, command_id, owner, command)}- DevToolsCommand::GetOuterHtml(command) => {+ AutomationCommand::GetOuterHtml(command) => {start_devtools_get_outer_html_command(conn, command_id, owner, command)}- DevToolsCommand::DomGeometry(command) => {+ AutomationCommand::DomGeometry(command) => {start_devtools_dom_geometry_command(conn, command_id, owner, command)}- DevToolsCommand::ScrollIntoViewIfNeeded(command) => {+ AutomationCommand::ScrollIntoViewIfNeeded(command) => {start_devtools_scroll_into_view_if_needed_command(conn, command_id, owner, command)}- DevToolsCommand::RemoveNode(command) => {+ AutomationCommand::RemoveNode(command) => {start_devtools_remove_node_command(conn, command_id, owner, command)}_ => Err(PendingDomCommandStartError {@@ -1045,25 +1045,25 @@ pub(super) fn start_devtools_dom_command_for_owner(pub(super) fn complete_devtools_dom_command(conn: &mut CdpConnection,- command: DevToolsCommand,+ command: AutomationCommand,) -> Result<Value, PendingDomCommandStartError> {match command {- DevToolsCommand::GetFrameOwner(command) => {+ AutomationCommand::GetFrameOwner(command) => {complete_devtools_get_frame_owner_command(conn, command)}- DevToolsCommand::GetAttributes(_)- | DevToolsCommand::GetText(_)- | DevToolsCommand::GetProperty(_) => Err(PendingDomCommandStartError {+ AutomationCommand::GetAttributes(_)+ | AutomationCommand::GetText(_)+ | AutomationCommand::GetProperty(_) => Err(PendingDomCommandStartError {code: -32000,message: "MissingDomCommand".to_owned(),}),- DevToolsCommand::PushNodesByBackendIds(_) => Err(PendingDomCommandStartError {+ AutomationCommand::PushNodesByBackendIds(_) => Err(PendingDomCommandStartError {code: -32000,message: "MissingDomCommand".to_owned(),}),- DevToolsCommand::DescribeNode(_)- | DevToolsCommand::GetOuterHtml(_)- | DevToolsCommand::ScrollIntoViewIfNeeded(_) => Err(PendingDomCommandStartError {+ AutomationCommand::DescribeNode(_)+ | AutomationCommand::GetOuterHtml(_)+ | AutomationCommand::ScrollIntoViewIfNeeded(_) => Err(PendingDomCommandStartError {code: -32000,message: "MissingDomCommand".to_owned(),}),@@ -1127,7 +1127,7 @@ pub(super) fn build_cdp_get_frame_owner_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Ok(DevToolsGetFrameOwnerCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),frame_id: DevToolsFrameId::new(params.frame_id.as_ref()),})}@@ -1180,7 +1180,7 @@ pub(super) fn build_cdp_get_node_for_location_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Ok(DevToolsGetNodeForLocationCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),x: params.x as f64,y: params.y as f64,include_user_agent_shadow_dom: params.include_user_agent_shadow_dom.unwrap_or(false),@@ -1247,7 +1247,7 @@ pub(super) fn build_cdp_resolve_node_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Ok(DevToolsResolveNodeCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),reference,execution_context_id: params.execution_context_id,object_group: params.object_group,@@ -1391,7 +1391,7 @@ pub(super) fn build_cdp_dom_object_reference_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Ok(Some(DevToolsDomObjectReferenceCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),object_id: DevToolsRemoteHandleId::from(object_id),operation,}))diff --git a/moli-protocol/src/domains/dom/resolve/node_completion.rs b/moli-protocol/src/domains/dom/resolve/node_completion.rsindex 903b40b8e..d3383d4ce 100644--- a/moli-protocol/src/domains/dom/resolve/node_completion.rs+++ b/moli-protocol/src/domains/dom/resolve/node_completion.rs@@ -216,7 +216,7 @@ pub(super) fn complete_pending_dom_command_result()));};set_file_input::complete_set_file_input_files_result(page, completion)- .map(|()| DevToolsCommandResult::Empty)+ .map(|()| AutomationResult::Empty)}PendingDomCommandKind::SetFileInputFilesObjectReference => {let Some(page) = loaded_page_mut_for_owner(conn, &owner_scope) else {@@ -226,7 +226,7 @@ pub(super) fn complete_pending_dom_command_result()));};set_file_input::complete_set_file_input_files_object_reference_result(page, completion)- .map(|()| DevToolsCommandResult::Empty)+ .map(|()| AutomationResult::Empty)}PendingDomCommandKind::GetNodeForLocation { top_frame_id } => {let Some(page) = loaded_page_mut_for_owner(conn, &owner_scope) else {@@ -236,7 +236,7 @@ pub(super) fn complete_pending_dom_command_result()));};finish_document_hit_test(page, completion, top_frame_id)- .map(DevToolsCommandResult::GetNodeForLocation)+ .map(AutomationResult::GetNodeForLocation)}PendingDomCommandKind::RendererBackendNodeClientRect { operation } => {let Some(page) = loaded_page_mut_for_owner(conn, &owner_scope) else {@@ -250,7 +250,7 @@ pub(super) fn complete_pending_dom_command_result(operation,"Could not resolve node geometry",)- .map(DevToolsCommandResult::DomGeometry)+ .map(AutomationResult::DomGeometry)}PendingDomCommandKind::RendererBackendNodeScrollIntoViewIfNeeded => {let Some(page) = loaded_page_mut_for_owner(conn, &owner_scope) else {@@ -260,7 +260,7 @@ pub(super) fn complete_pending_dom_command_result()));};complete_renderer_backend_node_scroll_into_view_if_needed_result(page, completion)- .map(|()| DevToolsCommandResult::Empty)+ .map(|()| AutomationResult::Empty)}PendingDomCommandKind::PushNodesByBackendIdsToFrontend {backend_node_ids,@@ -280,7 +280,7 @@ pub(super) fn complete_pending_dom_command_result(node_ids,renderer_backend_positions,) {- Ok(result) => Ok(DevToolsCommandResult::PushNodesByBackendIds(result)),+ Ok(result) => Ok(AutomationResult::PushNodesByBackendIds(result)),Err(error) => Err(error),}}@@ -292,7 +292,7 @@ pub(super) fn complete_pending_dom_command_result()));};complete_get_frame_owner_result(page, completion, &frame_id)- .map(DevToolsCommandResult::GetFrameOwner)+ .map(AutomationResult::GetFrameOwner)}PendingDomCommandKind::QuerySelectorLive { multiple } => {let Some(page) = loaded_page_mut_for_owner(conn, &owner_scope) else {@@ -302,7 +302,7 @@ pub(super) fn complete_pending_dom_command_result()));};complete_query_selector_live_result(page, completion, multiple)- .map(DevToolsCommandResult::QuerySelector)+ .map(AutomationResult::QuerySelector)}PendingDomCommandKind::QuerySelectorSetChildNodesLive { multiple, .. } => {let Some(page) = loaded_page_mut_for_owner(conn, &owner_scope) else {@@ -312,7 +312,7 @@ pub(super) fn complete_pending_dom_command_result()));};complete_query_selector_set_child_nodes_live_result(page, completion, multiple)- .map(DevToolsCommandResult::QuerySelector)+ .map(AutomationResult::QuerySelector)}PendingDomCommandKind::GetAttributesLive => {let Some(page) = loaded_page_mut_for_owner(conn, &owner_scope) else {@@ -322,7 +322,7 @@ pub(super) fn complete_pending_dom_command_result()));};complete_get_attributes_live_result(page, completion)- .map(DevToolsCommandResult::GetAttributes)+ .map(AutomationResult::GetAttributes)}PendingDomCommandKind::GetTextLive => {let Some(page) = loaded_page_mut_for_owner(conn, &owner_scope) else {@@ -331,7 +331,7 @@ pub(super) fn complete_pending_dom_command_result("NoDocumentLoaded",)));};- complete_get_text_live_result(page, completion).map(DevToolsCommandResult::GetText)+ complete_get_text_live_result(page, completion).map(AutomationResult::GetText)}PendingDomCommandKind::GetPropertyLive => {let Some(page) = loaded_page_mut_for_owner(conn, &owner_scope) else {@@ -340,8 +340,7 @@ pub(super) fn complete_pending_dom_command_result("NoDocumentLoaded",)));};- complete_get_property_live_result(page, completion)- .map(DevToolsCommandResult::GetProperty)+ complete_get_property_live_result(page, completion).map(AutomationResult::GetProperty)}PendingDomCommandKind::ResolveNode {object_group,@@ -397,9 +396,12 @@ pub(super) fn complete_pending_dom_command_result())),};}- Ok(DevToolsCommandResult::ResolveNode(- register_resolve_node_result(conn, &owner_scope, remote_object, object_group),- ))+ Ok(AutomationResult::ResolveNode(register_resolve_node_result(+ conn,+ &owner_scope,+ remote_object,+ object_group,+ )))}PendingDomCommandKind::ResolveNodeCacheSnapshot {remote_object,@@ -431,9 +433,12 @@ pub(super) fn complete_pending_dom_command_result(}}}- Ok(DevToolsCommandResult::ResolveNode(- register_resolve_node_result(conn, &owner_scope, *remote_object, object_group),- ))+ Ok(AutomationResult::ResolveNode(register_resolve_node_result(+ conn,+ &owner_scope,+ *remote_object,+ object_group,+ )))}PendingDomCommandKind::ResolveNodeExecutionContextFrame {reference,@@ -470,7 +475,7 @@ pub(super) fn complete_pending_dom_command_result()));};complete_object_reference_live_client_rect_result(page, completion, operation)- .map(DevToolsCommandResult::DomGeometry)+ .map(AutomationResult::DomGeometry)}PendingDomCommandKind::GetOuterHtmlObjectReference => {let Some(page) = loaded_page_mut_for_owner(conn, &owner_scope) else {@@ -480,7 +485,7 @@ pub(super) fn complete_pending_dom_command_result()));};complete_get_outer_html_object_reference_result(page, completion)- .map(DevToolsCommandResult::GetOuterHtml)+ .map(AutomationResult::GetOuterHtml)}PendingDomCommandKind::GetOuterHtmlDocument => {let Some(page) = loaded_page_mut_for_owner(conn, &owner_scope) else {@@ -490,7 +495,7 @@ pub(super) fn complete_pending_dom_command_result()));};complete_get_outer_html_document_result(page, completion)- .map(DevToolsCommandResult::GetOuterHtml)+ .map(AutomationResult::GetOuterHtml)}PendingDomCommandKind::GetOuterHtmlBackendNodeReference => {let Some(page) = loaded_page_mut_for_owner(conn, &owner_scope) else {@@ -500,7 +505,7 @@ pub(super) fn complete_pending_dom_command_result()));};complete_get_outer_html_backend_node_reference_result(page, completion)- .map(DevToolsCommandResult::GetOuterHtml)+ .map(AutomationResult::GetOuterHtml)}PendingDomCommandKind::ScrollIntoViewIfNeededObjectReference => {let Some(page) = loaded_page_mut_for_owner(conn, &owner_scope) else {@@ -510,7 +515,7 @@ pub(super) fn complete_pending_dom_command_result()));};complete_scroll_into_view_if_needed_object_reference_result(page, completion)- .map(|()| DevToolsCommandResult::Empty)+ .map(|()| AutomationResult::Empty)}PendingDomCommandKind::DescribeNodeObjectReference {cached_object_node,@@ -528,7 +533,7 @@ pub(super) fn complete_pending_dom_command_result(cached_object_node,top_frame_id,)- .map(DevToolsCommandResult::DescribeNode)+ .map(AutomationResult::DescribeNode)}_ => Err(DevToolsError::new(DevToolsErrorKind::Unsupported,diff --git a/moli-protocol/src/domains/dom/resolve/protocol_dispatch.rs b/moli-protocol/src/domains/dom/resolve/protocol_dispatch.rsindex 12ebe4d88..dc7e0219a 100644--- a/moli-protocol/src/domains/dom/resolve/protocol_dispatch.rs+++ b/moli-protocol/src/domains/dom/resolve/protocol_dispatch.rs@@ -16,7 +16,7 @@ pub(super) fn build_cdp_get_attributes_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Ok(DevToolsGetAttributesCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),reference: DevToolsDomNodeReference::FrontendNodeId(cdp_node_id),})}@@ -169,7 +169,7 @@ pub(super) fn build_cdp_push_nodes_by_backend_ids_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Ok(DevToolsPushNodesByBackendIdsCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),backend_node_ids,})}@@ -206,7 +206,7 @@ pub(super) fn build_cdp_get_outer_html_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Ok(Some(DevToolsGetOuterHtmlCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),reference: Some(reference),include_shadow_dom: params.include_shadow_dom,}))@@ -214,8 +214,8 @@ pub(super) fn build_cdp_get_outer_html_command(pub(crate) async fn execute_devtools_dom_command_async(conn: &mut CdpConnection,- command: DevToolsCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+ command: AutomationCommand,+) -> Result<AutomationResult, DevToolsError> {let context = devtools_dom_command_context(&command)?;let target_id = context.target_id@@ -238,21 +238,21 @@ pub(crate) async fn execute_devtools_dom_command_async(}pub(super) fn devtools_dom_command_context(- command: &DevToolsCommand,-) -> Result<&crate::devtools_runtime::DevToolsCommandContext, DevToolsError> {+ command: &AutomationCommand,+) -> Result<&crate::automation::AutomationContext, DevToolsError> {let context = match command {- DevToolsCommand::QuerySelector(command) => &command.context,- DevToolsCommand::GetAttributes(command) => &command.context,- DevToolsCommand::GetText(command) => &command.context,- DevToolsCommand::GetProperty(command) => &command.context,- DevToolsCommand::PushNodesByBackendIds(command) => &command.context,- DevToolsCommand::GetOuterHtml(command) => &command.context,- DevToolsCommand::DescribeNode(command) => &command.context,- DevToolsCommand::GetFrameOwner(command) => &command.context,- DevToolsCommand::GetNodeForLocation(command) => &command.context,- DevToolsCommand::ResolveNode(command) => &command.context,- DevToolsCommand::ScrollIntoViewIfNeeded(command) => &command.context,- DevToolsCommand::DomObjectReference(command)+ AutomationCommand::QuerySelector(command) => &command.context,+ AutomationCommand::GetAttributes(command) => &command.context,+ AutomationCommand::GetText(command) => &command.context,+ AutomationCommand::GetProperty(command) => &command.context,+ AutomationCommand::PushNodesByBackendIds(command) => &command.context,+ AutomationCommand::GetOuterHtml(command) => &command.context,+ AutomationCommand::DescribeNode(command) => &command.context,+ AutomationCommand::GetFrameOwner(command) => &command.context,+ AutomationCommand::GetNodeForLocation(command) => &command.context,+ AutomationCommand::ResolveNode(command) => &command.context,+ AutomationCommand::ScrollIntoViewIfNeeded(command) => &command.context,+ AutomationCommand::DomObjectReference(command)if matches!(command.operation,DevToolsDomObjectReferenceOperation::GetBoxModel@@ -261,8 +261,8 @@ pub(super) fn devtools_dom_command_context({&command.context}- DevToolsCommand::SetFileInputFiles(command) => &command.context,- DevToolsCommand::DomGeometry(command) => &command.context,+ AutomationCommand::SetFileInputFiles(command) => &command.context,+ AutomationCommand::DomGeometry(command) => &command.context,_ => {return Err(DevToolsError::new(DevToolsErrorKind::Unsupported,@@ -276,139 +276,140 @@ pub(super) fn devtools_dom_command_context(pub(super) async fn execute_devtools_dom_command_for_owner(conn: &mut CdpConnection,owner: &CommandOwnerScope,- command: DevToolsCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+ command: AutomationCommand,+) -> Result<AutomationResult, DevToolsError> {match command {- DevToolsCommand::QuerySelector(command) => {+ AutomationCommand::QuerySelector(command) => {let pending = start_devtools_dom_command_for_owner(conn,None,owner,- DevToolsCommand::QuerySelector(command),+ AutomationCommand::QuerySelector(command),).map_err(DevToolsError::from)?.ok_or_else(|| DevToolsError::new(DevToolsErrorKind::Internal, "MissingDomCommand"))?;await_pending_devtools_dom_command_result(conn, pending).await}- DevToolsCommand::GetAttributes(command) => {+ AutomationCommand::GetAttributes(command) => {let pending = start_devtools_dom_command_for_owner(conn,None,owner,- DevToolsCommand::GetAttributes(command),+ AutomationCommand::GetAttributes(command),).map_err(DevToolsError::from)?.ok_or_else(|| DevToolsError::new(DevToolsErrorKind::Internal, "MissingDomCommand"))?;await_pending_devtools_dom_command_result(conn, pending).await}- DevToolsCommand::GetText(command) => {+ AutomationCommand::GetText(command) => {let pending = start_devtools_dom_command_for_owner(conn,None,owner,- DevToolsCommand::GetText(command),+ AutomationCommand::GetText(command),).map_err(DevToolsError::from)?.ok_or_else(|| DevToolsError::new(DevToolsErrorKind::Internal, "MissingDomCommand"))?;await_pending_devtools_dom_command_result(conn, pending).await}- DevToolsCommand::GetProperty(command) => {+ AutomationCommand::GetProperty(command) => {let pending = start_devtools_dom_command_for_owner(conn,None,owner,- DevToolsCommand::GetProperty(command),+ AutomationCommand::GetProperty(command),).map_err(DevToolsError::from)?.ok_or_else(|| DevToolsError::new(DevToolsErrorKind::Internal, "MissingDomCommand"))?;await_pending_devtools_dom_command_result(conn, pending).await}- DevToolsCommand::PushNodesByBackendIds(command) => {+ AutomationCommand::PushNodesByBackendIds(command) => {let pending = start_devtools_dom_command_for_owner(conn,None,owner,- DevToolsCommand::PushNodesByBackendIds(command),+ AutomationCommand::PushNodesByBackendIds(command),).map_err(DevToolsError::from)?.ok_or_else(|| DevToolsError::new(DevToolsErrorKind::Internal, "MissingDomCommand"))?;await_pending_devtools_dom_command_result(conn, pending).await}- DevToolsCommand::GetOuterHtml(command) => {+ AutomationCommand::GetOuterHtml(command) => {let pending = start_devtools_dom_command_for_owner(conn,None,owner,- DevToolsCommand::GetOuterHtml(command),+ AutomationCommand::GetOuterHtml(command),).map_err(DevToolsError::from)?.ok_or_else(|| DevToolsError::new(DevToolsErrorKind::Internal, "MissingDomCommand"))?;await_pending_devtools_dom_command_result(conn, pending).await}- DevToolsCommand::DescribeNode(command) => {+ AutomationCommand::DescribeNode(command) => {let pending = start_devtools_dom_command_for_owner(conn,None,owner,- DevToolsCommand::DescribeNode(command),+ AutomationCommand::DescribeNode(command),).map_err(DevToolsError::from)?.ok_or_else(|| DevToolsError::new(DevToolsErrorKind::Internal, "MissingDomCommand"))?;await_pending_devtools_dom_command_result(conn, pending).await}- DevToolsCommand::GetFrameOwner(command) => {+ AutomationCommand::GetFrameOwner(command) => {let immediate_command = command.clone();let Some(pending) = start_devtools_dom_command_for_owner(conn,None,owner,- DevToolsCommand::GetFrameOwner(command),+ AutomationCommand::GetFrameOwner(command),).map_err(DevToolsError::from)?else {let result = complete_devtools_dom_command(conn,- DevToolsCommand::GetFrameOwner(immediate_command),+ AutomationCommand::GetFrameOwner(immediate_command),).map_err(DevToolsError::from)?;return devtools_get_frame_owner_result_from_value(&result)- .map(DevToolsCommandResult::GetFrameOwner);+ .map(AutomationResult::GetFrameOwner);};await_pending_devtools_dom_command_result(conn, pending).await}- DevToolsCommand::ResolveNode(command) => {+ AutomationCommand::ResolveNode(command) => {let pending = start_devtools_dom_command_for_owner(conn,None,owner,- DevToolsCommand::ResolveNode(command),+ AutomationCommand::ResolveNode(command),).map_err(DevToolsError::from)?.ok_or_else(|| DevToolsError::new(DevToolsErrorKind::Internal, "MissingDomCommand"))?;await_pending_devtools_dom_command_result(conn, pending).await}- DevToolsCommand::ScrollIntoViewIfNeeded(command) => {+ AutomationCommand::ScrollIntoViewIfNeeded(command) => {let pending = start_devtools_dom_command_for_owner(conn,None,owner,- DevToolsCommand::ScrollIntoViewIfNeeded(command),+ AutomationCommand::ScrollIntoViewIfNeeded(command),).map_err(DevToolsError::from)?.ok_or_else(|| DevToolsError::new(DevToolsErrorKind::Internal, "MissingDomCommand"))?;await_pending_devtools_dom_command_result(conn, pending).await}- command @ (DevToolsCommand::DomGeometry(_) | DevToolsCommand::GetNodeForLocation(_)) => {+ command+ @ (AutomationCommand::DomGeometry(_) | AutomationCommand::GetNodeForLocation(_)) => {let pending = start_devtools_dom_command_for_owner(conn, None, owner, command).map_err(DevToolsError::from)?.ok_or_else(|| {@@ -417,7 +418,7 @@ pub(super) async fn execute_devtools_dom_command_for_owner(await_pending_devtools_dom_command_result(conn, pending).await}- DevToolsCommand::DomObjectReference(command)+ AutomationCommand::DomObjectReference(command)if matches!(command.operation,DevToolsDomObjectReferenceOperation::GetBoxModel@@ -428,19 +429,19 @@ pub(super) async fn execute_devtools_dom_command_for_owner(conn,None,owner,- DevToolsCommand::DomObjectReference(command),+ AutomationCommand::DomObjectReference(command),).map_err(DevToolsError::from)?.ok_or_else(|| DevToolsError::new(DevToolsErrorKind::Internal, "MissingDomCommand"))?;await_pending_devtools_dom_command_result(conn, pending).await}- DevToolsCommand::SetFileInputFiles(command) => {+ AutomationCommand::SetFileInputFiles(command) => {let pending = start_devtools_dom_command_for_owner(conn,None,owner,- DevToolsCommand::SetFileInputFiles(command),+ AutomationCommand::SetFileInputFiles(command),).map_err(DevToolsError::from)?.ok_or_else(|| DevToolsError::new(DevToolsErrorKind::Internal, "MissingDomCommand"))?;@@ -457,7 +458,7 @@ pub(super) async fn execute_devtools_dom_command_for_owner(pub(super) async fn await_pending_devtools_dom_command_result(conn: &mut CdpConnection,mut pending: PendingDomCommandDispatch,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {loop {let completed = Box::pin(pending.wait()).await;match complete_pending_dom_command_result(conn, completed) {@@ -541,7 +542,7 @@ pub(super) fn build_cdp_scroll_into_view_if_needed_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Ok(Some(DevToolsScrollIntoViewIfNeededCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),reference,rect,}))diff --git a/moli-protocol/src/domains/dom/resolve/protocol_neutral_tests.rs b/moli-protocol/src/domains/dom/resolve/protocol_neutral_tests.rsindex d5722f43c..9f98ab702 100644--- a/moli-protocol/src/domains/dom/resolve/protocol_neutral_tests.rs+++ b/moli-protocol/src/domains/dom/resolve/protocol_neutral_tests.rs@@ -1,6 +1,6 @@-use crate::devtools_runtime::{- AutomationEvent, DevToolsCommand, DevToolsDomGeometryOperation, DevToolsDomNodeReference,- DevToolsDomObjectReferenceOperation, DevToolsErrorKind, DevToolsProtocol,+use crate::automation::{+ AutomationCommand, AutomationEvent, DevToolsDomGeometryOperation, DevToolsDomNodeReference,+ DevToolsDomObjectReferenceOperation, DevToolsErrorKind, FrontendProtocol,};use moli_page_types::DocumentSnapshotNodeId;use serde_json::{Value, json};@@ -11,7 +11,7 @@ fn start_devtools_dom_command(conn: &mut CdpConnection,command_id: Option<u64>,command_session_id: Option<&str>,- command: DevToolsCommand,+ command: AutomationCommand,) -> Result<Option<super::PendingDomCommandDispatch>, super::PendingDomCommandStartError> {let owner = CommandOwnerScope::capture(conn, command_session_id);super::start_devtools_dom_command_for_owner(conn, command_id, &owner, command)@@ -92,7 +92,7 @@ fn cdp_get_document_builds_protocol_neutral_document_command() {panic!("valid getDocument command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-dom")@@ -125,7 +125,7 @@ fn cdp_get_flattened_document_builds_protocol_neutral_document_command() {panic!("valid getFlattenedDocument command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.depth, Some(-1));assert!(!command.pierce);assert!(command.flattened);@@ -155,7 +155,7 @@ fn devtools_dom_entry_routes_document_command_to_dom_owner() {&mut conn,cmd.id,cmd.session_id,- DevToolsCommand::GetDocument(command),+ AutomationCommand::GetDocument(command),);let Err(error) = result else {@@ -184,7 +184,7 @@ fn cdp_get_frame_owner_builds_protocol_neutral_command() {panic!("valid getFrameOwner command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.frame_id.as_str(), "TID-child");}@@ -210,7 +210,7 @@ fn devtools_dom_entry_routes_get_frame_owner_command_to_dom_owner() {&mut conn,cmd.id,cmd.session_id,- DevToolsCommand::GetFrameOwner(command),+ AutomationCommand::GetFrameOwner(command),);let Err(error) = result else {@@ -244,7 +244,7 @@ fn cdp_request_child_nodes_builds_protocol_neutral_command() {panic!("valid requestChildNodes command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.reference,DevToolsDomNodeReference::FrontendNodeId(24)@@ -275,7 +275,7 @@ fn devtools_dom_entry_routes_request_child_nodes_command_to_dom_owner() {&mut conn,cmd.id,cmd.session_id,- DevToolsCommand::RequestChildNodes(command),+ AutomationCommand::RequestChildNodes(command),);let Err(error) = result else {@@ -339,7 +339,7 @@ fn cdp_get_node_for_location_builds_protocol_neutral_command() {panic!("valid getNodeForLocation command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.x, 12.0);assert_eq!(command.y, 34.0);assert!(command.include_user_agent_shadow_dom);@@ -369,7 +369,7 @@ fn devtools_dom_entry_routes_get_node_for_location_command_to_dom_owner() {&mut conn,cmd.id,cmd.session_id,- DevToolsCommand::GetNodeForLocation(command),+ AutomationCommand::GetNodeForLocation(command),);let Err(error) = result else {@@ -430,7 +430,7 @@ fn cdp_query_selector_builds_protocol_neutral_dom_query_command() {panic!("valid querySelector command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-dom")@@ -463,7 +463,7 @@ fn cdp_query_selector_all_builds_protocol_neutral_dom_query_command() {panic!("valid querySelectorAll command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.root,Some(DevToolsDomNodeReference::FrontendNodeId(8))@@ -495,7 +495,7 @@ fn devtools_dom_entry_routes_query_selector_command_to_dom_owner() {&mut conn,cmd.id,cmd.session_id,- DevToolsCommand::QuerySelector(command),+ AutomationCommand::QuerySelector(command),);let Err(error) = result else {@@ -526,7 +526,7 @@ fn cdp_resolve_node_builds_protocol_neutral_dom_resolve_command() {panic!("valid resolveNode command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-dom")@@ -604,9 +604,9 @@ fn pending_dom_start_error_preserves_invalid_param_as_invalid_argument() {message: "The selector is not a valid selector".to_owned(),};- let singular: crate::devtools_runtime::DevToolsError = singular.into();- let plural: crate::devtools_runtime::DevToolsError = plural.into();- let selector: crate::devtools_runtime::DevToolsError = selector.into();+ let singular: crate::automation::DevToolsError = singular.into();+ let plural: crate::automation::DevToolsError = plural.into();+ let selector: crate::automation::DevToolsError = selector.into();assert_eq!(singular.kind, DevToolsErrorKind::InvalidArgument);assert_eq!(plural.kind, DevToolsErrorKind::InvalidArgument);@@ -635,7 +635,7 @@ fn devtools_dom_entry_routes_resolve_node_command_to_dom_owner() {&mut conn,cmd.id,cmd.session_id,- DevToolsCommand::ResolveNode(command),+ AutomationCommand::ResolveNode(command),);let Err(error) = result else {@@ -664,7 +664,7 @@ fn cdp_get_attributes_builds_protocol_neutral_dom_attributes_command() {panic!("valid getAttributes command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-dom")@@ -694,7 +694,7 @@ fn devtools_dom_complete_entry_requires_pending_get_attributes_command() {};let result =- super::complete_devtools_dom_command(&mut conn, DevToolsCommand::GetAttributes(command));+ super::complete_devtools_dom_command(&mut conn, AutomationCommand::GetAttributes(command));let Err(error) = result else {panic!("getAttributes sync completion should require a pending DOM command");@@ -722,7 +722,7 @@ fn cdp_push_nodes_by_backend_ids_builds_protocol_neutral_command() {panic!("valid pushNodesByBackendIds command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-dom")@@ -750,7 +750,7 @@ fn devtools_dom_complete_entry_requires_pending_push_nodes_by_backend_ids_commanlet result = super::complete_devtools_dom_command(&mut conn,- DevToolsCommand::PushNodesByBackendIds(command),+ AutomationCommand::PushNodesByBackendIds(command),);let Err(error) = result else {@@ -783,7 +783,7 @@ fn cdp_request_node_builds_protocol_neutral_object_reference_command() {panic!("valid requestNode object reference command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-dom")@@ -842,7 +842,7 @@ fn cdp_get_outer_html_builds_protocol_neutral_node_reference_command() {panic!("valid getOuterHTML typed node reference command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.reference,Some(DevToolsDomNodeReference::FrontendNodeId(15))@@ -909,7 +909,7 @@ fn devtools_dom_complete_entry_requires_pending_get_outer_html_command() {};let result =- super::complete_devtools_dom_command(&mut conn, DevToolsCommand::GetOuterHtml(command));+ super::complete_devtools_dom_command(&mut conn, AutomationCommand::GetOuterHtml(command));let Err(error) = result else {panic!("getOuterHTML sync completion should require a pending DOM command");@@ -938,7 +938,7 @@ fn cdp_scroll_into_view_builds_protocol_neutral_node_reference_command() {panic!("valid scrollIntoViewIfNeeded typed node reference command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.reference,Some(DevToolsDomNodeReference::BackendNodeId(17))@@ -1028,7 +1028,7 @@ fn devtools_dom_start_entry_routes_scroll_command_to_renderer_owner() {&mut conn,cmd.id,cmd.session_id,- DevToolsCommand::ScrollIntoViewIfNeeded(command),+ AutomationCommand::ScrollIntoViewIfNeeded(command),);let Err(error) = result else {@@ -1061,7 +1061,7 @@ fn cdp_get_box_model_builds_protocol_neutral_geometry_command() {panic!("valid getBoxModel typed node reference command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.reference,DevToolsDomNodeReference::BackendNodeId(19)@@ -1120,7 +1120,7 @@ fn devtools_dom_entry_routes_geometry_command_to_dom_owner() {&mut conn,cmd.id,cmd.session_id,- DevToolsCommand::DomGeometry(command),+ AutomationCommand::DomGeometry(command),);let Err(error) = result else {@@ -1149,7 +1149,7 @@ fn cdp_remove_node_builds_protocol_neutral_command() {panic!("valid removeNode command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.reference,DevToolsDomNodeReference::BackendNodeId(21)@@ -1178,7 +1178,7 @@ fn devtools_dom_entry_routes_remove_node_command_to_dom_owner() {&mut conn,cmd.id,cmd.session_id,- DevToolsCommand::RemoveNode(command),+ AutomationCommand::RemoveNode(command),);let Err(error) = result else {@@ -1209,7 +1209,7 @@ fn cdp_describe_node_builds_protocol_neutral_node_reference_command() {panic!("valid describeNode typed node reference command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.reference,Some(DevToolsDomNodeReference::BackendNodeId(21))@@ -1261,7 +1261,7 @@ fn devtools_dom_entry_routes_describe_node_command_to_dom_owner() {&mut conn,cmd.id,cmd.session_id,- DevToolsCommand::DescribeNode(command),+ AutomationCommand::DescribeNode(command),);let Err(error) = result else {@@ -1290,7 +1290,7 @@ fn devtools_dom_complete_entry_requires_pending_describe_node_command() {};let result =- super::complete_devtools_dom_command(&mut conn, DevToolsCommand::DescribeNode(command));+ super::complete_devtools_dom_command(&mut conn, AutomationCommand::DescribeNode(command));let Err(error) = result else {panic!("describeNode sync completion should require a pending DOM command");@@ -1327,7 +1327,7 @@ fn cdp_describe_node_object_id_builds_protocol_neutral_object_reference_command(panic!("valid describeNode object reference command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.object_id.as_str(), "remote-object-3");assert_eq!(command.operation,@@ -1364,7 +1364,7 @@ fn devtools_dom_entry_routes_object_reference_command_to_dom_owner() {&mut conn,cmd.id,cmd.session_id,- DevToolsCommand::DomObjectReference(command),+ AutomationCommand::DomObjectReference(command),);let Err(error) = result else {@@ -1397,7 +1397,7 @@ fn cdp_set_file_input_files_builds_protocol_neutral_object_command() {panic!("valid setFileInputFiles object command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-dom")diff --git a/moli-protocol/src/domains/dom/search.rs b/moli-protocol/src/domains/dom/search.rsindex 8051f17d7..56a66c5f0 100644--- a/moli-protocol/src/domains/dom/search.rs+++ b/moli-protocol/src/domains/dom/search.rs@@ -8,7 +8,7 @@ use super::resolve::{PendingDomCommandStartError,};use super::*;-use crate::devtools_runtime::{+use crate::automation::{DevToolsDiscardSearchResultsCommand, DevToolsGetSearchResultsCommand,DevToolsPerformSearchCommand,};@@ -27,7 +27,7 @@ pub(super) fn build_cdp_perform_search_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Ok(DevToolsPerformSearchCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),query: params.query,include_user_agent_shadow_dom: params.include_user_agent_shadow_dom.unwrap_or(false),})@@ -55,7 +55,7 @@ pub(super) fn build_cdp_get_search_results_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Ok(DevToolsGetSearchResultsCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),search_id: params.search_id,from_index,to_index,@@ -72,7 +72,7 @@ pub(super) fn build_cdp_discard_search_results_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Some(DevToolsDiscardSearchResultsCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),search_id: params.search_id,})}@@ -272,7 +272,7 @@ pub(super) fn complete_discard_search_results_live(#[cfg(test)]mod protocol_neutral_tests {- use crate::devtools_runtime::DevToolsProtocol;+ use crate::automation::FrontendProtocol;use serde_json::{Value, json};use crate::conn::{CdpConnection, Cmd, CommandOwnerScope};@@ -297,7 +297,7 @@ mod protocol_neutral_tests {panic!("valid performSearch command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.query, "article.result");assert!(command.include_user_agent_shadow_dom);}@@ -350,7 +350,7 @@ mod protocol_neutral_tests {panic!("valid getSearchResults command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-dom")@@ -379,7 +379,7 @@ mod protocol_neutral_tests {panic!("valid discardSearchResults command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-dom")diff --git a/moli-protocol/src/domains/dom/set_file_input.rs b/moli-protocol/src/domains/dom/set_file_input.rsindex 1a66ef5d1..a509e69bd 100644--- a/moli-protocol/src/domains/dom/set_file_input.rs+++ b/moli-protocol/src/domains/dom/set_file_input.rs@@ -13,11 +13,11 @@ use super::resolve::{PendingDomCommandKind, PendingDomCommandStartError, devtools_dom_command_task_complete,dom_object_reference_id_for_owner, start_document_node_snapshot_for_reference,};-use crate::conn::{CdpConnection, Cmd, CommandOwnerScope};-use crate::devtools_runtime::{+use crate::automation::{DevToolsDomNodeReference, DevToolsError, DevToolsErrorKind, DevToolsRemoteHandleId,DevToolsSetFileInputFilesCommand, is_webdriver_bidi_node_shared_id,};+use crate::conn::{CdpConnection, Cmd, CommandOwnerScope};use moli_core::page::{CompletedPageCommand, Page, PendingPageCommand, RendererDomBidiNodeBindingResolution,SelectedFile,@@ -48,7 +48,7 @@ pub(super) fn build_cdp_set_file_input_files_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Ok(Some(DevToolsSetFileInputFilesCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),object_id: DevToolsRemoteHandleId::from(object_id),files,append: false,diff --git a/moli-protocol/src/domains/dom/tests/frames.rs b/moli-protocol/src/domains/dom/tests/frames.rsindex 28136cd33..7840892da 100644--- a/moli-protocol/src/domains/dom/tests/frames.rs+++ b/moli-protocol/src/domains/dom/tests/frames.rs@@ -1,12 +1,12 @@use super::*;-use crate::devtools_runtime::{- DevToolsCallFunctionCommand, DevToolsCommand, DevToolsCommandContext, DevToolsCommandResult,+use crate::automation::{+ AutomationCommand, AutomationContext, AutomationResult, DevToolsCallFunctionCommand,DevToolsDescribeNodeCommand, DevToolsDomGeometryCommand, DevToolsDomGeometryOperation,DevToolsDomNodeReference, DevToolsGetAttributesCommand, DevToolsGetOuterHtmlCommand,- DevToolsGetPropertyCommand, DevToolsGetTextCommand, DevToolsProtocol,- DevToolsQuerySelectorCommand, DevToolsRemoteHandleId, DevToolsResolveNodeCommand,- DevToolsResultOwnership, DevToolsScriptResult, DevToolsScrollIntoViewIfNeededCommand,- DevToolsSessionId, DevToolsTargetId,+ DevToolsGetPropertyCommand, DevToolsGetTextCommand, DevToolsQuerySelectorCommand,+ DevToolsRemoteHandleId, DevToolsResolveNodeCommand, DevToolsResultOwnership,+ DevToolsScriptResult, DevToolsScrollIntoViewIfNeededCommand, DevToolsSessionId,+ DevToolsTargetId, FrontendProtocol,};#[tokio::test(flavor = "multi_thread")]@@ -3671,10 +3671,10 @@ async fn protocol_neutral_query_selector_targets_child_frame_context() {let child_frame_id = child_frame_id_for_single_iframe_async(&mut ctx, 2).await;let result = ctx- .execute_devtools_command_through_renderer_fence_for_test(DevToolsCommand::QuerySelector(- DevToolsQuerySelectorCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::QuerySelector(DevToolsQuerySelectorCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: None,target_id: Some(DevToolsTargetId::from(child_frame_id.as_str())),browser_context_id: None,@@ -3682,12 +3682,12 @@ async fn protocol_neutral_query_selector_targets_child_frame_context() {root: None,selector: "#inside-frame".to_owned(),multiple: false,- },- ))+ }),+ ).await.expect("child frame query selector should run");- let DevToolsCommandResult::QuerySelector(result) = result else {+ let AutomationResult::QuerySelector(result) = result else {panic!("expected query selector result");};let node_id = result.node_ids[0];@@ -3695,22 +3695,24 @@ async fn protocol_neutral_query_selector_targets_child_frame_context() {let result = ctx.conn- .execute_devtools_command(DevToolsCommand::DescribeNode(DevToolsDescribeNodeCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,- session_id: None,- target_id: Some(DevToolsTargetId::from(child_frame_id.as_str())),- browser_context_id: None,+ .execute_automation_command(AutomationCommand::DescribeNode(+ DevToolsDescribeNodeCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,+ session_id: None,+ target_id: Some(DevToolsTargetId::from(child_frame_id.as_str())),+ browser_context_id: None,+ },+ reference: Some(DevToolsDomNodeReference::FrontendNodeId(node_id)),+ depth: 0,+ pierce: false,},- reference: Some(DevToolsDomNodeReference::FrontendNodeId(node_id)),- depth: 0,- pierce: false,- }))+ )).await.into_parts().0.expect("child frame queried node describe should run");- let DevToolsCommandResult::DescribeNode(result) = result else {+ let AutomationResult::DescribeNode(result) = result else {panic!("expected child frame queried node describe result");};assert_eq!(result.node["nodeName"], json!("MAIN"));@@ -3791,41 +3793,45 @@ async fn child_frame_describe_node_uses_the_calling_sessions_whitespace_projectictx.sent.clear();}- let child_context = |session_id: &str| DevToolsCommandContext {- protocol: DevToolsProtocol::Cdp,+ let child_context = |session_id: &str| AutomationContext {+ protocol: FrontendProtocol::Cdp,session_id: Some(DevToolsSessionId::from(session_id)),target_id: Some(DevToolsTargetId::from(child_frame_id.as_str())),browser_context_id: None,};let default_result = ctx.conn- .execute_devtools_command(DevToolsCommand::DescribeNode(DevToolsDescribeNodeCommand {- context: child_context("SID-whitespace-default"),- reference: None,- depth: -1,- pierce: false,- }))+ .execute_automation_command(AutomationCommand::DescribeNode(+ DevToolsDescribeNodeCommand {+ context: child_context("SID-whitespace-default"),+ reference: None,+ depth: -1,+ pierce: false,+ },+ )).await.into_parts().0.expect("default child frame root describe should run");- let DevToolsCommandResult::DescribeNode(default_result) = default_result else {+ let AutomationResult::DescribeNode(default_result) = default_result else {panic!("expected default child frame describe result");};let all_result = ctx.conn- .execute_devtools_command(DevToolsCommand::DescribeNode(DevToolsDescribeNodeCommand {- context: child_context(&all_session_id),- reference: None,- depth: -1,- pierce: false,- }))+ .execute_automation_command(AutomationCommand::DescribeNode(+ DevToolsDescribeNodeCommand {+ context: child_context(&all_session_id),+ reference: None,+ depth: -1,+ pierce: false,+ },+ )).await.into_parts().0.expect("includeWhitespace=all child frame root describe should run");- let DevToolsCommandResult::DescribeNode(all_result) = all_result else {+ let AutomationResult::DescribeNode(all_result) = all_result else {panic!("expected includeWhitespace=all child frame describe result");};@@ -3851,19 +3857,21 @@ async fn child_frame_describe_node_uses_the_calling_sessions_whitespace_projecti.expect("child document root backend node id");let all_referenced = ctx.conn- .execute_devtools_command(DevToolsCommand::DescribeNode(DevToolsDescribeNodeCommand {- context: child_context(&all_session_id),- reference: Some(DevToolsDomNodeReference::BackendNodeId(- root_backend_node_id,- )),- depth: -1,- pierce: false,- }))+ .execute_automation_command(AutomationCommand::DescribeNode(+ DevToolsDescribeNodeCommand {+ context: child_context(&all_session_id),+ reference: Some(DevToolsDomNodeReference::BackendNodeId(+ root_backend_node_id,+ )),+ depth: -1,+ pierce: false,+ },+ )).await.into_parts().0.expect("includeWhitespace=all child root backend describe should run");- let DevToolsCommandResult::DescribeNode(all_referenced) = all_referenced else {+ let AutomationResult::DescribeNode(all_referenced) = all_referenced else {panic!("expected referenced child frame describe result");};assert!(@@ -3906,8 +3914,8 @@ async fn child_frame_get_outer_html_preserves_session_and_shadow_inclusion() {.as_str().expect("attached session id").to_owned();- let cdp_context = DevToolsCommandContext {- protocol: DevToolsProtocol::Cdp,+ let cdp_context = AutomationContext {+ protocol: FrontendProtocol::Cdp,session_id: Some(DevToolsSessionId::from(attached_session_id.as_str())),target_id: Some(DevToolsTargetId::from(child_frame_id.as_str())),browser_context_id: None,@@ -3915,17 +3923,19 @@ async fn child_frame_get_outer_html_preserves_session_and_shadow_inclusion() {let described = ctx.conn- .execute_devtools_command(DevToolsCommand::DescribeNode(DevToolsDescribeNodeCommand {- context: cdp_context.clone(),- reference: None,- depth: -1,- pierce: false,- }))+ .execute_automation_command(AutomationCommand::DescribeNode(+ DevToolsDescribeNodeCommand {+ context: cdp_context.clone(),+ reference: None,+ depth: -1,+ pierce: false,+ },+ )).await.into_parts().0.expect("attached-session child document describe should run");- let DevToolsCommandResult::DescribeNode(described) = described else {+ let AutomationResult::DescribeNode(described) = described else {panic!("expected child describe result");};let host = node_tree_element_by_attribute(&described.node, "id", "host")@@ -3963,16 +3973,18 @@ async fn child_frame_get_outer_html_preserves_session_and_shadow_inclusion() {] {let result = ctx.conn- .execute_devtools_command(DevToolsCommand::GetOuterHtml(DevToolsGetOuterHtmlCommand {- context: cdp_context.clone(),- reference: Some(reference),- include_shadow_dom,- }))+ .execute_automation_command(AutomationCommand::GetOuterHtml(+ DevToolsGetOuterHtmlCommand {+ context: cdp_context.clone(),+ reference: Some(reference),+ include_shadow_dom,+ },+ )).await.into_parts().0.expect("child host outerHTML should run");- let DevToolsCommandResult::GetOuterHtml(result) = result else {+ let AutomationResult::GetOuterHtml(result) = result else {panic!("expected child outerHTML result");};assert_eq!(result.outer_html, expected);@@ -3980,37 +3992,41 @@ async fn child_frame_get_outer_html_preserves_session_and_shadow_inclusion() {let cdp_document = ctx.conn- .execute_devtools_command(DevToolsCommand::GetOuterHtml(DevToolsGetOuterHtmlCommand {- context: cdp_context,- reference: None,- include_shadow_dom: true,- }))+ .execute_automation_command(AutomationCommand::GetOuterHtml(+ DevToolsGetOuterHtmlCommand {+ context: cdp_context,+ reference: None,+ include_shadow_dom: true,+ },+ )).await.into_parts().0.expect("child document shadow-inclusive outerHTML should run");- let DevToolsCommandResult::GetOuterHtml(cdp_document) = cdp_document else {+ let AutomationResult::GetOuterHtml(cdp_document) = cdp_document else {panic!("expected child document outerHTML result");};assert!(cdp_document.outer_html.contains(including_shadow));let classic_document = ctx.conn- .execute_devtools_command(DevToolsCommand::GetOuterHtml(DevToolsGetOuterHtmlCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,- session_id: Some(DevToolsSessionId::from("SID-not-an-inspector-session")),- target_id: Some(DevToolsTargetId::from(child_frame_id.as_str())),- browser_context_id: None,+ .execute_automation_command(AutomationCommand::GetOuterHtml(+ DevToolsGetOuterHtmlCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,+ session_id: Some(DevToolsSessionId::from("SID-not-an-inspector-session")),+ target_id: Some(DevToolsTargetId::from(child_frame_id.as_str())),+ browser_context_id: None,+ },+ reference: None,+ include_shadow_dom: false,},- reference: None,- include_shadow_dom: false,- }))+ )).await.into_parts().0.expect("classic child frame page source should keep owner routing");- let DevToolsCommandResult::GetOuterHtml(classic_document) = classic_document else {+ let AutomationResult::GetOuterHtml(classic_document) = classic_document else {panic!("expected classic child document outerHTML result");};assert!(classic_document.outer_html.contains(ordinary));@@ -4034,8 +4050,8 @@ async fn protocol_neutral_child_frame_frontend_node_geometry_reads_live_renderer.await;ctx.capture_fixture_layout(None).await;let child_frame_id = child_frame_id_for_single_iframe_async(&mut ctx, 2).await;- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: None,target_id: Some(DevToolsTargetId::from(child_frame_id.as_str())),browser_context_id: None,@@ -4043,7 +4059,7 @@ async fn protocol_neutral_child_frame_frontend_node_geometry_reads_live_rendererlet result = ctx.conn- .execute_devtools_command(DevToolsCommand::QuerySelector(+ .execute_automation_command(AutomationCommand::QuerySelector(DevToolsQuerySelectorCommand {context: context.clone(),root: None,@@ -4056,14 +4072,14 @@ async fn protocol_neutral_child_frame_frontend_node_geometry_reads_live_renderer.0.expect("child frame query selector should run");- let DevToolsCommandResult::QuerySelector(result) = result else {+ let AutomationResult::QuerySelector(result) = result else {panic!("expected query selector result");};let node_id = result.node_ids[0];let result = ctx.conn- .execute_devtools_command(DevToolsCommand::DomGeometry(DevToolsDomGeometryCommand {+ .execute_automation_command(AutomationCommand::DomGeometry(DevToolsDomGeometryCommand {context: context.clone(),reference: DevToolsDomNodeReference::FrontendNodeId(node_id),operation: DevToolsDomGeometryOperation::GetBoxModel,@@ -4072,7 +4088,7 @@ async fn protocol_neutral_child_frame_frontend_node_geometry_reads_live_renderer.into_parts().0.expect("child frame frontend node geometry should run");- let DevToolsCommandResult::DomGeometry(result) = result else {+ let AutomationResult::DomGeometry(result) = result else {panic!("expected child frontend node geometry result");};assert_eq!(@@ -4086,7 +4102,7 @@ async fn protocol_neutral_child_frame_frontend_node_geometry_reads_live_rendererlet result = ctx.conn- .execute_devtools_command(DevToolsCommand::DomGeometry(DevToolsDomGeometryCommand {+ .execute_automation_command(AutomationCommand::DomGeometry(DevToolsDomGeometryCommand {context: context.clone(),reference: DevToolsDomNodeReference::FrontendNodeId(node_id),operation: DevToolsDomGeometryOperation::GetContentQuads,@@ -4095,7 +4111,7 @@ async fn protocol_neutral_child_frame_frontend_node_geometry_reads_live_renderer.into_parts().0.expect("child frame frontend node content quads should run");- let DevToolsCommandResult::DomGeometry(result) = result else {+ let AutomationResult::DomGeometry(result) = result else {panic!("expected child frontend node content quads result");};assert_eq!(result.quads.first().map(|quad| quad.points.len()), Some(8));@@ -4103,7 +4119,7 @@ async fn protocol_neutral_child_frame_frontend_node_geometry_reads_live_rendererlet result = ctx.conn- .execute_devtools_command(DevToolsCommand::ScrollIntoViewIfNeeded(+ .execute_automation_command(AutomationCommand::ScrollIntoViewIfNeeded(DevToolsScrollIntoViewIfNeededCommand {context,reference: Some(DevToolsDomNodeReference::FrontendNodeId(node_id)),@@ -4114,7 +4130,7 @@ async fn protocol_neutral_child_frame_frontend_node_geometry_reads_live_renderer.into_parts().0.expect("child frame frontend node scrollIntoViewIfNeeded should run");- assert!(matches!(result, DevToolsCommandResult::Empty));+ assert!(matches!(result, AutomationResult::Empty));}#[tokio::test(flavor = "multi_thread")]@@ -4134,43 +4150,45 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {.await;ctx.capture_fixture_layout(None).await;let child_frame_id = child_frame_id_for_single_iframe_async(&mut ctx, 2).await;- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from("SID-1")),target_id: Some(DevToolsTargetId::from(child_frame_id.as_str())),browser_context_id: None,};let result = ctx- .execute_devtools_command_through_renderer_fence_for_test(DevToolsCommand::QuerySelector(- DevToolsQuerySelectorCommand {+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::QuerySelector(DevToolsQuerySelectorCommand {context: context.clone(),root: None,selector: "#inside-frame".to_owned(),multiple: false,- },- ))+ }),+ ).await.expect("child frame query selector should run");- let DevToolsCommandResult::QuerySelector(result) = result else {+ let AutomationResult::QuerySelector(result) = result else {panic!("expected query selector result");};let node_id = result.node_ids[0];let result = ctx.conn- .execute_devtools_command(DevToolsCommand::DescribeNode(DevToolsDescribeNodeCommand {- context: context.clone(),- reference: Some(DevToolsDomNodeReference::FrontendNodeId(node_id)),- depth: 0,- pierce: false,- }))+ .execute_automation_command(AutomationCommand::DescribeNode(+ DevToolsDescribeNodeCommand {+ context: context.clone(),+ reference: Some(DevToolsDomNodeReference::FrontendNodeId(node_id)),+ depth: 0,+ pierce: false,+ },+ )).await.into_parts().0.expect("child frame frontend node describe should run");- let DevToolsCommandResult::DescribeNode(result) = result else {+ let AutomationResult::DescribeNode(result) = result else {panic!("expected child frontend node describe result");};assert_eq!(result.node["nodeName"], json!("MAIN"));@@ -4178,7 +4196,7 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {let result = ctx.conn- .execute_devtools_command(DevToolsCommand::GetAttributes(+ .execute_automation_command(AutomationCommand::GetAttributes(DevToolsGetAttributesCommand {context: context.clone(),reference: DevToolsDomNodeReference::FrontendNodeId(node_id),@@ -4188,7 +4206,7 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {.into_parts().0.expect("child frame frontend node attributes should run");- let DevToolsCommandResult::GetAttributes(result) = result else {+ let AutomationResult::GetAttributes(result) = result else {panic!("expected child frontend node attributes result");};assert!(@@ -4206,7 +4224,7 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {let result = ctx.conn- .execute_devtools_command(DevToolsCommand::GetText(DevToolsGetTextCommand {+ .execute_automation_command(AutomationCommand::GetText(DevToolsGetTextCommand {context: context.clone(),reference: DevToolsDomNodeReference::FrontendNodeId(node_id),}))@@ -4214,14 +4232,14 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {.into_parts().0.expect("child frame frontend node text should run");- let DevToolsCommandResult::GetText(result) = result else {+ let AutomationResult::GetText(result) = result else {panic!("expected child frontend node text result");};assert_eq!(result.text, "child");let result = ctx.conn- .execute_devtools_command(DevToolsCommand::GetProperty(DevToolsGetPropertyCommand {+ .execute_automation_command(AutomationCommand::GetProperty(DevToolsGetPropertyCommand {context: context.clone(),reference: DevToolsDomNodeReference::FrontendNodeId(node_id),name: "id".to_owned(),@@ -4230,23 +4248,25 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {.into_parts().0.expect("child frame frontend node property should run");- let DevToolsCommandResult::GetProperty(result) = result else {+ let AutomationResult::GetProperty(result) = result else {panic!("expected child frontend node property result");};assert_eq!(result.value, json!("inside-frame"));let result = ctx.conn- .execute_devtools_command(DevToolsCommand::GetOuterHtml(DevToolsGetOuterHtmlCommand {- context: context.clone(),- reference: Some(DevToolsDomNodeReference::FrontendNodeId(node_id)),- include_shadow_dom: false,- }))+ .execute_automation_command(AutomationCommand::GetOuterHtml(+ DevToolsGetOuterHtmlCommand {+ context: context.clone(),+ reference: Some(DevToolsDomNodeReference::FrontendNodeId(node_id)),+ include_shadow_dom: false,+ },+ )).await.into_parts().0.expect("child frame frontend node outerHTML should run");- let DevToolsCommandResult::GetOuterHtml(result) = result else {+ let AutomationResult::GetOuterHtml(result) = result else {panic!("expected child frontend node outerHTML result");};assert_eq!(@@ -4256,16 +4276,18 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {let result = ctx.conn- .execute_devtools_command(DevToolsCommand::GetOuterHtml(DevToolsGetOuterHtmlCommand {- context: context.clone(),- reference: None,- include_shadow_dom: false,- }))+ .execute_automation_command(AutomationCommand::GetOuterHtml(+ DevToolsGetOuterHtmlCommand {+ context: context.clone(),+ reference: None,+ include_shadow_dom: false,+ },+ )).await.into_parts().0.expect("child frame root outerHTML should run");- let DevToolsCommandResult::GetOuterHtml(result) = result else {+ let AutomationResult::GetOuterHtml(result) = result else {panic!("expected child frame root outerHTML result");};assert!(@@ -4276,17 +4298,19 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {let result = ctx.conn- .execute_devtools_command(DevToolsCommand::DescribeNode(DevToolsDescribeNodeCommand {- context: context.clone(),- reference: None,- depth: 1,- pierce: false,- }))+ .execute_automation_command(AutomationCommand::DescribeNode(+ DevToolsDescribeNodeCommand {+ context: context.clone(),+ reference: None,+ depth: 1,+ pierce: false,+ },+ )).await.into_parts().0.expect("child frame root describe should run");- let DevToolsCommandResult::DescribeNode(result) = result else {+ let AutomationResult::DescribeNode(result) = result else {panic!("expected child frame root describe node result");};assert_eq!(result.node["nodeName"], json!("#document"));@@ -4302,19 +4326,21 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {let result = ctx.conn- .execute_devtools_command(DevToolsCommand::DescribeNode(DevToolsDescribeNodeCommand {- context: context.clone(),- reference: Some(DevToolsDomNodeReference::BackendNodeId(- root_backend_node_id,- )),- depth: 1,- pierce: false,- }))+ .execute_automation_command(AutomationCommand::DescribeNode(+ DevToolsDescribeNodeCommand {+ context: context.clone(),+ reference: Some(DevToolsDomNodeReference::BackendNodeId(+ root_backend_node_id,+ )),+ depth: 1,+ pierce: false,+ },+ )).await.into_parts().0.expect("child frame root backend describe should run");- let DevToolsCommandResult::DescribeNode(result) = result else {+ let AutomationResult::DescribeNode(result) = result else {panic!("expected child frame root backend describe node result");};assert_eq!(result.node["nodeName"], json!("#document"));@@ -4323,7 +4349,7 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {let result = ctx.conn- .execute_devtools_command(DevToolsCommand::ResolveNode(DevToolsResolveNodeCommand {+ .execute_automation_command(AutomationCommand::ResolveNode(DevToolsResolveNodeCommand {context: context.clone(),reference: DevToolsDomNodeReference::FrontendNodeId(node_id),execution_context_id: None,@@ -4334,7 +4360,7 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {.0.expect("child frame resolve node should run");- let DevToolsCommandResult::ResolveNode(result) = result else {+ let AutomationResult::ResolveNode(result) = result else {panic!("expected resolve node result");};let object_id = result.object["objectId"]@@ -4343,8 +4369,8 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {.unwrap_or_else(|| panic!("expected child frame node object id: {:?}", result.object));let result = ctx- .execute_devtools_command_through_renderer_fence_for_test(DevToolsCommand::CallFunction(- DevToolsCallFunctionCommand {+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: context.clone(),realm_id: None,world_name: None,@@ -4362,12 +4388,12 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {preserve_remote_metadata: false,materialize_bidi_script_result: false,serialization_options: None,- },- ))+ }),+ ).await.expect("child frame callFunctionOn should run");- let DevToolsCommandResult::Script(result) = result else {+ let AutomationResult::Script(result) = result else {panic!("expected script result");};let DevToolsScriptResult::Value(value) = *result else {@@ -4395,19 +4421,21 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {let result = ctx.conn- .execute_devtools_command(DevToolsCommand::DescribeNode(DevToolsDescribeNodeCommand {- context: context.clone(),- reference: Some(DevToolsDomNodeReference::BackendNodeId(- renderer_backend_node_id,- )),- depth: 0,- pierce: false,- }))+ .execute_automation_command(AutomationCommand::DescribeNode(+ DevToolsDescribeNodeCommand {+ context: context.clone(),+ reference: Some(DevToolsDomNodeReference::BackendNodeId(+ renderer_backend_node_id,+ )),+ depth: 0,+ pierce: false,+ },+ )).await.into_parts().0.expect("child frame high backend describe should run");- let DevToolsCommandResult::DescribeNode(result) = result else {+ let AutomationResult::DescribeNode(result) = result else {panic!("expected child high backend describe node result");};assert_eq!(result.node["nodeName"], json!("MAIN"));@@ -4418,7 +4446,7 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {let result = ctx.conn- .execute_devtools_command(DevToolsCommand::GetAttributes(+ .execute_automation_command(AutomationCommand::GetAttributes(DevToolsGetAttributesCommand {context: context.clone(),reference: DevToolsDomNodeReference::BackendNodeId(renderer_backend_node_id),@@ -4428,7 +4456,7 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {.into_parts().0.expect("child frame high backend attributes should run");- let DevToolsCommandResult::GetAttributes(result) = result else {+ let AutomationResult::GetAttributes(result) = result else {panic!("expected child high backend attributes result");};assert!(@@ -4446,7 +4474,7 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {let result = ctx.conn- .execute_devtools_command(DevToolsCommand::GetText(DevToolsGetTextCommand {+ .execute_automation_command(AutomationCommand::GetText(DevToolsGetTextCommand {context: context.clone(),reference: DevToolsDomNodeReference::BackendNodeId(renderer_backend_node_id),}))@@ -4454,14 +4482,14 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {.into_parts().0.expect("child frame high backend text should run");- let DevToolsCommandResult::GetText(result) = result else {+ let AutomationResult::GetText(result) = result else {panic!("expected child high backend text result");};assert_eq!(result.text, "child");let result = ctx.conn- .execute_devtools_command(DevToolsCommand::GetProperty(DevToolsGetPropertyCommand {+ .execute_automation_command(AutomationCommand::GetProperty(DevToolsGetPropertyCommand {context: context.clone(),reference: DevToolsDomNodeReference::BackendNodeId(renderer_backend_node_id),name: "id".to_owned(),@@ -4470,25 +4498,27 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {.into_parts().0.expect("child frame high backend property should run");- let DevToolsCommandResult::GetProperty(result) = result else {+ let AutomationResult::GetProperty(result) = result else {panic!("expected child high backend property result");};assert_eq!(result.value, json!("inside-frame"));let result = ctx.conn- .execute_devtools_command(DevToolsCommand::GetOuterHtml(DevToolsGetOuterHtmlCommand {- context: context.clone(),- reference: Some(DevToolsDomNodeReference::BackendNodeId(- renderer_backend_node_id,- )),- include_shadow_dom: false,- }))+ .execute_automation_command(AutomationCommand::GetOuterHtml(+ DevToolsGetOuterHtmlCommand {+ context: context.clone(),+ reference: Some(DevToolsDomNodeReference::BackendNodeId(+ renderer_backend_node_id,+ )),+ include_shadow_dom: false,+ },+ )).await.into_parts().0.expect("child frame high backend outerHTML should run");- let DevToolsCommandResult::GetOuterHtml(result) = result else {+ let AutomationResult::GetOuterHtml(result) = result else {panic!("expected child high backend outerHTML result");};assert_eq!(@@ -4498,7 +4528,7 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {let result = ctx.conn- .execute_devtools_command(DevToolsCommand::ResolveNode(DevToolsResolveNodeCommand {+ .execute_automation_command(AutomationCommand::ResolveNode(DevToolsResolveNodeCommand {context: context.clone(),reference: DevToolsDomNodeReference::BackendNodeId(renderer_backend_node_id),execution_context_id: None,@@ -4508,7 +4538,7 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {.into_parts().0.expect("child frame high backend resolve should run");- let DevToolsCommandResult::ResolveNode(result) = result else {+ let AutomationResult::ResolveNode(result) = result else {panic!("expected child high backend resolve node result");};let high_backend_object_id = result.object["objectId"]@@ -4522,8 +4552,8 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {});let result = ctx- .execute_devtools_command_through_renderer_fence_for_test(DevToolsCommand::CallFunction(- DevToolsCallFunctionCommand {+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {context: context.clone(),realm_id: None,world_name: None,@@ -4541,11 +4571,11 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {preserve_remote_metadata: false,materialize_bidi_script_result: false,serialization_options: None,- },- ))+ }),+ ).await.expect("child frame high backend callFunctionOn should run");- let DevToolsCommandResult::Script(result) = result else {+ let AutomationResult::Script(result) = result else {panic!("expected script result");};let DevToolsScriptResult::Value(value) = *result else {@@ -4554,7 +4584,7 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {assert_eq!(value.value, json!("inside-frame:grid"));let result = ctx- .execute_devtools_command_through_renderer_fence_for_test(DevToolsCommand::DomGeometry(+ .execute_automation_command_through_renderer_fence_for_test(AutomationCommand::DomGeometry(DevToolsDomGeometryCommand {context: context.clone(),reference: DevToolsDomNodeReference::BackendNodeId(renderer_backend_node_id),@@ -4563,7 +4593,7 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {)).await.expect("child frame high backend geometry should run");- let DevToolsCommandResult::DomGeometry(result) = result else {+ let AutomationResult::DomGeometry(result) = result else {panic!("expected child high backend geometry result");};assert_eq!(@@ -4576,8 +4606,8 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {assert!(result.quads.is_empty());let result = ctx- .execute_devtools_command_through_renderer_fence_for_test(- DevToolsCommand::ScrollIntoViewIfNeeded(DevToolsScrollIntoViewIfNeededCommand {+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::ScrollIntoViewIfNeeded(DevToolsScrollIntoViewIfNeededCommand {context,reference: Some(DevToolsDomNodeReference::BackendNodeId(renderer_backend_node_id,@@ -4587,7 +4617,7 @@ async fn protocol_neutral_resolve_node_targets_child_frame_context() {).await.expect("child frame high backend scrollIntoViewIfNeeded should run");- assert!(matches!(result, DevToolsCommandResult::Empty));+ assert!(matches!(result, AutomationResult::Empty));}#[tokio::test(flavor = "multi_thread")]@@ -4605,8 +4635,8 @@ async fn protocol_neutral_describe_node_targets_child_frame_with_pierce() {).await;let child_frame_id = child_frame_id_for_single_iframe_async(&mut ctx, 2).await;- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: None,target_id: Some(DevToolsTargetId::from(child_frame_id.as_str())),browser_context_id: None,@@ -4614,7 +4644,7 @@ async fn protocol_neutral_describe_node_targets_child_frame_with_pierce() {let result = ctx.conn- .execute_devtools_command(DevToolsCommand::QuerySelector(+ .execute_automation_command(AutomationCommand::QuerySelector(DevToolsQuerySelectorCommand {context: context.clone(),root: None,@@ -4626,24 +4656,26 @@ async fn protocol_neutral_describe_node_targets_child_frame_with_pierce() {.into_parts().0.expect("child frame query selector should run");- let DevToolsCommandResult::QuerySelector(result) = result else {+ let AutomationResult::QuerySelector(result) = result else {panic!("expected query selector result");};let host_node_id = result.node_ids[0];let result = ctx.conn- .execute_devtools_command(DevToolsCommand::DescribeNode(DevToolsDescribeNodeCommand {- context: context.clone(),- reference: Some(DevToolsDomNodeReference::FrontendNodeId(host_node_id)),- depth: -1,- pierce: true,- }))+ .execute_automation_command(AutomationCommand::DescribeNode(+ DevToolsDescribeNodeCommand {+ context: context.clone(),+ reference: Some(DevToolsDomNodeReference::FrontendNodeId(host_node_id)),+ depth: -1,+ pierce: true,+ },+ )).await.into_parts().0.expect("child frame describe node should run");- let DevToolsCommandResult::DescribeNode(result) = result else {+ let AutomationResult::DescribeNode(result) = result else {panic!("expected describe node result");};let shadow_roots = result.node["shadowRoots"]@@ -4663,19 +4695,21 @@ async fn protocol_neutral_describe_node_targets_child_frame_with_pierce() {let result = ctx.conn- .execute_devtools_command(DevToolsCommand::DescribeNode(DevToolsDescribeNodeCommand {- context,- reference: Some(DevToolsDomNodeReference::FrontendNodeId(- shadow_root_node_id,- )),- depth: 0,- pierce: false,- }))+ .execute_automation_command(AutomationCommand::DescribeNode(+ DevToolsDescribeNodeCommand {+ context,+ reference: Some(DevToolsDomNodeReference::FrontendNodeId(+ shadow_root_node_id,+ )),+ depth: 0,+ pierce: false,+ },+ )).await.into_parts().0.expect("child frame shadow root describe node should run");- let DevToolsCommandResult::DescribeNode(result) = result else {+ let AutomationResult::DescribeNode(result) = result else {panic!("expected shadow root describe node result");};assert_eq!(diff --git a/moli-protocol/src/domains/dom/tests/node_ops.rs b/moli-protocol/src/domains/dom/tests/node_ops.rsindex 0ccb1f24d..08988b4d4 100644--- a/moli-protocol/src/domains/dom/tests/node_ops.rs+++ b/moli-protocol/src/domains/dom/tests/node_ops.rs@@ -1,12 +1,12 @@use super::*;-use crate::devtools_runtime::{- DevToolsCommand, DevToolsCommandContext, DevToolsDescribeNodeCommand,- DevToolsDomGeometryCommand, DevToolsDomGeometryOperation, DevToolsDomNodeReference,- DevToolsErrorKind, DevToolsGetOuterHtmlCommand, DevToolsGetPropertyCommand,- DevToolsGetTextCommand, DevToolsProtocol, DevToolsQuerySelectorCommand,- DevToolsScrollIntoViewIfNeededCommand, DevToolsTargetId,+use crate::automation::{+ AutomationCommand, AutomationContext, DevToolsDescribeNodeCommand, DevToolsDomGeometryCommand,+ DevToolsDomGeometryOperation, DevToolsDomNodeReference, DevToolsErrorKind,+ DevToolsGetOuterHtmlCommand, DevToolsGetPropertyCommand, DevToolsGetTextCommand,+ DevToolsQuerySelectorCommand, DevToolsScrollIntoViewIfNeededCommand, DevToolsTargetId,+ FrontendProtocol,};-use crate::{DevToolsBrowserContextId, DevToolsCommandResult};+use crate::{AutomationResult, DevToolsBrowserContextId};use axum::{Router, http::header::CONTENT_TYPE, response::IntoResponse, routing::get};use tokio::net::TcpListener;@@ -3021,8 +3021,8 @@ async fn text_and_property_unknown_frontend_node_ids_miss_after_renderer_lookup();}- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::Cdp,+ let context = AutomationContext {+ protocol: FrontendProtocol::Cdp,session_id: None,target_id: None,browser_context_id: None,@@ -3030,7 +3030,7 @@ async fn text_and_property_unknown_frontend_node_ids_miss_after_renderer_lookup(let (text_result, _) = ctx.conn- .execute_devtools_command(DevToolsCommand::GetText(DevToolsGetTextCommand {+ .execute_automation_command(AutomationCommand::GetText(DevToolsGetTextCommand {context: context.clone(),reference: DevToolsDomNodeReference::FrontendNodeId(fake_text_frontend_node_id),}))@@ -3043,7 +3043,7 @@ async fn text_and_property_unknown_frontend_node_ids_miss_after_renderer_lookup(let (property_result, _) = ctx.conn- .execute_devtools_command(DevToolsCommand::GetProperty(DevToolsGetPropertyCommand {+ .execute_automation_command(AutomationCommand::GetProperty(DevToolsGetPropertyCommand {context,reference: DevToolsDomNodeReference::FrontendNodeId(fake_property_frontend_node_id),name: "id".to_owned(),@@ -3085,15 +3085,15 @@ async fn node_read_unknown_frontend_node_ids_miss_after_renderer_lookup() {);}- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ let context = AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: None,target_id: None,browser_context_id: None,};let commands = [- DevToolsCommand::DescribeNode(DevToolsDescribeNodeCommand {+ AutomationCommand::DescribeNode(DevToolsDescribeNodeCommand {context: context.clone(),reference: Some(DevToolsDomNodeReference::FrontendNodeId(fake_describe_frontend_node_id,@@ -3101,19 +3101,19 @@ async fn node_read_unknown_frontend_node_ids_miss_after_renderer_lookup() {depth: 0,pierce: false,}),- DevToolsCommand::GetOuterHtml(DevToolsGetOuterHtmlCommand {+ AutomationCommand::GetOuterHtml(DevToolsGetOuterHtmlCommand {context: context.clone(),reference: Some(DevToolsDomNodeReference::FrontendNodeId(fake_outer_html_frontend_node_id,)),include_shadow_dom: false,}),- DevToolsCommand::DomGeometry(DevToolsDomGeometryCommand {+ AutomationCommand::DomGeometry(DevToolsDomGeometryCommand {context: context.clone(),reference: DevToolsDomNodeReference::FrontendNodeId(fake_geometry_frontend_node_id),operation: DevToolsDomGeometryOperation::GetBoxModel,}),- DevToolsCommand::ScrollIntoViewIfNeeded(DevToolsScrollIntoViewIfNeededCommand {+ AutomationCommand::ScrollIntoViewIfNeeded(DevToolsScrollIntoViewIfNeededCommand {context,reference: Some(DevToolsDomNodeReference::FrontendNodeId(fake_scroll_frontend_node_id,@@ -3125,7 +3125,7 @@ async fn node_read_unknown_frontend_node_ids_miss_after_renderer_lookup() {for command in commands {let (result, _) = ctx.conn- .execute_devtools_command(command)+ .execute_automation_command(command).await.into_parts();let error = result.expect_err("fake frontend id should not use protocol binding");@@ -4125,19 +4125,21 @@ async fn get_outer_html_include_shadow_dom_is_command_local_across_all_referencelet (document_result, _) = ctx.conn- .execute_devtools_command(DevToolsCommand::GetOuterHtml(DevToolsGetOuterHtmlCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::Cdp,- session_id: None,- target_id: None,- browser_context_id: None,+ .execute_automation_command(AutomationCommand::GetOuterHtml(+ DevToolsGetOuterHtmlCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::Cdp,+ session_id: None,+ target_id: None,+ browser_context_id: None,+ },+ reference: None,+ include_shadow_dom: true,},- reference: None,- include_shadow_dom: true,- }))+ )).await.into_parts();- let DevToolsCommandResult::GetOuterHtml(document_result) =+ let AutomationResult::GetOuterHtml(document_result) =document_result.expect("document outerHTML command should succeed")else {panic!("expected document outerHTML result");@@ -4667,15 +4669,15 @@ async fn query_selector_accepts_renderer_backend_shadow_root_reference() {"shadow root backend id should be renderer-owned: {described}");- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::Cdp,+ let context = AutomationContext {+ protocol: FrontendProtocol::Cdp,session_id: None,target_id: Some(DevToolsTargetId::from("TID-1")),browser_context_id: Some(DevToolsBrowserContextId::from("BID-A")),};let result = ctx.conn- .execute_devtools_command(DevToolsCommand::QuerySelector(+ .execute_automation_command(AutomationCommand::QuerySelector(DevToolsQuerySelectorCommand {context: context.clone(),root: Some(DevToolsDomNodeReference::BackendNodeId(@@ -4689,7 +4691,7 @@ async fn query_selector_accepts_renderer_backend_shadow_root_reference() {.into_parts().0.expect("shadow root backend querySelector should run");- let DevToolsCommandResult::QuerySelector(result) = result else {+ let AutomationResult::QuerySelector(result) = result else {panic!("expected query selector result");};assert_eq!(result.node_ids.len(), 1);@@ -4697,17 +4699,19 @@ async fn query_selector_accepts_renderer_backend_shadow_root_reference() {assert!(found_node_id > 0);let described = ctx.conn- .execute_devtools_command(DevToolsCommand::DescribeNode(DevToolsDescribeNodeCommand {- context,- reference: Some(DevToolsDomNodeReference::FrontendNodeId(found_node_id)),- depth: 0,- pierce: false,- }))+ .execute_automation_command(AutomationCommand::DescribeNode(+ DevToolsDescribeNodeCommand {+ context,+ reference: Some(DevToolsDomNodeReference::FrontendNodeId(found_node_id)),+ depth: 0,+ pierce: false,+ },+ )).await.into_parts().0.expect("child shadow query result nodeId should be describable");- let DevToolsCommandResult::DescribeNode(described) = described else {+ let AutomationResult::DescribeNode(described) = described else {panic!("expected describe node result");};assert_eq!(described.node["attributes"][0], "id");@@ -4764,15 +4768,15 @@ async fn child_frame_query_selector_accepts_renderer_backend_shadow_root_referen.await;let _ = take_response_by_id(&mut ctx, 5);- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::Cdp,+ let context = AutomationContext {+ protocol: FrontendProtocol::Cdp,session_id: None,target_id: Some(DevToolsTargetId::from(child_frame_id.as_str())),browser_context_id: Some(DevToolsBrowserContextId::from("BID-CHILD-SHADOW-QUERY")),};let host_query = ctx.conn- .execute_devtools_command(DevToolsCommand::QuerySelector(+ .execute_automation_command(AutomationCommand::QuerySelector(DevToolsQuerySelectorCommand {context: context.clone(),root: None,@@ -4784,7 +4788,7 @@ async fn child_frame_query_selector_accepts_renderer_backend_shadow_root_referen.into_parts().0.expect("child host querySelector should run");- let DevToolsCommandResult::QuerySelector(host_query) = host_query else {+ let AutomationResult::QuerySelector(host_query) = host_query else {panic!("expected query selector result");};let host_frontend_node_id = host_query@@ -4795,19 +4799,21 @@ async fn child_frame_query_selector_accepts_renderer_backend_shadow_root_referenlet frontend_described = ctx.conn- .execute_devtools_command(DevToolsCommand::DescribeNode(DevToolsDescribeNodeCommand {- context: context.clone(),- reference: Some(DevToolsDomNodeReference::FrontendNodeId(- host_frontend_node_id,- )),- depth: 1,- pierce: true,- }))+ .execute_automation_command(AutomationCommand::DescribeNode(+ DevToolsDescribeNodeCommand {+ context: context.clone(),+ reference: Some(DevToolsDomNodeReference::FrontendNodeId(+ host_frontend_node_id,+ )),+ depth: 1,+ pierce: true,+ },+ )).await.into_parts().0.expect("child host frontend describe should run");- let DevToolsCommandResult::DescribeNode(frontend_described) = frontend_described else {+ let AutomationResult::DescribeNode(frontend_described) = frontend_described else {panic!("expected describe node result");};let shadow_root_backend_node_id = frontend_described.node["shadowRoots"][0]["backendNodeId"]@@ -4820,7 +4826,7 @@ async fn child_frame_query_selector_accepts_renderer_backend_shadow_root_referen);let result = ctx.conn- .execute_devtools_command(DevToolsCommand::QuerySelector(+ .execute_automation_command(AutomationCommand::QuerySelector(DevToolsQuerySelectorCommand {context,root: Some(DevToolsDomNodeReference::BackendNodeId(@@ -4834,7 +4840,7 @@ async fn child_frame_query_selector_accepts_renderer_backend_shadow_root_referen.into_parts().0.expect("child shadow root backend querySelector should run");- let DevToolsCommandResult::QuerySelector(result) = result else {+ let AutomationResult::QuerySelector(result) = result else {panic!("expected query selector result");};assert_eq!(result.node_ids.len(), 1);@@ -4890,27 +4896,29 @@ async fn child_frame_describe_backend_host_returns_queryable_shadow_root_backend.and_then(|id| u32::try_from(id).ok()).expect("child host should return backendNodeId");- let context = DevToolsCommandContext {- protocol: DevToolsProtocol::Cdp,+ let context = AutomationContext {+ protocol: FrontendProtocol::Cdp,session_id: None,target_id: Some(DevToolsTargetId::from(child_frame_id.as_str())),browser_context_id: Some(DevToolsBrowserContextId::from("BID-CHILD-SHADOW-DESCRIBE")),};let described = ctx.conn- .execute_devtools_command(DevToolsCommand::DescribeNode(DevToolsDescribeNodeCommand {- context: context.clone(),- reference: Some(DevToolsDomNodeReference::BackendNodeId(- host_backend_node_id,- )),- depth: 1,- pierce: true,- }))+ .execute_automation_command(AutomationCommand::DescribeNode(+ DevToolsDescribeNodeCommand {+ context: context.clone(),+ reference: Some(DevToolsDomNodeReference::BackendNodeId(+ host_backend_node_id,+ )),+ depth: 1,+ pierce: true,+ },+ )).await.into_parts().0.expect("child host backend describe should run");- let DevToolsCommandResult::DescribeNode(described) = described else {+ let AutomationResult::DescribeNode(described) = described else {panic!("expected describe node result");};let shadow_root_backend_node_id = described.node["shadowRoots"][0]["backendNodeId"]@@ -4920,7 +4928,7 @@ async fn child_frame_describe_backend_host_returns_queryable_shadow_root_backendlet result = ctx.conn- .execute_devtools_command(DevToolsCommand::QuerySelector(+ .execute_automation_command(AutomationCommand::QuerySelector(DevToolsQuerySelectorCommand {context,root: Some(DevToolsDomNodeReference::BackendNodeId(@@ -4934,7 +4942,7 @@ async fn child_frame_describe_backend_host_returns_queryable_shadow_root_backend.into_parts().0.expect("child shadow root backend from backend describe should query");- let DevToolsCommandResult::QuerySelector(result) = result else {+ let AutomationResult::QuerySelector(result) = result else {panic!("expected query selector result");};assert_eq!(result.node_ids.len(), 1);diff --git a/moli-protocol/src/domains/emulation.rs b/moli-protocol/src/domains/emulation.rsindex 16a19fc63..4c09804e7 100644--- a/moli-protocol/src/domains/emulation.rs+++ b/moli-protocol/src/domains/emulation.rs@@ -1,10 +1,5 @@-use crate::conn::{- BrowserContext, CdpConnection, CdpSessionRoute, Cmd, CommandOwnerScope, EmulatedDeviceMetrics,- EmulatedGeolocationOverrideState, EmulatedViewportSurface, RendererCommandCorrelation,- RendererCommandDescriptor, RuntimeInspectorAsyncCompletionReceiver, TargetWindowSurfaceState,-};-use crate::devtools_runtime::{- DevToolsCommand, DevToolsCommandResult, DevToolsDevicePixelRatioSetting, DevToolsError,+use crate::automation::{+ AutomationCommand, AutomationResult, DevToolsDevicePixelRatioSetting, DevToolsError,DevToolsErrorKind, DevToolsGeolocationOverride, DevToolsGeolocationOverrideState,DevToolsNetworkConditions, DevToolsSetClientWindowStateCommand,DevToolsSetClientWindowStateResult, DevToolsSetExtraHeadersCommand,@@ -13,6 +8,11 @@ use crate::devtools_runtime::{DevToolsSetUserAgentOverrideCommand, DevToolsSetViewportCommand, DevToolsTargetId,DevToolsViewportSetting, DevToolsWindowState,};+use crate::conn::{+ BrowserContext, CdpConnection, CdpSessionRoute, Cmd, CommandOwnerScope, EmulatedDeviceMetrics,+ EmulatedGeolocationOverrideState, EmulatedViewportSurface, RendererCommandCorrelation,+ RendererCommandDescriptor, RuntimeInspectorAsyncCompletionReceiver, TargetWindowSurfaceState,+};use crate::domains::actions::EmulationAction;use crate::domains::command_output::CommandOutputPlan;use moli_core::page::{@@ -1198,34 +1198,34 @@ fn set_viewport_metrics_from_current(pub(crate) async fn execute_devtools_emulation_command_async(conn: &mut CdpConnection,- command: DevToolsCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+ command: AutomationCommand,+) -> Result<AutomationResult, DevToolsError> {match command {- DevToolsCommand::SetViewport(command) => {+ AutomationCommand::SetViewport(command) => {execute_devtools_set_viewport_command_async(conn, command).await}- DevToolsCommand::SetWindowState(command) => {+ AutomationCommand::SetWindowState(command) => {execute_devtools_set_window_state_command_async(conn, command).await}- DevToolsCommand::SetClientWindowState(command) => {+ AutomationCommand::SetClientWindowState(command) => {execute_devtools_set_client_window_state_command_async(conn, command).await}- DevToolsCommand::SetUserAgentOverride(command) => {+ AutomationCommand::SetUserAgentOverride(command) => {execute_devtools_set_user_agent_override_command_async(conn, command).await}- DevToolsCommand::SetLocaleOverride(command) => {+ AutomationCommand::SetLocaleOverride(command) => {execute_devtools_set_locale_override_command_async(conn, command).await}- DevToolsCommand::SetTimezoneOverride(command) => {+ AutomationCommand::SetTimezoneOverride(command) => {execute_devtools_set_timezone_override_command(conn, command)}- DevToolsCommand::SetGeolocationOverride(command) => {+ AutomationCommand::SetGeolocationOverride(command) => {execute_devtools_set_geolocation_override_command_async(conn, command).await}- DevToolsCommand::SetNetworkConditions(command) => {+ AutomationCommand::SetNetworkConditions(command) => {execute_devtools_set_network_conditions_command_async(conn, command).await}- DevToolsCommand::SetExtraHeaders(command) => {+ AutomationCommand::SetExtraHeaders(command) => {execute_devtools_set_extra_headers_command_async(conn, command).await}_ => Err(DevToolsError::new(@@ -1238,7 +1238,7 @@ pub(crate) async fn execute_devtools_emulation_command_async(async fn execute_devtools_set_extra_headers_command_async(conn: &mut CdpConnection,command: DevToolsSetExtraHeadersCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {if !command.target_ids.is_empty() {return execute_devtools_set_extra_headers_for_targets(conn, command).await;}@@ -1251,12 +1251,12 @@ async fn execute_devtools_set_extra_headers_command_async(async fn execute_devtools_set_extra_headers_global(conn: &mut CdpConnection,command: DevToolsSetExtraHeadersCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {conn.set_global_extra_headers(command.headers.clone());let routes = top_level_target_routes_for_browser_contexts(conn, None);execute_extra_headers_updates_for_routes(conn,- devtools_command_session_id(&command.context),+ automation_command_session_id(&command.context),routes,).await@@ -1265,7 +1265,7 @@ async fn execute_devtools_set_extra_headers_global(async fn execute_devtools_set_extra_headers_for_browser_contexts(conn: &mut CdpConnection,command: DevToolsSetExtraHeadersCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let browser_context_ids = resolve_bidi_browser_context_ids(conn, &command.browser_context_ids)?;for browser_context_id in &browser_context_ids {let browser_context = conn@@ -1276,7 +1276,7 @@ async fn execute_devtools_set_extra_headers_for_browser_contexts(let routes = top_level_target_routes_for_browser_contexts(conn, Some(&browser_context_ids));execute_extra_headers_updates_for_routes(conn,- devtools_command_session_id(&command.context),+ automation_command_session_id(&command.context),routes,).await@@ -1285,7 +1285,7 @@ async fn execute_devtools_set_extra_headers_for_browser_contexts(async fn execute_devtools_set_extra_headers_for_targets(conn: &mut CdpConnection,command: DevToolsSetExtraHeadersCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let mut pending = Vec::new();for target_id in &command.target_ids {let route = emulation_route_for_target(@@ -1296,14 +1296,18 @@ async fn execute_devtools_set_extra_headers_for_targets(let result = start_extra_headers_for_current_route(conn, &route, command.headers.clone());pending.extend(result?);}- complete_emulation_page_updates(conn, devtools_command_session_id(&command.context), pending)- .await+ complete_emulation_page_updates(+ conn,+ automation_command_session_id(&command.context),+ pending,+ )+ .await}async fn execute_devtools_set_network_conditions_command_async(conn: &mut CdpConnection,command: DevToolsSetNetworkConditionsCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {if !command.target_ids.is_empty() {return execute_devtools_set_network_conditions_for_targets(conn, command).await;}@@ -1316,7 +1320,7 @@ async fn execute_devtools_set_network_conditions_command_async(async fn execute_devtools_set_geolocation_override_command_async(conn: &mut CdpConnection,command: DevToolsSetGeolocationOverrideCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {if !command.target_ids.is_empty() {return execute_devtools_set_geolocation_override_for_targets(conn, command).await;}@@ -1329,7 +1333,7 @@ async fn execute_devtools_set_geolocation_override_command_async(async fn execute_devtools_set_geolocation_override_global(conn: &mut CdpConnection,command: DevToolsSetGeolocationOverrideCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {conn.set_global_geolocation_override(command.override_state@@ -1338,7 +1342,7 @@ async fn execute_devtools_set_geolocation_override_global(let routes = top_level_target_routes_for_browser_contexts(conn, None);execute_geolocation_surface_updates_for_routes(conn,- devtools_command_session_id(&command.context),+ automation_command_session_id(&command.context),routes,).await@@ -1347,7 +1351,7 @@ async fn execute_devtools_set_geolocation_override_global(async fn execute_devtools_set_geolocation_override_for_targets(conn: &mut CdpConnection,command: DevToolsSetGeolocationOverrideCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let mut pending = Vec::new();for target_id in &command.target_ids {let route = emulation_route_for_target(@@ -1364,14 +1368,18 @@ async fn execute_devtools_set_geolocation_override_for_targets();pending.extend(result?);}- complete_emulation_page_updates(conn, devtools_command_session_id(&command.context), pending)- .await+ complete_emulation_page_updates(+ conn,+ automation_command_session_id(&command.context),+ pending,+ )+ .await}async fn execute_devtools_set_geolocation_override_for_browser_contexts(conn: &mut CdpConnection,command: DevToolsSetGeolocationOverrideCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let browser_context_ids = resolve_bidi_browser_context_ids(conn, &command.browser_context_ids)?;for browser_context_id in &browser_context_ids {let browser_context = conn@@ -1384,7 +1392,7 @@ async fn execute_devtools_set_geolocation_override_for_browser_contexts(let routes = top_level_target_routes_for_browser_contexts(conn, Some(&browser_context_ids));execute_geolocation_surface_updates_for_routes(conn,- devtools_command_session_id(&command.context),+ automation_command_session_id(&command.context),routes,).await@@ -1394,7 +1402,7 @@ async fn execute_geolocation_surface_updates_for_routes(conn: &mut CdpConnection,session_id: Option<String>,routes: Vec<CdpSessionRoute>,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let mut pending = Vec::new();for route in routes {let target = pending_emulation_target_for_route(conn, &route)?;@@ -1429,12 +1437,12 @@ fn start_geolocation_override_for_current_route(async fn execute_devtools_set_network_conditions_global(conn: &mut CdpConnection,command: DevToolsSetNetworkConditionsCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {conn.set_global_network_conditions(command.network_conditions.map(emulated_network_conditions));let routes = top_level_target_routes_for_browser_contexts(conn, None);execute_network_conditions_updates_for_routes(conn,- devtools_command_session_id(&command.context),+ automation_command_session_id(&command.context),routes,).await@@ -1443,7 +1451,7 @@ async fn execute_devtools_set_network_conditions_global(async fn execute_devtools_set_network_conditions_for_targets(conn: &mut CdpConnection,command: DevToolsSetNetworkConditionsCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let mut pending = Vec::new();for target_id in &command.target_ids {let route = emulation_route_for_target(@@ -1455,14 +1463,18 @@ async fn execute_devtools_set_network_conditions_for_targets(start_network_conditions_for_current_route(conn, &route, command.network_conditions);pending.extend(result?);}- complete_emulation_page_updates(conn, devtools_command_session_id(&command.context), pending)- .await+ complete_emulation_page_updates(+ conn,+ automation_command_session_id(&command.context),+ pending,+ )+ .await}async fn execute_devtools_set_network_conditions_for_browser_contexts(conn: &mut CdpConnection,command: DevToolsSetNetworkConditionsCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let browser_context_ids = resolve_bidi_browser_context_ids(conn, &command.browser_context_ids)?;for browser_context_id in &browser_context_ids {let browser_context = conn@@ -1474,7 +1486,7 @@ async fn execute_devtools_set_network_conditions_for_browser_contexts(let routes = top_level_target_routes_for_browser_contexts(conn, Some(&browser_context_ids));execute_network_conditions_updates_for_routes(conn,- devtools_command_session_id(&command.context),+ automation_command_session_id(&command.context),routes,).await@@ -1484,7 +1496,7 @@ async fn execute_network_conditions_updates_for_routes(conn: &mut CdpConnection,session_id: Option<String>,routes: Vec<CdpSessionRoute>,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let mut pending = Vec::new();for route in routes {let result = start_network_conditions_update_for_current_route(conn, &route);@@ -1573,7 +1585,7 @@ async fn execute_extra_headers_updates_for_routes(conn: &mut CdpConnection,session_id: Option<String>,routes: Vec<CdpSessionRoute>,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let mut pending = Vec::new();for route in routes {pending.extend(start_extra_headers_update_for_route(conn, &route)?);@@ -1672,7 +1684,7 @@ fn emulated_geolocation_override_state(async fn execute_devtools_set_user_agent_override_command_async(conn: &mut CdpConnection,command: DevToolsSetUserAgentOverrideCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {if !command.target_ids.is_empty() {return execute_devtools_set_user_agent_override_for_targets(conn, command).await;}@@ -1696,7 +1708,7 @@ async fn execute_devtools_set_user_agent_override_command_async(async fn execute_devtools_set_user_agent_override_for_targets(conn: &mut CdpConnection,command: DevToolsSetUserAgentOverrideCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let mut pending = Vec::new();for target_id in &command.target_ids {let route = emulation_route_for_target(@@ -1725,7 +1737,7 @@ async fn execute_devtools_set_user_agent_override_for_targets(async fn execute_devtools_set_user_agent_override_for_browser_contexts(conn: &mut CdpConnection,command: DevToolsSetUserAgentOverrideCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let browser_context_ids = resolve_bidi_browser_context_ids(conn, &command.browser_context_ids)?;let fallback_identity = conn.base_browser_identity().clone();for browser_context_id in &browser_context_ids {@@ -1752,7 +1764,7 @@ async fn execute_user_agent_loader_updates_for_routes(conn: &mut CdpConnection,session_id: Option<String>,routes: Vec<CdpSessionRoute>,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let mut pending = Vec::new();for route in routes {let result = start_user_agent_loader_update_for_current_route(conn, &route);@@ -1767,9 +1779,9 @@ async fn complete_emulation_page_updates(conn: &mut CdpConnection,session_id: Option<String>,pending: Vec<PendingEmulationPageCommand>,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {if pending.is_empty() {- return Ok(DevToolsCommandResult::Empty);+ return Ok(AutomationResult::Empty);}complete_pending_devtools_emulation_command(conn,@@ -1847,7 +1859,7 @@ fn single_environment_owner<T>(owners: &[T]) -> Result<&T, DevToolsError> {async fn execute_devtools_set_locale_override_command_async(conn: &mut CdpConnection,command: DevToolsSetLocaleOverrideCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {if !command.target_ids.is_empty() {return execute_devtools_set_locale_override_for_targets(conn, command).await;}@@ -1863,7 +1875,7 @@ async fn execute_devtools_set_locale_override_command_async(async fn execute_devtools_set_locale_override_for_targets(conn: &mut CdpConnection,command: DevToolsSetLocaleOverrideCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let target_id = single_environment_owner(&command.target_ids)?;let route = emulation_route_for_target(conn,@@ -1871,14 +1883,18 @@ async fn execute_devtools_set_locale_override_for_targets("ChildFrameContextNotSupportedForLocaleOverride",)?;let pending = start_locale_override_for_current_route(conn, &route, command.locale)?;- complete_emulation_page_updates(conn, devtools_command_session_id(&command.context), pending)- .await+ complete_emulation_page_updates(+ conn,+ automation_command_session_id(&command.context),+ pending,+ )+ .await}async fn execute_devtools_set_locale_override_for_browser_contexts(conn: &mut CdpConnection,command: DevToolsSetLocaleOverrideCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let browser_context_ids = resolve_bidi_browser_context_ids(conn, &command.browser_context_ids)?;let fallback_identity = conn.base_browser_identity().clone();let browser_context_id = single_environment_owner(&browser_context_ids)?;@@ -1887,15 +1903,19 @@ async fn execute_devtools_set_locale_override_for_browser_contexts(.set_default_locale_override(command.locale, &fallback_identity).map_err(|message| DevToolsError::new(DevToolsErrorKind::InvalidArgument, message))?;let routes = top_level_target_routes_for_browser_contexts(conn, Some(&browser_context_ids));- execute_locale_updates_for_routes(conn, devtools_command_session_id(&command.context), routes)- .await+ execute_locale_updates_for_routes(+ conn,+ automation_command_session_id(&command.context),+ routes,+ )+ .await}async fn execute_locale_updates_for_routes(conn: &mut CdpConnection,session_id: Option<String>,routes: Vec<CdpSessionRoute>,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let mut pending = Vec::new();for route in routes {let result = start_locale_update_for_current_route(conn, &route);@@ -1931,7 +1951,7 @@ fn start_locale_update_for_current_route(fn execute_devtools_set_timezone_override_command(conn: &mut CdpConnection,command: DevToolsSetTimezoneOverrideCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {if !command.target_ids.is_empty() {return execute_devtools_set_timezone_override_for_targets(conn, command);}@@ -1947,7 +1967,7 @@ fn execute_devtools_set_timezone_override_command(fn execute_devtools_set_timezone_override_for_targets(conn: &mut CdpConnection,command: DevToolsSetTimezoneOverrideCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let target_id = single_environment_owner(&command.target_ids)?;let route = emulation_route_for_target(conn,@@ -1957,20 +1977,20 @@ fn execute_devtools_set_timezone_override_for_targets(let owner = CommandOwnerScope::for_route(route);conn.set_base_timezone_override_for_owner(&owner, command.timezone).map_err(|message| DevToolsError::new(DevToolsErrorKind::InvalidArgument, message))?;- Ok(DevToolsCommandResult::Empty)+ Ok(AutomationResult::Empty)}fn execute_devtools_set_timezone_override_for_browser_contexts(conn: &mut CdpConnection,command: DevToolsSetTimezoneOverrideCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let browser_context_ids = resolve_bidi_browser_context_ids(conn, &command.browser_context_ids)?;let browser_context_id = single_environment_owner(&browser_context_ids)?;conn.browser_context_by_id_mut(browser_context_id).expect("resolved browser context must remain addressable").set_default_timezone_override(command.timezone).map_err(|message| DevToolsError::new(DevToolsErrorKind::InvalidArgument, message))?;- Ok(DevToolsCommandResult::Empty)+ Ok(AutomationResult::Empty)}fn pending_emulation_target_for_route(@@ -2013,9 +2033,7 @@ fn emulation_route_for_target())}-fn devtools_command_session_id(- context: &crate::devtools_runtime::DevToolsCommandContext,-) -> Option<String> {+fn automation_command_session_id(context: &crate::automation::AutomationContext) -> Option<String> {context.session_id.as_ref()@@ -2024,7 +2042,7 @@ fn devtools_command_session_id(fn resolve_bidi_browser_context_ids(conn: &mut CdpConnection,- browser_context_ids: &[crate::devtools_runtime::DevToolsBrowserContextId],+ browser_context_ids: &[crate::automation::DevToolsBrowserContextId],) -> Result<Vec<String>, DevToolsError> {let mut resolved = Vec::new();for browser_context_id in browser_context_ids {@@ -2091,7 +2109,7 @@ fn devtools_emulation_owner_error(error: String) -> DevToolsError {async fn execute_devtools_set_viewport_command_async(conn: &mut CdpConnection,command: DevToolsSetViewportCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {if !command.browser_context_ids.is_empty() {return execute_devtools_set_viewport_for_browser_contexts(conn, command).await;}@@ -2122,7 +2140,7 @@ async fn execute_devtools_set_viewport_command_async(let completed = pending.wait().await;complete_pending_devtools_emulation_command(conn, completed)}- Ok(None) => Ok(DevToolsCommandResult::Empty),+ Ok(None) => Ok(AutomationResult::Empty),Err(error) => Err(error),};}@@ -2135,15 +2153,15 @@ async fn execute_devtools_set_viewport_command_async(let completed = pending.wait().await;complete_pending_devtools_emulation_command(conn, completed)}- Ok(None) => Ok(DevToolsCommandResult::Empty),+ Ok(None) => Ok(AutomationResult::Empty),Err(error) => Err(error),}}async fn execute_devtools_set_window_state_command_async(conn: &mut CdpConnection,- command: crate::devtools_runtime::DevToolsSetWindowStateCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+ command: crate::automation::DevToolsSetWindowStateCommand,+) -> Result<AutomationResult, DevToolsError> {if let Some(target_id) = command.context.target_id.as_ref() {let route = emulation_route_for_target(conn,@@ -2168,9 +2186,9 @@ async fn execute_devtools_set_window_state_command_async(async fn execute_devtools_set_window_state_for_owner(conn: &mut CdpConnection,- command: crate::devtools_runtime::DevToolsSetWindowStateCommand,+ command: crate::automation::DevToolsSetWindowStateCommand,owner: CommandOwnerScope,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let state = target_window_surface_state_from_devtools(command.state);if conn.with_target_owner_state_for_owner_mut(&owner, |owner_state| {@@ -2185,14 +2203,18 @@ async fn execute_devtools_set_window_state_for_owner(}let pending = start_session_surface_override_page_command_for_owner(conn, &owner).map_err(devtools_emulation_owner_error)?;- complete_emulation_page_updates(conn, devtools_command_session_id(&command.context), pending)- .await+ complete_emulation_page_updates(+ conn,+ automation_command_session_id(&command.context),+ pending,+ )+ .await}async fn execute_devtools_set_client_window_state_command_async(conn: &mut CdpConnection,command: DevToolsSetClientWindowStateCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let route = conn.target_session_route_for_target_id(command.client_window.as_str()).ok_or_else(|| DevToolsError::new(DevToolsErrorKind::NoSuchTarget, "NoSuchTarget"))?;@@ -2201,7 +2223,7 @@ async fn execute_devtools_set_client_window_state_command_async(window_state_context.target_id = Some(command.client_window.clone());let result = execute_devtools_set_window_state_for_owner(conn,- crate::devtools_runtime::DevToolsSetWindowStateCommand {+ crate::automation::DevToolsSetWindowStateCommand {context: window_state_context,state: command.state,},@@ -2222,7 +2244,7 @@ async fn execute_devtools_set_client_window_state_command_async(});super::target::devtools_client_window_info_for_target(conn, &command.client_window).map(|client_window| {- DevToolsCommandResult::ClientWindow(DevToolsSetClientWindowStateResult {+ AutomationResult::ClientWindow(DevToolsSetClientWindowStateResult {client_window,})})@@ -2246,7 +2268,7 @@ fn target_window_surface_state_from_devtools(async fn execute_devtools_set_viewport_for_browser_contexts(conn: &mut CdpConnection,command: DevToolsSetViewportCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let browser_context_ids = resolve_set_viewport_browser_context_ids(conn, &command)?;let mut pending = Vec::new();for browser_context_id in browser_context_ids {@@ -2264,7 +2286,7 @@ async fn execute_devtools_set_viewport_for_browser_contexts()?);}if pending.is_empty() {- return Ok(DevToolsCommandResult::Empty);+ return Ok(AutomationResult::Empty);}complete_pending_devtools_emulation_command(conn,@@ -2289,7 +2311,7 @@ fn resolve_set_viewport_browser_context_ids(let mut resolved = Vec::new();for browser_context_id in &command.browser_context_ids {let browser_context_id = browser_context_id.as_str();- if command.context.protocol == crate::devtools_runtime::DevToolsProtocol::WebDriverBidi+ if command.context.protocol == crate::automation::FrontendProtocol::WebDriverBidi&& browser_context_id == "default"{let mut default_context_ids = conn@@ -2366,7 +2388,7 @@ fn start_browser_context_default_device_metrics_page_commands(fn complete_pending_devtools_emulation_command(conn: &mut CdpConnection,completed: CompletedEmulationCommandDispatch,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let CompletedEmulationRendererDispatch::Pages(completed_pages) = completed.completed else {return Err(DevToolsError::new(DevToolsErrorKind::Internal,@@ -2399,7 +2421,7 @@ fn complete_pending_devtools_emulation_command(finish_pending_emulation_page_command(conn, operation, target, completion).map_err(|error| DevToolsError::new(DevToolsErrorKind::Internal, error))?;}- Ok(DevToolsCommandResult::Empty)+ Ok(AutomationResult::Empty)}pub(crate) fn complete_pending_emulation_command(diff --git a/moli-protocol/src/domains/emulation/device.rs b/moli-protocol/src/domains/emulation/device.rsindex 9bdc6ebe1..9fb0e5743 100644--- a/moli-protocol/src/domains/emulation/device.rs+++ b/moli-protocol/src/domains/emulation/device.rs@@ -8,8 +8,8 @@ pub(super) fn metrics_from_cdp(params: SetDeviceMetricsOverrideParams,previous: Option<&EmulatedDeviceMetrics>,base: &crate::conn::EmulatedViewportSurface,-) -> Result<EmulatedDeviceMetrics, crate::devtools_runtime::DevToolsError> {- use crate::devtools_runtime::{DevToolsError, DevToolsErrorKind};+) -> Result<EmulatedDeviceMetrics, crate::automation::DevToolsError> {+ use crate::automation::{DevToolsError, DevToolsErrorKind};let invalid = || DevToolsError::new(DevToolsErrorKind::InvalidArgument, "InvalidParams");let size = |value: i64| {if (0..=10_000_000).contains(&value) {diff --git a/moli-protocol/src/domains/emulation/tests.rs b/moli-protocol/src/domains/emulation/tests.rsindex 6b7db8409..e9adbff07 100644--- a/moli-protocol/src/domains/emulation/tests.rs+++ b/moli-protocol/src/domains/emulation/tests.rs@@ -1,13 +1,13 @@+use crate::automation::{+ AutomationCommand, AutomationContext, AutomationResult, DevToolsBrowserContextId,+ DevToolsSessionId, DevToolsSetExtraHeadersCommand, DevToolsSetLocaleOverrideCommand,+ DevToolsSetUserAgentOverrideCommand, DevToolsTargetId, FrontendProtocol,+};use crate::conn::{BrowserContext, CdpCommandTaskStep, EmulatedGeolocationOverride,EmulatedGeolocationOverrideState, PageTargetHost, PendingCdpCommandDispatch,TargetIdentityState, TargetPageSlot,};-use crate::devtools_runtime::{- DevToolsBrowserContextId, DevToolsCommand, DevToolsCommandContext, DevToolsCommandResult,- DevToolsProtocol, DevToolsSessionId, DevToolsSetExtraHeadersCommand,- DevToolsSetLocaleOverrideCommand, DevToolsSetUserAgentOverrideCommand, DevToolsTargetId,-};use crate::testing::{TestContext, wait_until_message};use axum::{Router, extract::State, http::HeaderMap, response::IntoResponse, routing::get};use parking_lot::Mutex;@@ -160,9 +160,9 @@ async fn install_session_page_for_emulation_test(.await;}-fn bidi_command_context() -> DevToolsCommandContext {- DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+fn bidi_command_context() -> AutomationContext {+ AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,@@ -177,7 +177,7 @@ async fn execute_set_extra_headers_for_test() {let outcome = ctx.conn- .execute_devtools_command(DevToolsCommand::SetExtraHeaders(+ .execute_automation_command(AutomationCommand::SetExtraHeaders(DevToolsSetExtraHeadersCommand {context: bidi_command_context(),target_ids: target_ids.into_iter().map(DevToolsTargetId::from).collect(),@@ -198,7 +198,7 @@ async fn execute_set_extra_headers_for_test(assert!(events.is_empty());assert!(protocol_events.is_empty());assert!(renderer_output_predecessor.is_none());- assert!(matches!(result, Ok(DevToolsCommandResult::Empty)));+ assert!(matches!(result, Ok(AutomationResult::Empty)));}#[tokio::test(flavor = "multi_thread")]@@ -511,7 +511,7 @@ async fn pending_emulation_completion_follows_the_exact_target_across_activation},).expect("the stored target policy should be replayed into the replacement document");- assert!(matches!(result, DevToolsCommandResult::Empty));+ assert!(matches!(result, AutomationResult::Empty));}#[tokio::test(flavor = "multi_thread")]@@ -2814,23 +2814,23 @@ async fn bidi_user_context_locale_composes_with_user_agent_on_all_identity_surfactx.conn.install_browser_context_fixture_for_test(bc);for command in [- DevToolsCommand::SetUserAgentOverride(DevToolsSetUserAgentOverrideCommand {+ AutomationCommand::SetUserAgentOverride(DevToolsSetUserAgentOverrideCommand {context: bidi_command_context(),target_ids: Vec::new(),browser_context_ids: vec![DevToolsBrowserContextId::from("BID-1")],user_agent: Some("MoliBiDi/1.0".to_owned()),}),- DevToolsCommand::SetLocaleOverride(DevToolsSetLocaleOverrideCommand {+ AutomationCommand::SetLocaleOverride(DevToolsSetLocaleOverrideCommand {context: bidi_command_context(),target_ids: Vec::new(),browser_context_ids: vec![DevToolsBrowserContextId::from("BID-1")],locale: Some("fr-FR".to_owned()),}),] {- let outcome = ctx.conn.execute_devtools_command(command).await;+ let outcome = ctx.conn.execute_automation_command(command).await;let (result, events, protocol_events, renderer_output_predecessor) =outcome.into_complete_parts();- assert!(matches!(result, Ok(DevToolsCommandResult::Empty)));+ assert!(matches!(result, Ok(AutomationResult::Empty)));assert!(events.is_empty());assert!(protocol_events.is_empty());assert!(renderer_output_predecessor.is_none());diff --git a/moli-protocol/src/domains/emulation/tests/native_navigator.rs b/moli-protocol/src/domains/emulation/tests/native_navigator.rsindex 6a594d55a..dc363d271 100644--- a/moli-protocol/src/domains/emulation/tests/native_navigator.rs+++ b/moli-protocol/src/domains/emulation/tests/native_navigator.rs@@ -1,5 +1,5 @@use super::*;-use crate::devtools_runtime::{+use crate::automation::{DevToolsDevicePixelRatioSetting, DevToolsSetViewportCommand, DevToolsViewportSetting,};@@ -569,7 +569,7 @@ async fn clearing_target_metrics_restores_browser_context_viewport_defaults() {let mut ctx = setup().await;let (result, _) = ctx.conn- .execute_devtools_command(DevToolsCommand::SetViewport(DevToolsSetViewportCommand {+ .execute_automation_command(AutomationCommand::SetViewport(DevToolsSetViewportCommand {context: bidi_command_context(),browser_context_ids: vec!["BID-1".into()],viewport: DevToolsViewportSetting::Dimensions {@@ -584,7 +584,7 @@ async fn clearing_target_metrics_restores_browser_context_viewport_defaults() {.into_parts();assert_eq!(result.expect("context viewport default"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);assert_eq!(evaluate(&mut ctx, "[innerWidth, innerHeight, devicePixelRatio]").await,diff --git a/moli-protocol/src/domains/fetch.rs b/moli-protocol/src/domains/fetch.rsindex 30b127550..cdf511fb5 100644--- a/moli-protocol/src/domains/fetch.rs+++ b/moli-protocol/src/domains/fetch.rs@@ -8,15 +8,15 @@ mod patterns;mod state;mod subresource;+use crate::automation::{+ AutomationCommand, AutomationResult, DevToolsAddNetworkInterceptCommand,+ DevToolsAddNetworkInterceptResult, DevToolsError, DevToolsErrorKind,+ DevToolsNetworkInterceptPhase, FrontendProtocol,+};use crate::conn::{- BackgroundProtocolEvent, CdpConnection, Cmd, CommandOwnerScope, DevToolsCommandExecutionOutput,+ AutomationExecutionOutput, BackgroundProtocolEvent, CdpConnection, Cmd, CommandOwnerScope,FetchInterceptionPattern, FetchRequestStage as ConnFetchRequestStage,};-use crate::devtools_runtime::{- DevToolsAddNetworkInterceptCommand, DevToolsAddNetworkInterceptResult, DevToolsCommand,- DevToolsCommandResult, DevToolsError, DevToolsErrorKind, DevToolsNetworkInterceptPhase,- DevToolsProtocol,-};use crate::domains::actions::FetchAction;use crate::domains::command_output::{CommandOutputPlan, devtools_error_from_cdp_error_parts};use crate::domains::{activity, network, page};@@ -267,8 +267,8 @@ impl FetchCommandOutput {fn into_devtools_result_and_background_events(mut self,- success_result: DevToolsCommandResult,- ) -> DevToolsCommandExecutionOutput {+ success_result: AutomationResult,+ ) -> AutomationExecutionOutput {let status = self.command_status.unwrap_or_else(|| {Err(DevToolsError::new(DevToolsErrorKind::Internal,@@ -277,7 +277,7 @@ impl FetchCommandOutput {});let renderer_output_predecessor = self.plan.take_renderer_output_predecessor();let (_, events) = self.plan.into_command_status_and_background_events();- DevToolsCommandExecutionOutput::from_parts(+ AutomationExecutionOutput::from_parts(status.map(|()| success_result),events,renderer_output_predecessor,@@ -414,19 +414,19 @@ pub(crate) fn try_start_fetch_command_dispatch(pub(crate) async fn execute_devtools_fetch_command_async_with_protocol_events(conn: &mut CdpConnection,- command: DevToolsCommand,-) -> DevToolsCommandExecutionOutput {+ command: AutomationCommand,+) -> AutomationExecutionOutput {let success_result = devtools_fetch_success_result(&command);- let owner = match fetch_devtools_command_owner(conn, &command) {+ let owner = match fetch_automation_command_owner(conn, &command) {Ok(owner) => owner,- Err(error) => return DevToolsCommandExecutionOutput::new(Err(error)),+ Err(error) => return AutomationExecutionOutput::new(Err(error)),};let step = start_devtools_fetch_command_for_owner(conn, None, &owner, command);match step {FetchCommandTaskStep::Complete(mut plan) => {let renderer_output_predecessor = plan.take_renderer_output_predecessor();let (status, events) = plan.into_command_status_and_background_events();- DevToolsCommandExecutionOutput::from_parts(+ AutomationExecutionOutput::from_parts(status.unwrap_or_else(|| {Err(DevToolsError::new(@@ -448,14 +448,14 @@ pub(crate) async fn execute_devtools_fetch_command_async_with_protocol_events(}}-fn devtools_fetch_success_result(command: &DevToolsCommand) -> DevToolsCommandResult {+fn devtools_fetch_success_result(command: &AutomationCommand) -> AutomationResult {match command {- DevToolsCommand::AddNetworkIntercept(command) => {- DevToolsCommandResult::AddNetworkIntercept(DevToolsAddNetworkInterceptResult {+ AutomationCommand::AddNetworkIntercept(command) => {+ AutomationResult::AddNetworkIntercept(DevToolsAddNetworkInterceptResult {intercept_id: command.intercept_id.clone(),})}- _ => DevToolsCommandResult::Empty,+ _ => AutomationResult::Empty,}}@@ -463,19 +463,19 @@ fn start_devtools_fetch_command_for_owner(conn: &mut CdpConnection,command_id: Option<u64>,owner: &CommandOwnerScope,- command: DevToolsCommand,+ command: AutomationCommand,) -> FetchCommandTaskStep {match &command {- DevToolsCommand::AddNetworkIntercept(command) => {+ AutomationCommand::AddNetworkIntercept(command) => {start_devtools_add_network_intercept_command(conn, command_id, owner, command)}- DevToolsCommand::RemoveNetworkIntercept(command) => {+ AutomationCommand::RemoveNetworkIntercept(command) => {start_devtools_remove_network_intercept_command(conn,command_id,owner,command.intercept_id.as_str(),- command.context.protocol != DevToolsProtocol::Cdp+ command.context.protocol != FrontendProtocol::Cdp&& command.context.target_id.is_none(),)}@@ -483,35 +483,35 @@ fn start_devtools_fetch_command_for_owner(}}-fn fetch_devtools_command_owner(+fn fetch_automation_command_owner(conn: &CdpConnection,- command: &DevToolsCommand,+ command: &AutomationCommand,) -> Result<CommandOwnerScope, DevToolsError> {let (context, request_id) = match command {- DevToolsCommand::AddNetworkIntercept(command) => {- return fetch_config_devtools_command_owner(conn, &command.context);+ AutomationCommand::AddNetworkIntercept(command) => {+ return fetch_config_automation_command_owner(conn, &command.context);}- DevToolsCommand::RemoveNetworkIntercept(command) => {- return fetch_config_devtools_command_owner(conn, &command.context);+ AutomationCommand::RemoveNetworkIntercept(command) => {+ return fetch_config_automation_command_owner(conn, &command.context);}- DevToolsCommand::ContinueInterceptedRequest(command) => {+ AutomationCommand::ContinueInterceptedRequest(command) => {(&command.context, command.request_id.as_str())}- DevToolsCommand::ContinueInterceptedResponse(command) => {+ AutomationCommand::ContinueInterceptedResponse(command) => {(&command.context, command.request_id.as_str())}- DevToolsCommand::ContinueWithAuth(command) => {+ AutomationCommand::ContinueWithAuth(command) => {(&command.context, command.request_id.as_str())}- DevToolsCommand::FailInterceptedRequest(command) => {+ AutomationCommand::FailInterceptedRequest(command) => {(&command.context, command.request_id.as_str())}- DevToolsCommand::FulfillInterceptedRequest(command) => {+ AutomationCommand::FulfillInterceptedRequest(command) => {(&command.context, command.request_id.as_str())}_ => return Ok(CommandOwnerScope::capture(conn, None)),};- if context.protocol == DevToolsProtocol::Cdp {+ if context.protocol == FrontendProtocol::Cdp {return Ok(CommandOwnerScope::capture(conn,context.session_id.as_ref().map(|session| session.as_str()),@@ -523,11 +523,11 @@ fn fetch_devtools_command_owner(.unwrap_or_else(|| CommandOwnerScope::capture(conn, None)))}-fn fetch_config_devtools_command_owner(+fn fetch_config_automation_command_owner(conn: &CdpConnection,- context: &crate::devtools_runtime::DevToolsCommandContext,+ context: &crate::automation::AutomationContext,) -> Result<CommandOwnerScope, DevToolsError> {- if context.protocol == DevToolsProtocol::Cdp {+ if context.protocol == FrontendProtocol::Cdp {return Ok(CommandOwnerScope::capture(conn,context.session_id.as_ref().map(|session| session.as_str()),@@ -593,7 +593,7 @@ fn start_devtools_add_network_intercept_command() -> FetchCommandTaskStep {let (handle_auth_requests, auth_url_patterns, patterns) =network_intercept_fetch_config(command);- let intercept_session_id = if command.context.protocol == DevToolsProtocol::Cdp {+ let intercept_session_id = if command.context.protocol == FrontendProtocol::Cdp {owner.session_id().map(str::to_owned)} else {command@@ -621,7 +621,7 @@ fn start_devtools_add_network_intercept_command())}Ok(None) => FetchCommandTaskStep::Complete(CommandOutputPlan::from_devtools_result(- DevToolsCommandResult::AddNetworkIntercept(DevToolsAddNetworkInterceptResult {+ AutomationResult::AddNetworkIntercept(DevToolsAddNetworkInterceptResult {intercept_id: command.intercept_id.clone(),}),)),@@ -758,7 +758,7 @@ async fn complete_pending_fetch_command_inner(out.extend_plan_as_command_response(complete_fetch_config_update_command(conn,completed,- DevToolsCommandResult::AddNetworkIntercept(DevToolsAddNetworkInterceptResult {+ AutomationResult::AddNetworkIntercept(DevToolsAddNetworkInterceptResult {intercept_id: result_intercept_id.into(),}),));@@ -767,7 +767,7 @@ async fn complete_pending_fetch_command_inner(out.extend_plan_as_command_response(complete_fetch_config_update_command(conn,completed,- DevToolsCommandResult::Empty,+ AutomationResult::Empty,));}PendingFetchCommandKind::Disable {@@ -866,13 +866,13 @@ fn complete_enable_command(conn: &mut CdpConnection,completed: CompletedFetchCommandDispatch,) -> CommandOutputPlan {- complete_fetch_config_update_command(conn, completed, DevToolsCommandResult::Empty)+ complete_fetch_config_update_command(conn, completed, AutomationResult::Empty)}fn complete_fetch_config_update_command(conn: &mut CdpConnection,completed: CompletedFetchCommandDispatch,- result: DevToolsCommandResult,+ result: AutomationResult,) -> CommandOutputPlan {let owner_scope = completed.owner_scope.clone();let Some(completed_page_command) = completed.completed.into_page_completion() else {diff --git a/moli-protocol/src/domains/fetch/auth.rs b/moli-protocol/src/domains/fetch/auth.rsindex 634f11bfb..166c960bd 100644--- a/moli-protocol/src/domains/fetch/auth.rs+++ b/moli-protocol/src/domains/fetch/auth.rs@@ -1,11 +1,11 @@+use crate::automation::{+ AutomationCommand, DevToolsAuthChallengeAction, DevToolsContinueWithAuthCommand,+ DevToolsRequestId, FrontendProtocol,+};use crate::conn::{BackgroundProtocolEvent, CdpConnection, Cmd, CommandOwnerScope, PendingFetchAuthNavigation,PendingFetchNavigation, PendingSubresourceFetchAuthRequest, PendingSubresourceFetchRequest,};-use crate::devtools_runtime::{- DevToolsAuthChallengeAction, DevToolsCommand, DevToolsContinueWithAuthCommand,- DevToolsProtocol, DevToolsRequestId,-};use crate::domains::command_output::CommandOutputPlan;use crate::domains::{activity, network};use moli_core::page::{CompletedPageCommand, SubresourceAuthCredentials};@@ -71,7 +71,7 @@ pub(super) fn start_continue_with_auth_command(conn,cmd.id,cmd.session_id,- DevToolsCommand::ContinueWithAuth(command),+ AutomationCommand::ContinueWithAuth(command),)}@@ -83,7 +83,7 @@ fn build_cdp_continue_with_auth_command(let (browser_context_id, target_id) =super::commands::devtools_fetch_owner_identity_for_session(conn, cmd.session_id);DevToolsContinueWithAuthCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),request_id: DevToolsRequestId::from(params.request_id.as_ref().to_owned()),action: devtools_auth_action_from_cdp(params.auth_challenge_response.response),username: params.auth_challenge_response.username,@@ -119,7 +119,7 @@ pub(super) fn start_devtools_continue_with_auth_command(conn,owner,command.request_id.as_str(),- command.context.protocol == DevToolsProtocol::Cdp,+ command.context.protocol == FrontendProtocol::Cdp,))}diff --git a/moli-protocol/src/domains/fetch/commands.rs b/moli-protocol/src/domains/fetch/commands.rsindex 7d1c91744..dde881a82 100644--- a/moli-protocol/src/domains/fetch/commands.rs+++ b/moli-protocol/src/domains/fetch/commands.rs@@ -1,14 +1,14 @@+use crate::automation::{+ AutomationCommand, DevToolsAuthChallengeAction, DevToolsContinueInterceptedRequestCommand,+ DevToolsContinueInterceptedResponseCommand, DevToolsContinueWithAuthCommand,+ DevToolsFailInterceptedRequestCommand, DevToolsFulfillInterceptedRequestCommand,+ DevToolsRequestFailure, DevToolsRequestId, FrontendProtocol,+};use crate::conn::{BackgroundNavigationBodyCompletionSink, BackgroundNavigationClaimError, CapturedBody,CdpConnection, Cmd, CommandOwnerScope, DEFAULT_LOADER_ID,PendingStreamingDocumentResponseNavigation, monotonic_timestamp_seconds,};-use crate::devtools_runtime::{- DevToolsAuthChallengeAction, DevToolsCommand, DevToolsContinueInterceptedRequestCommand,- DevToolsContinueInterceptedResponseCommand, DevToolsContinueWithAuthCommand,- DevToolsFailInterceptedRequestCommand, DevToolsFulfillInterceptedRequestCommand,- DevToolsProtocol, DevToolsRequestFailure, DevToolsRequestId,-};use crate::domains::command_output::CommandOutputPlan;use crate::domains::{activity, network, page};use moli_core::page::{@@ -55,7 +55,7 @@ pub(super) fn start_devtools_fetch_command(conn: &mut CdpConnection,command_id: Option<u64>,command_session_id: Option<&str>,- command: DevToolsCommand,+ command: AutomationCommand,) -> FetchCommandTaskStep {let owner = CommandOwnerScope::capture(conn, command_session_id);start_devtools_fetch_command_for_owner(conn, command_id, &owner, command)@@ -65,24 +65,24 @@ pub(super) fn start_devtools_fetch_command_for_owner(conn: &mut CdpConnection,command_id: Option<u64>,owner: &CommandOwnerScope,- command: DevToolsCommand,+ command: AutomationCommand,) -> FetchCommandTaskStep {match command {- DevToolsCommand::ContinueInterceptedRequest(command) => {+ AutomationCommand::ContinueInterceptedRequest(command) => {start_devtools_continue_intercepted_request_command(conn, command_id, owner, &command)}- DevToolsCommand::ContinueInterceptedResponse(command) => {+ AutomationCommand::ContinueInterceptedResponse(command) => {start_devtools_continue_intercepted_response_command(conn, command_id, owner, &command)}- DevToolsCommand::ContinueWithAuth(command) => {+ AutomationCommand::ContinueWithAuth(command) => {super::auth::start_devtools_continue_with_auth_command(conn, command_id, owner, &command,)}- DevToolsCommand::FailInterceptedRequest(command) => {+ AutomationCommand::FailInterceptedRequest(command) => {start_devtools_fail_intercepted_request_command(conn, command_id, owner, command)}- DevToolsCommand::FulfillInterceptedRequest(command) => {+ AutomationCommand::FulfillInterceptedRequest(command) => {start_devtools_fulfill_intercepted_request_command(conn, command_id, owner, command)}_ => FetchCommandTaskStep::Complete(CommandOutputPlan::error(@@ -153,7 +153,7 @@ pub(super) fn start_continue_request_command(conn,cmd.id,cmd.session_id,- DevToolsCommand::ContinueInterceptedRequest(command),+ AutomationCommand::ContinueInterceptedRequest(command),)}@@ -189,7 +189,7 @@ fn build_cdp_continue_intercepted_request_command(let (browser_context_id, target_id) =devtools_fetch_owner_identity_for_session(conn, cmd.session_id);Ok(DevToolsContinueInterceptedRequestCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),request_id: DevToolsRequestId::from(params.request_id.as_ref().to_owned()),url: params.url,method: params.method,@@ -242,13 +242,13 @@ fn start_devtools_continue_intercepted_request_command(.headers.clone().map(|headers| match command.context.protocol {- DevToolsProtocol::Cdp => moli_fetch::RequestHeaderOverride::current_request(+ FrontendProtocol::Cdp => moli_fetch::RequestHeaderOverride::current_request(headers,pending.request_stage_pause_state().and_then(|chain| chain.header_override.as_ref()),),- DevToolsProtocol::WebDriverClassic | DevToolsProtocol::WebDriverBidi => {+ FrontendProtocol::WebDriverClassic | FrontendProtocol::WebDriverBidi => {moli_fetch::RequestHeaderOverride::RedirectChain(headers)}});@@ -381,7 +381,7 @@ fn start_devtools_continue_intercepted_request_command(pending.navigation.set_request_body_text(body);}if let Some(headers) = command.headers.clone() {- if command.context.protocol == DevToolsProtocol::Cdp {+ if command.context.protocol == FrontendProtocol::Cdp {pending.navigation.redirect_headers@@ -415,7 +415,7 @@ fn start_devtools_continue_intercepted_request_command(conn,owner,&request_id,- command.context.protocol == DevToolsProtocol::Cdp,+ command.context.protocol == FrontendProtocol::Cdp,).map_or_else(FetchCommandTaskStep::Complete, |()| {FetchCommandTaskStep::Complete(CommandOutputPlan::success())@@ -496,7 +496,7 @@ pub(super) fn start_fail_request_command(conn,cmd.id,cmd.session_id,- DevToolsCommand::FailInterceptedRequest(command),+ AutomationCommand::FailInterceptedRequest(command),)}@@ -509,7 +509,7 @@ fn build_cdp_fail_intercepted_request_command(let (browser_context_id, target_id) =devtools_fetch_owner_identity_for_session(conn, cmd.session_id);DevToolsFailInterceptedRequestCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),request_id: DevToolsRequestId::from(request_id),failure,}@@ -522,7 +522,7 @@ fn start_devtools_fail_intercepted_request_command(command: DevToolsFailInterceptedRequestCommand,) -> FetchCommandTaskStep {let command_session_id = owner.session_id();- let validate_request_id = command.context.protocol == DevToolsProtocol::Cdp;+ let validate_request_id = command.context.protocol == FrontendProtocol::Cdp;let request_id = command.request_id.into_string();let failure = command.failure;let error_text = failure.to_string();@@ -884,7 +884,7 @@ pub(super) fn start_fulfill_request_command(conn,cmd.id,cmd.session_id,- DevToolsCommand::FulfillInterceptedRequest(command),+ AutomationCommand::FulfillInterceptedRequest(command),)}@@ -900,7 +900,7 @@ fn build_cdp_fulfill_intercepted_request_command(let (browser_context_id, target_id) =devtools_fetch_owner_identity_for_session(conn, cmd.session_id);DevToolsFulfillInterceptedRequestCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),request_id: DevToolsRequestId::from(request_id),response_code,response_headers,@@ -916,7 +916,7 @@ fn start_devtools_fulfill_intercepted_request_command(command: DevToolsFulfillInterceptedRequestCommand,) -> FetchCommandTaskStep {let command_session_id = owner.session_id();- let validate_request_id = command.context.protocol == DevToolsProtocol::Cdp;+ let validate_request_id = command.context.protocol == FrontendProtocol::Cdp;let request_id = command.request_id.into_string();let response_code = command.response_code;let response_headers = command.response_headers;@@ -1493,7 +1493,7 @@ pub(super) fn start_continue_response_command(conn,cmd.id,cmd.session_id,- DevToolsCommand::ContinueInterceptedResponse(command),+ AutomationCommand::ContinueInterceptedResponse(command),)}@@ -1508,7 +1508,7 @@ fn build_cdp_continue_intercepted_response_command(let (browser_context_id, target_id) =devtools_fetch_owner_identity_for_session(conn, cmd.session_id);DevToolsContinueInterceptedResponseCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),request_id: DevToolsRequestId::from(request_id),response_code,response_headers,@@ -1723,7 +1723,7 @@ fn start_devtools_continue_intercepted_response_command(conn,owner,&request_id,- command.context.protocol == DevToolsProtocol::Cdp,+ command.context.protocol == FrontendProtocol::Cdp,).map_or_else(FetchCommandTaskStep::Complete, |()| {FetchCommandTaskStep::Complete(CommandOutputPlan::success())@@ -1909,7 +1909,7 @@ fn continue_streaming_document_response_in_background(#[cfg(test)]mod protocol_neutral_tests {- use crate::devtools_runtime::DevToolsRequestFailure;+ use crate::automation::DevToolsRequestFailure;#[test]fn cdp_abort_reason_is_preserved_as_a_typed_cause() {@@ -1926,7 +1926,7 @@ mod protocol_neutral_tests {);}- use crate::devtools_runtime::{AutomationEvent, DevToolsCommand, DevToolsProtocol};+ use crate::automation::{AutomationCommand, AutomationEvent, FrontendProtocol};use moli_core::page::SubresourceResourceType;use serde_json::{Value, json};use url::Url;@@ -1973,7 +1973,7 @@ mod protocol_neutral_tests {let parsed_url =parsed_continue_request_url(&command).expect("continueRequest URL should parse");- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-0")@@ -2016,7 +2016,7 @@ mod protocol_neutral_tests {Some("No Content".to_owned()),);- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-1")@@ -2054,7 +2054,7 @@ mod protocol_neutral_tests {&mut conn,cmd.id,cmd.session_id,- DevToolsCommand::ContinueInterceptedRequest(command),+ AutomationCommand::ContinueInterceptedRequest(command),);let super::super::FetchCommandTaskStep::Complete(plan) = step else {@@ -2145,7 +2145,7 @@ mod protocol_neutral_tests {&mut conn,cmd.id,cmd.session_id,- DevToolsCommand::ContinueInterceptedRequest(command),+ AutomationCommand::ContinueInterceptedRequest(command),);let super::super::FetchCommandTaskStep::Complete(plan) = step else {@@ -2160,7 +2160,7 @@ mod protocol_neutral_tests {assert_eq!(paused_sidecar.request_id.as_str(), "FETCH-aux");assert_eq!(paused_sidecar.blocked_intercepts,- Vec::<crate::devtools_runtime::DevToolsNetworkInterceptId>::new()+ Vec::<crate::automation::DevToolsNetworkInterceptId>::new());assert_eq!(paused_sidecar.network_id.as_ref().map(|id| id.as_str()),@@ -2297,7 +2297,7 @@ mod protocol_neutral_tests {&mut conn,cmd.id,cmd.session_id,- DevToolsCommand::ContinueInterceptedResponse(command),+ AutomationCommand::ContinueInterceptedResponse(command),);let super::super::FetchCommandTaskStep::Complete(plan) = step else {@@ -2426,7 +2426,7 @@ mod protocol_neutral_tests {&mut conn,cmd.id,cmd.session_id,- DevToolsCommand::ContinueInterceptedRequest(command),+ AutomationCommand::ContinueInterceptedRequest(command),);let super::super::FetchCommandTaskStep::Complete(plan) = step else {@@ -2490,7 +2490,7 @@ mod protocol_neutral_tests {DevToolsRequestFailure::Failed("net::ERR_BLOCKED_BY_CLIENT".to_owned()),);- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-2")@@ -2526,7 +2526,7 @@ mod protocol_neutral_tests {Some("No Content".to_owned()),);- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-3")diff --git a/moli-protocol/src/domains/fetch/helpers.rs b/moli-protocol/src/domains/fetch/helpers.rsindex 9fe86045b..58d6bbe25 100644--- a/moli-protocol/src/domains/fetch/helpers.rs+++ b/moli-protocol/src/domains/fetch/helpers.rs@@ -1,14 +1,14 @@+use crate::automation::{+ AutomationEvent, DevToolsFrameId, DevToolsLoaderId, DevToolsNetworkInterceptId,+ DevToolsNetworkResourceType, DevToolsRequestId, DevToolsTargetId, NetworkAuthChallengeEvent,+ NetworkRequestEvent,+};use crate::conn::{BackgroundProtocolEvent, CdpConnection, build_event};use crate::conn::{FetchAuthChallenge, NavigationDispatchState, PendingFetchAuthNavigation,PendingFetchNavigation, PendingSubresourceFetchAuthRequest,PendingSubresourceFetchResponseRequest,};-use crate::devtools_runtime::{- AutomationEvent, DevToolsFrameId, DevToolsLoaderId, DevToolsNetworkInterceptId,- DevToolsNetworkResourceType, DevToolsRequestId, DevToolsTargetId, NetworkAuthChallengeEvent,- NetworkRequestEvent,-};use crate::domains::network;use base64::{Engine as _, engine::general_purpose::STANDARD as BASE64_STANDARD};use http::header::{HeaderName, HeaderValue};diff --git a/moli-protocol/src/domains/fetch/navigation.rs b/moli-protocol/src/domains/fetch/navigation.rsindex a6ec8df84..d1ab7c312 100644--- a/moli-protocol/src/domains/fetch/navigation.rs+++ b/moli-protocol/src/domains/fetch/navigation.rs@@ -1,10 +1,10 @@+use crate::automation::{DevToolsNetworkInterceptId, DevToolsNetworkResourceType};use crate::conn::{CdpConnection, CommandOwnerScope, DocumentBodySource, DocumentNavigationToken,FetchAuthChallenge, NavigationDispatchState, NavigationLoadOutcome, PendingFetchNavigation,PendingSubresourceFetchAuthStage, PendingSubresourceFetchAuthStageChain,PendingSubresourceFetchOwnerKind, PendingSubresourceFetchRequest, decode_data_url_response,};-use crate::devtools_runtime::{DevToolsNetworkInterceptId, DevToolsNetworkResourceType};use crate::domains::{command_output::CommandOutputBuffer, network, page};use moli_cookie_jar::StoredCookieQueryReport;use moli_core::page::{SubresourceAuthCredentials, SubresourceAuthScheme, SubresourceResourceType};diff --git a/moli-protocol/src/domains/fetch/state.rs b/moli-protocol/src/domains/fetch/state.rsindex e996f0ccf..2710305ca 100644--- a/moli-protocol/src/domains/fetch/state.rs+++ b/moli-protocol/src/domains/fetch/state.rs@@ -1,9 +1,9 @@+use crate::automation::{DevToolsSessionId, FrontendProtocol};use crate::conn::{CdpConnection, CommandOwnerScope, PendingFetchAuthNavigation, PendingFetchNavigation,PendingSubresourceFetchAuthRequest, PendingSubresourceFetchRequest,PendingSubresourceFetchResponseRequest,};-use crate::devtools_runtime::{DevToolsProtocol, DevToolsSessionId};use crate::domains::command_output::CommandOutputPlan;use super::patterns::validate_request_id;@@ -74,10 +74,10 @@ impl PreparedSubresourceCorrelation {pub(crate) fn action_session_id_for_devtools_context<'a>(command_session_id: Option<&'a str>,- protocol: DevToolsProtocol,+ protocol: FrontendProtocol,context_session_id: Option<&'a DevToolsSessionId>,) -> Option<&'a str> {- if protocol == DevToolsProtocol::Cdp {+ if protocol == FrontendProtocol::Cdp {command_session_id} else {context_session_id.map(|session_id| session_id.as_str())diff --git a/moli-protocol/src/domains/fetch/subresource.rs b/moli-protocol/src/domains/fetch/subresource.rsindex 319e76fb1..632ee9624 100644--- a/moli-protocol/src/domains/fetch/subresource.rs+++ b/moli-protocol/src/domains/fetch/subresource.rs@@ -2,16 +2,16 @@ use serde_json::{Value, json};use url::Url;use super::helpers::pending_subresource_response_stage_request_paused_event;+use crate::automation::{+ AutomationEvent, DevToolsFrameId, DevToolsNetworkInterceptId, DevToolsNetworkResourceType,+ DevToolsRequestId, DevToolsTargetId, NetworkRequestEvent,+};use crate::conn::{BackgroundProtocolEvent, CdpConnection, CommandOwnerScope, DEFAULT_LOADER_ID,FetchRequestStage, PendingSubresourceFetchOwnerKind, PendingSubresourceFetchRequest,PendingSubresourceFetchRequestStage, PendingSubresourceFetchRequestStageChain,PendingSubresourceFetchResponseRequest, build_event, monotonic_timestamp_seconds,};-use crate::devtools_runtime::{- AutomationEvent, DevToolsFrameId, DevToolsNetworkInterceptId, DevToolsNetworkResourceType,- DevToolsRequestId, DevToolsTargetId, NetworkRequestEvent,-};use crate::domains::network;use moli_core::runtime::DetachedParserScriptFetchContinuation;@@ -591,11 +591,11 @@ mod tests {use serde_json::json;use url::Url;+ use crate::automation::{AutomationEvent, DevToolsNetworkResourceType};use crate::conn::{BackgroundProtocolEvent, BrowserContext, CdpConnection, CommandOwnerScope, PageTargetHost,PendingSubresourceFetchOwnerKind, PendingSubresourceFetchRequest,};- use crate::devtools_runtime::{AutomationEvent, DevToolsNetworkResourceType};use crate::domains::network::{TargetSubresourceFetchPauseNetworkOutput, TargetSubresourceFetchPauseOutput,};diff --git a/moli-protocol/src/domains/fetch/tests/basics.rs b/moli-protocol/src/domains/fetch/tests/basics.rsindex 9a35061a9..2a0bf9be7 100644--- a/moli-protocol/src/domains/fetch/tests/basics.rs+++ b/moli-protocol/src/domains/fetch/tests/basics.rs@@ -1,11 +1,9 @@use super::*;+use crate::automation::{AutomationEvent, DevToolsNetworkInterceptId, DevToolsNetworkResourceType};use crate::conn::{CdpCommandTaskStep, FetchInterceptionPattern, PendingSubresourceFetchAuthRequest,PendingSubresourceFetchOwnerKind, PendingSubresourceFetchRequest,};-use crate::devtools_runtime::{- AutomationEvent, DevToolsNetworkInterceptId, DevToolsNetworkResourceType,-};use crate::domains::fetch::pending_subresource_auth_required_event;use moli_core::page::SubresourceResourceType;diff --git a/moli-protocol/src/domains/fetch/tests/header_bytes.rs b/moli-protocol/src/domains/fetch/tests/header_bytes.rsindex 181d305ef..7c21564c4 100644--- a/moli-protocol/src/domains/fetch/tests/header_bytes.rs+++ b/moli-protocol/src/domains/fetch/tests/header_bytes.rs@@ -389,9 +389,9 @@ async fn navigation_header_override_expires_on_redirect_before_auth_retry() {#[tokio::test(flavor = "multi_thread")]async fn bidi_extra_header_bytes_reach_fetch_xhr_worker_and_navigation() {- use crate::devtools_runtime::{- DevToolsCommand, DevToolsCommandContext, DevToolsCommandResult, DevToolsProtocol,- DevToolsSessionId, DevToolsSetExtraHeadersCommand, DevToolsTargetId,+ use crate::automation::{+ AutomationCommand, AutomationContext, AutomationResult, DevToolsSessionId,+ DevToolsSetExtraHeadersCommand, DevToolsTargetId, FrontendProtocol,};async fn echo_headers(headers: HeaderMap) -> String {["x-extra", "x-utf8"]@@ -429,10 +429,10 @@ async fn bidi_extra_header_bytes_reach_fetch_xhr_worker_and_navigation() {enable_runtime_async(&mut ctx, "SID-1", 70400).await;let outcome = ctx.conn- .execute_devtools_command(DevToolsCommand::SetExtraHeaders(+ .execute_automation_command(AutomationCommand::SetExtraHeaders(DevToolsSetExtraHeadersCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,@@ -448,7 +448,7 @@ async fn bidi_extra_header_bytes_reach_fetch_xhr_worker_and_navigation() {.await;assert!(matches!(outcome.into_complete_parts().0,- Ok(DevToolsCommandResult::Empty)+ Ok(AutomationResult::Empty)));for script in [FETCH, XHR, WORKER] {ctx.process_async(json!({"id": 70401, "sessionId": "SID-1", "method": "Runtime.evaluate", "params": {"expression": script.replace("/start", "/echo")}})).await;diff --git a/moli-protocol/src/domains/fetch/tests/navigation_auth.rs b/moli-protocol/src/domains/fetch/tests/navigation_auth.rsindex f7b82d20e..c87a06df2 100644--- a/moli-protocol/src/domains/fetch/tests/navigation_auth.rs+++ b/moli-protocol/src/domains/fetch/tests/navigation_auth.rs@@ -1,10 +1,10 @@use super::*;-use crate::devtools_runtime::{- AutomationEvent, DevToolsAddNetworkInterceptCommand, DevToolsAuthChallengeAction,- DevToolsAuthCredentials, DevToolsCommand, DevToolsCommandContext, DevToolsCommandResult,+use crate::automation::{+ AutomationCommand, AutomationContext, AutomationEvent, AutomationResult,+ DevToolsAddNetworkInterceptCommand, DevToolsAuthChallengeAction, DevToolsAuthCredentials,DevToolsContinueInterceptedResponseCommand, DevToolsContinueWithAuthCommand,DevToolsNetworkInterceptId, DevToolsNetworkInterceptPattern, DevToolsNetworkInterceptPhase,- DevToolsProtocol, DevToolsRequestId, DevToolsSessionId, DevToolsTargetId,+ DevToolsRequestId, DevToolsSessionId, DevToolsTargetId, FrontendProtocol,};#[tokio::test(flavor = "multi_thread")]@@ -251,10 +251,10 @@ async fn devtools_continue_response_credentials_retries_auth_navigation() {let outcome = ctx.conn- .execute_devtools_command(DevToolsCommand::ContinueInterceptedResponse(+ .execute_automation_command(AutomationCommand::ContinueInterceptedResponse(DevToolsContinueInterceptedResponseCommand {- context: crate::devtools_runtime::DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: crate::automation::AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: None,target_id: Some("TID-1".into()),browser_context_id: Some("BID-1".into()),@@ -273,7 +273,7 @@ async fn devtools_continue_response_credentials_retries_auth_navigation() {let (result, scheduler_events, events) = outcome.into_parts_with_protocol_events();assert_eq!(result.expect("continueResponse credentials should succeed"),- crate::devtools_runtime::DevToolsCommandResult::Empty+ crate::automation::AutomationResult::Empty);let event_parts = events.clone()@@ -891,10 +891,10 @@ async fn run_navigation_cdp_fetch_then_bidi_network_auth_required_terminal(add_intercept_renderer_output_predecessor,) = ctx.conn- .execute_devtools_command(DevToolsCommand::AddNetworkIntercept(+ .execute_automation_command(AutomationCommand::AddNetworkIntercept(DevToolsAddNetworkInterceptCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("BIDI-SID")),target_id: Some(DevToolsTargetId::from("TID-1")),browser_context_id: None,@@ -912,8 +912,8 @@ async fn run_navigation_cdp_fetch_then_bidi_network_auth_required_terminal(assert!(add_intercept_renderer_output_predecessor.is_none());assert_eq!(result.expect("BiDi navigation auth intercept should succeed"),- DevToolsCommandResult::AddNetworkIntercept(- crate::devtools_runtime::DevToolsAddNetworkInterceptResult {+ AutomationResult::AddNetworkIntercept(+ crate::automation::DevToolsAddNetworkInterceptResult {intercept_id: DevToolsNetworkInterceptId::from("intercept-auth")})@@ -1030,10 +1030,10 @@ async fn run_navigation_cdp_fetch_then_bidi_network_auth_required_terminal() = match terminal_command {NavigationMixedAuthTerminalCommand::ContinueWithAuth => ctx.conn- .execute_devtools_command(DevToolsCommand::ContinueWithAuth(+ .execute_automation_command(AutomationCommand::ContinueWithAuth(DevToolsContinueWithAuthCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("BIDI-SID")),target_id: Some(DevToolsTargetId::from("TID-1")),browser_context_id: None,@@ -1048,10 +1048,10 @@ async fn run_navigation_cdp_fetch_then_bidi_network_auth_required_terminal(.into_complete_parts(),NavigationMixedAuthTerminalCommand::ContinueResponseAuthCredentials => ctx.conn- .execute_devtools_command(DevToolsCommand::ContinueInterceptedResponse(+ .execute_automation_command(AutomationCommand::ContinueInterceptedResponse(DevToolsContinueInterceptedResponseCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("BIDI-SID")),target_id: Some(DevToolsTargetId::from("TID-1")),browser_context_id: None,@@ -1070,10 +1070,10 @@ async fn run_navigation_cdp_fetch_then_bidi_network_auth_required_terminal(.into_complete_parts(),NavigationMixedAuthTerminalCommand::ContinueWithAuthCancel => ctx.conn- .execute_devtools_command(DevToolsCommand::ContinueWithAuth(+ .execute_automation_command(AutomationCommand::ContinueWithAuth(DevToolsContinueWithAuthCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("BIDI-SID")),target_id: Some(DevToolsTargetId::from("TID-1")),browser_context_id: None,@@ -1090,7 +1090,7 @@ async fn run_navigation_cdp_fetch_then_bidi_network_auth_required_terminal(assert!(continue_renderer_output_predecessor.is_none());assert_eq!(continue_result.expect("BiDi navigation auth terminal action should succeed"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);ctx.route_direct_command_output_for_test(continue_protocol_events, continue_scheduler_events).await;diff --git a/moli-protocol/src/domains/fetch/tests/runtime_auth_response.rs b/moli-protocol/src/domains/fetch/tests/runtime_auth_response.rsindex 22e2d4a4e..d8e92119f 100644--- a/moli-protocol/src/domains/fetch/tests/runtime_auth_response.rs+++ b/moli-protocol/src/domains/fetch/tests/runtime_auth_response.rs@@ -1,10 +1,10 @@use super::*;-use crate::devtools_runtime::{- DevToolsAddNetworkInterceptCommand, DevToolsAuthChallengeAction, DevToolsAuthCredentials,- DevToolsCommand, DevToolsCommandContext, DevToolsCommandResult,+use crate::automation::{+ AutomationCommand, AutomationContext, AutomationResult, DevToolsAddNetworkInterceptCommand,+ DevToolsAuthChallengeAction, DevToolsAuthCredentials,DevToolsContinueInterceptedResponseCommand, DevToolsContinueWithAuthCommand,DevToolsNetworkInterceptId, DevToolsNetworkInterceptPattern, DevToolsNetworkInterceptPhase,- DevToolsProtocol, DevToolsRequestId, DevToolsSessionId, DevToolsTargetId,+ DevToolsRequestId, DevToolsSessionId, DevToolsTargetId, FrontendProtocol,};use crate::testing::drain_scheduler_events_like_scheduler;@@ -1799,10 +1799,10 @@ async fn run_cdp_fetch_then_bidi_network_auth_required_terminal_credentials_compctx.expect_result(35_980, json!({}), Some("SID-1"));let result = ctx- .execute_devtools_command_through_renderer_fence_for_test(- DevToolsCommand::AddNetworkIntercept(DevToolsAddNetworkInterceptCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::AddNetworkIntercept(DevToolsAddNetworkInterceptCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("BIDI-SID")),target_id: Some(DevToolsTargetId::from("TID-1")),browser_context_id: None,@@ -1817,8 +1817,8 @@ async fn run_cdp_fetch_then_bidi_network_auth_required_terminal_credentials_comp.await;assert_eq!(result.expect("BiDi add auth intercept should succeed"),- DevToolsCommandResult::AddNetworkIntercept(- crate::devtools_runtime::DevToolsAddNetworkInterceptResult {+ AutomationResult::AddNetworkIntercept(+ crate::automation::DevToolsAddNetworkInterceptResult {intercept_id: DevToolsNetworkInterceptId::from("intercept-auth")})@@ -1965,10 +1965,10 @@ async fn run_cdp_fetch_then_bidi_network_auth_required_terminal_credentials_comp) = match terminal_command {MixedAuthTerminalCredentialsCommand::ContinueWithAuth => ctx.conn- .execute_devtools_command(DevToolsCommand::ContinueWithAuth(+ .execute_automation_command(AutomationCommand::ContinueWithAuth(DevToolsContinueWithAuthCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("BIDI-SID")),target_id: Some(DevToolsTargetId::from("TID-1")),browser_context_id: None,@@ -1983,10 +1983,10 @@ async fn run_cdp_fetch_then_bidi_network_auth_required_terminal_credentials_comp.into_complete_parts(),MixedAuthTerminalCredentialsCommand::ContinueResponseAuthCredentials => ctx.conn- .execute_devtools_command(DevToolsCommand::ContinueInterceptedResponse(+ .execute_automation_command(AutomationCommand::ContinueInterceptedResponse(DevToolsContinueInterceptedResponseCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("BIDI-SID")),target_id: Some(DevToolsTargetId::from("TID-1")),browser_context_id: None,@@ -2005,10 +2005,10 @@ async fn run_cdp_fetch_then_bidi_network_auth_required_terminal_credentials_comp.into_complete_parts(),MixedAuthTerminalCredentialsCommand::ContinueWithAuthCancel => ctx.conn- .execute_devtools_command(DevToolsCommand::ContinueWithAuth(+ .execute_automation_command(AutomationCommand::ContinueWithAuth(DevToolsContinueWithAuthCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("BIDI-SID")),target_id: Some(DevToolsTargetId::from("TID-1")),browser_context_id: None,@@ -2028,7 +2028,7 @@ async fn run_cdp_fetch_then_bidi_network_auth_required_terminal_credentials_comp}assert_eq!(continue_result.expect("BiDi auth terminal action should succeed"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);let mut continue_output = continue_protocol_events.into_iter()diff --git a/moli-protocol/src/domains/fetch/tests/runtime_fetch.rs b/moli-protocol/src/domains/fetch/tests/runtime_fetch.rsindex 33f506cbf..379b95d63 100644--- a/moli-protocol/src/domains/fetch/tests/runtime_fetch.rs+++ b/moli-protocol/src/domains/fetch/tests/runtime_fetch.rs@@ -1,11 +1,10 @@use super::*;-use crate::devtools_runtime::{- DevToolsAddNetworkInterceptCommand, DevToolsCommand, DevToolsCommandContext,- DevToolsCommandResult, DevToolsContinueInterceptedRequestCommand,- DevToolsContinueInterceptedResponseCommand, DevToolsEvaluateScriptCommand,- DevToolsNetworkInterceptId, DevToolsNetworkInterceptPattern, DevToolsNetworkInterceptPhase,- DevToolsNetworkResourceType, DevToolsProtocol, DevToolsRequestId, DevToolsResultOwnership,- DevToolsSessionId, DevToolsTargetId,+use crate::automation::{+ AutomationCommand, AutomationContext, AutomationResult, DevToolsAddNetworkInterceptCommand,+ DevToolsContinueInterceptedRequestCommand, DevToolsContinueInterceptedResponseCommand,+ DevToolsEvaluateScriptCommand, DevToolsNetworkInterceptId, DevToolsNetworkInterceptPattern,+ DevToolsNetworkInterceptPhase, DevToolsNetworkResourceType, DevToolsRequestId,+ DevToolsResultOwnership, DevToolsSessionId, DevToolsTargetId, FrontendProtocol,};use crate::testing::{drain_scheduler_events_like_scheduler,diff --git a/moli-protocol/src/domains/fetch/tests/runtime_fetch/runtime_subresources.rs b/moli-protocol/src/domains/fetch/tests/runtime_fetch/runtime_subresources.rsindex 2673840c1..038dc5e56 100644--- a/moli-protocol/src/domains/fetch/tests/runtime_fetch/runtime_subresources.rs+++ b/moli-protocol/src/domains/fetch/tests/runtime_fetch/runtime_subresources.rs@@ -1199,10 +1199,10 @@ async fn bidi_add_network_intercept_pauses_matching_fetch_subresources() {ctx.sent.clear();let result = ctx- .execute_devtools_command_through_renderer_fence_for_test(- DevToolsCommand::AddNetworkIntercept(DevToolsAddNetworkInterceptCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::AddNetworkIntercept(DevToolsAddNetworkInterceptCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("BIDI-SID")),target_id: Some(DevToolsTargetId::from("TID-1")),browser_context_id: None,@@ -1217,8 +1217,8 @@ async fn bidi_add_network_intercept_pauses_matching_fetch_subresources() {.await;assert_eq!(result.expect("BiDi add intercept should succeed"),- DevToolsCommandResult::AddNetworkIntercept(- crate::devtools_runtime::DevToolsAddNetworkInterceptResult {+ AutomationResult::AddNetworkIntercept(+ crate::automation::DevToolsAddNetworkInterceptResult {intercept_id: DevToolsNetworkInterceptId::from("intercept-hit")})@@ -1227,10 +1227,10 @@ async fn bidi_add_network_intercept_pauses_matching_fetch_subresources() {let (evaluate_result, scheduler_events, protocol_events, renderer_output_predecessor) = ctx.conn- .execute_devtools_command(DevToolsCommand::EvaluateScript(+ .execute_automation_command(AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("BIDI-SID")),target_id: Some(DevToolsTargetId::from("TID-1")),browser_context_id: None,@@ -1347,10 +1347,10 @@ async fn cdp_fetch_then_bidi_network_intercept_request_stage_chain_completes() {ctx.expect_result(41_010, json!({}), Some("SID-1"));let result = ctx- .execute_devtools_command_through_renderer_fence_for_test(- DevToolsCommand::AddNetworkIntercept(DevToolsAddNetworkInterceptCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::AddNetworkIntercept(DevToolsAddNetworkInterceptCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("BIDI-SID")),target_id: Some(DevToolsTargetId::from("TID-1")),browser_context_id: None,@@ -1442,10 +1442,10 @@ async fn cdp_fetch_then_bidi_network_intercept_request_stage_chain_completes() {continue_renderer_output_predecessor,) = ctx.conn- .execute_devtools_command(DevToolsCommand::ContinueInterceptedRequest(+ .execute_automation_command(AutomationCommand::ContinueInterceptedRequest(DevToolsContinueInterceptedRequestCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("BIDI-SID")),target_id: Some(DevToolsTargetId::from("TID-1")),browser_context_id: None,@@ -1466,7 +1466,7 @@ async fn cdp_fetch_then_bidi_network_intercept_request_stage_chain_completes() {}assert_eq!(continue_result.expect("BiDi continue request should succeed"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);let mut continue_output = Vec::new();drain_scheduler_events_like_scheduler(@@ -1540,10 +1540,10 @@ async fn cdp_fetch_then_bidi_network_intercept_response_stage_chain_completes()ctx.expect_result(41_110, json!({}), Some("SID-1"));let result = ctx- .execute_devtools_command_through_renderer_fence_for_test(- DevToolsCommand::AddNetworkIntercept(DevToolsAddNetworkInterceptCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::AddNetworkIntercept(DevToolsAddNetworkInterceptCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("BIDI-SID")),target_id: Some(DevToolsTargetId::from("TID-1")),browser_context_id: None,@@ -1711,10 +1711,10 @@ async fn cdp_fetch_then_bidi_network_intercept_response_stage_chain_completes()continue_renderer_output_predecessor,) = ctx.conn- .execute_devtools_command(DevToolsCommand::ContinueInterceptedResponse(+ .execute_automation_command(AutomationCommand::ContinueInterceptedResponse(DevToolsContinueInterceptedResponseCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("BIDI-SID")),target_id: Some(DevToolsTargetId::from("TID-1")),browser_context_id: None,@@ -1734,7 +1734,7 @@ async fn cdp_fetch_then_bidi_network_intercept_response_stage_chain_completes()}assert_eq!(continue_result.expect("BiDi continue response should succeed"),- DevToolsCommandResult::Empty+ AutomationResult::Empty);let mut continue_output = Vec::new();drain_scheduler_events_like_scheduler(@@ -1800,10 +1800,10 @@ async fn bidi_response_stage_network_intercept_marks_fetch_continuation_request_ctx.sent.clear();let result = ctx- .execute_devtools_command_through_renderer_fence_for_test(- DevToolsCommand::AddNetworkIntercept(DevToolsAddNetworkInterceptCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::AddNetworkIntercept(DevToolsAddNetworkInterceptCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("BIDI-SID")),target_id: Some(DevToolsTargetId::from("TID-1")),browser_context_id: None,@@ -1818,8 +1818,8 @@ async fn bidi_response_stage_network_intercept_marks_fetch_continuation_request_.await;assert_eq!(result.expect("BiDi add response-stage intercept should succeed"),- DevToolsCommandResult::AddNetworkIntercept(- crate::devtools_runtime::DevToolsAddNetworkInterceptResult {+ AutomationResult::AddNetworkIntercept(+ crate::automation::DevToolsAddNetworkInterceptResult {intercept_id: DevToolsNetworkInterceptId::from("intercept-hit")})@@ -1828,10 +1828,10 @@ async fn bidi_response_stage_network_intercept_marks_fetch_continuation_request_let (evaluate_result, scheduler_events, protocol_events, renderer_output_predecessor) = ctx.conn- .execute_devtools_command(DevToolsCommand::EvaluateScript(+ .execute_automation_command(AutomationCommand::EvaluateScript(DevToolsEvaluateScriptCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("BIDI-SID")),target_id: Some(DevToolsTargetId::from("TID-1")),browser_context_id: None,diff --git a/moli-protocol/src/domains/fetch/tests/runtime_fetch/session_interception.rs b/moli-protocol/src/domains/fetch/tests/runtime_fetch/session_interception.rsindex 41740e0fb..af605901b 100644--- a/moli-protocol/src/domains/fetch/tests/runtime_fetch/session_interception.rs+++ b/moli-protocol/src/domains/fetch/tests/runtime_fetch/session_interception.rs@@ -1061,10 +1061,10 @@ async fn response_body_stream_taken_blocks_chained_bidi_response_stage_pause() {ctx.expect_result(35_958, json!({}), Some("SID-1"));let result = ctx- .execute_devtools_command_through_renderer_fence_for_test(- DevToolsCommand::AddNetworkIntercept(DevToolsAddNetworkInterceptCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ .execute_automation_command_through_renderer_fence_for_test(+ AutomationCommand::AddNetworkIntercept(DevToolsAddNetworkInterceptCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("BIDI-SID")),target_id: Some(DevToolsTargetId::from("TID-1")),browser_context_id: None,diff --git a/moli-protocol/src/domains/input.rs b/moli-protocol/src/domains/input.rsindex 1c7857f5e..2c6db91a8 100644--- a/moli-protocol/src/domains/input.rs+++ b/moli-protocol/src/domains/input.rs@@ -1,15 +1,15 @@+use crate::automation::{+ AutomationCommand, AutomationContext, AutomationResult, DevToolsDispatchDragEventCommand,+ DevToolsDispatchKeyEventCommand, DevToolsDispatchMouseEventCommand,+ DevToolsDispatchTouchEventCommand, DevToolsDragData, DevToolsDragDataItem,+ DevToolsDragEventType, DevToolsElementClickOperation, DevToolsError, DevToolsErrorKind,+ DevToolsKeyEventType, DevToolsMouseEventType, DevToolsPointerType,+ DevToolsSynthesizeTapGestureCommand, DevToolsTouchEventType, DevToolsTouchPoint,+};use crate::conn::{BackgroundProtocolEvent, CdpConnection, Cmd, CommandDispatchContext, CommandOwnerScope,TargetPageResidenceIdentity, TargetPageResidenceObservation, TargetPageResidenceToken,};-use crate::devtools_runtime::{- DevToolsCommand, DevToolsCommandContext, DevToolsCommandResult,- DevToolsDispatchDragEventCommand, DevToolsDispatchKeyEventCommand,- DevToolsDispatchMouseEventCommand, DevToolsDispatchTouchEventCommand, DevToolsDragData,- DevToolsDragDataItem, DevToolsDragEventType, DevToolsElementClickOperation, DevToolsError,- DevToolsErrorKind, DevToolsKeyEventType, DevToolsMouseEventType, DevToolsPointerType,- DevToolsSynthesizeTapGestureCommand, DevToolsTouchEventType, DevToolsTouchPoint,-};use crate::domains::command_output::CommandOutputPlan;use moli_core::page::{CompletedPageCommand, Page, PageInputExt, PendingPageCommand, RendererCommandTurnCompletion,@@ -85,7 +85,7 @@ pub(crate) enum InputCommandDispatchStep {}struct CompletedInputCommandResult {- result: Result<DevToolsCommandResult, DevToolsError>,+ result: Result<AutomationResult, DevToolsError>,protocol_events: Vec<BackgroundProtocolEvent>,}@@ -621,7 +621,7 @@ fn start_pending_input_command(conn,cmd.id,&owner,- DevToolsCommand::DispatchKeyEvent(command),+ AutomationCommand::DispatchKeyEvent(command),)}InputAction::DispatchMouseEvent@@ -667,7 +667,7 @@ fn build_cdp_dispatch_key_event_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));DevToolsDispatchKeyEventCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),event_type: parsed.event_type,key: parsed.key,code: parsed.code,@@ -678,12 +678,12 @@ fn build_cdp_dispatch_key_event_command(}}-fn cdp_input_command_context(conn: &CdpConnection, cmd: &Cmd<'_>) -> DevToolsCommandContext {+fn cdp_input_command_context(conn: &CdpConnection, cmd: &Cmd<'_>) -> AutomationContext {let (browser_context_id, target_id) = conn.target_owner_identity_for_session(cmd.session_id).map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));- cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref())+ cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref())}fn cdp_modifiers(value: Option<i64>) -> Result<u8, PendingInputCommandStartError> {@@ -708,7 +708,7 @@ fn build_cdp_coordinate_input_command(conn: &CdpConnection,cmd: &Cmd<'_>,action: InputAction,-) -> Result<DevToolsCommand, PendingInputCommandStartError> {+) -> Result<AutomationCommand, PendingInputCommandStartError> {let context = cdp_input_command_context(conn, cmd);match action {InputAction::DispatchMouseEvent => {@@ -734,7 +734,7 @@ fn build_cdp_coordinate_input_command(y: params.y,}]};- return Ok(DevToolsCommand::DispatchTouchEvent(+ return Ok(AutomationCommand::DispatchTouchEvent(DevToolsDispatchTouchEventCommand {context,event_type,@@ -742,7 +742,7 @@ fn build_cdp_coordinate_input_command(},));}- Ok(DevToolsCommand::DispatchMouseEvent(+ Ok(AutomationCommand::DispatchMouseEvent(DevToolsDispatchMouseEventCommand {context,event_type: match params.r#type {@@ -791,7 +791,7 @@ fn build_cdp_coordinate_input_command(y: point.y,}).collect();- Ok(DevToolsCommand::DispatchTouchEvent(+ Ok(AutomationCommand::DispatchTouchEvent(DevToolsDispatchTouchEventCommand {context,event_type: match params.r#type {@@ -810,7 +810,7 @@ fn build_cdp_coordinate_input_command(.map_err(|_| PendingInputCommandStartError::invalid_params())?.ok_or_else(PendingInputCommandStartError::invalid_params)?;if params.r#type == CdpEmulateTouchFromMouseEventType::MouseWheel {- return Ok(DevToolsCommand::DispatchMouseEvent(+ return Ok(AutomationCommand::DispatchMouseEvent(DevToolsDispatchMouseEventCommand {context,event_type: DevToolsMouseEventType::Wheel,@@ -846,7 +846,7 @@ fn build_cdp_coordinate_input_command(y: params.y as f64,}]};- Ok(DevToolsCommand::DispatchTouchEvent(+ Ok(AutomationCommand::DispatchTouchEvent(DevToolsDispatchTouchEventCommand {context,event_type,@@ -859,7 +859,7 @@ fn build_cdp_coordinate_input_command(.get_params::<CdpSynthesizeTapGestureParams>().map_err(|_| PendingInputCommandStartError::invalid_params())?.ok_or_else(PendingInputCommandStartError::invalid_params)?;- Ok(DevToolsCommand::SynthesizeTapGesture(+ Ok(AutomationCommand::SynthesizeTapGesture(DevToolsSynthesizeTapGestureCommand {context,x: params.x,@@ -872,7 +872,7 @@ fn build_cdp_coordinate_input_command(.get_params::<CdpDispatchDragEventParams>().map_err(|_| PendingInputCommandStartError::invalid_params())?.ok_or_else(PendingInputCommandStartError::invalid_params)?;- Ok(DevToolsCommand::DispatchDragEvent(+ Ok(AutomationCommand::DispatchDragEvent(DevToolsDispatchDragEventCommand {context,event_type: match params.r#type {@@ -912,9 +912,9 @@ fn build_cdp_coordinate_input_command(pub(crate) async fn execute_devtools_input_command_async_with_protocol_events(conn: &mut CdpConnection,- command: DevToolsCommand,+ command: AutomationCommand,) -> (- Result<DevToolsCommandResult, DevToolsError>,+ Result<AutomationResult, DevToolsError>,Vec<crate::conn::BackgroundProtocolEvent>,) {let (target_id, command_session_id) = match devtools_input_command_route(&command) {@@ -941,15 +941,15 @@ pub(crate) async fn execute_devtools_input_command_async_with_protocol_events(}fn devtools_input_command_route(- command: &DevToolsCommand,+ command: &AutomationCommand,) -> Result<(Option<String>, Option<String>), DevToolsError> {let context = match command {- DevToolsCommand::ElementClick(command) => &command.context,- DevToolsCommand::DispatchMouseEvent(command) => &command.context,- DevToolsCommand::DispatchKeyEvent(command) => &command.context,- DevToolsCommand::DispatchTouchEvent(command) => &command.context,- DevToolsCommand::DispatchDragEvent(command) => &command.context,- DevToolsCommand::SynthesizeTapGesture(command) => &command.context,+ AutomationCommand::ElementClick(command) => &command.context,+ AutomationCommand::DispatchMouseEvent(command) => &command.context,+ AutomationCommand::DispatchKeyEvent(command) => &command.context,+ AutomationCommand::DispatchTouchEvent(command) => &command.context,+ AutomationCommand::DispatchDragEvent(command) => &command.context,+ AutomationCommand::SynthesizeTapGesture(command) => &command.context,_ => {return Err(DevToolsError::new(DevToolsErrorKind::Unsupported,@@ -972,14 +972,14 @@ fn devtools_input_command_route(async fn execute_devtools_input_command_for_owner_with_protocol_events(conn: &mut CdpConnection,owner: &CommandOwnerScope,- command: DevToolsCommand,+ command: AutomationCommand,) -> (- Result<DevToolsCommandResult, DevToolsError>,+ Result<AutomationResult, DevToolsError>,Vec<crate::conn::BackgroundProtocolEvent>,) {let pending = match start_devtools_input_command_for_owner(conn, None, owner, command) {Ok(Some(pending)) => pending,- Ok(None) => return (Ok(DevToolsCommandResult::Empty), Vec::new()),+ Ok(None) => return (Ok(AutomationResult::Empty), Vec::new()),Err(error) => {return (Err(devtools_error_from_input_start_error(error)),@@ -1281,17 +1281,19 @@ fn start_devtools_input_command_for_owner(conn: &mut CdpConnection,command_id: Option<u64>,owner: &CommandOwnerScope,- command: DevToolsCommand,+ command: AutomationCommand,) -> Result<Option<PendingInputCommandDispatch>, PendingInputCommandStartError> {let coordinate_unsupported = match &command {- DevToolsCommand::ElementClick(crate::devtools_runtime::DevToolsElementClickCommand {+ AutomationCommand::ElementClick(crate::automation::DevToolsElementClickCommand {operation: DevToolsElementClickOperation::Dispatch(_),..})- | DevToolsCommand::DispatchMouseEvent(_) => Some(DISPATCH_MOUSE_EVENT_UNSUPPORTED_MESSAGE),- DevToolsCommand::DispatchTouchEvent(_) => Some(DISPATCH_TOUCH_EVENT_UNSUPPORTED_MESSAGE),- DevToolsCommand::DispatchDragEvent(_) => Some(DISPATCH_DRAG_EVENT_UNSUPPORTED_MESSAGE),- DevToolsCommand::SynthesizeTapGesture(_) => {+ | AutomationCommand::DispatchMouseEvent(_) => {+ Some(DISPATCH_MOUSE_EVENT_UNSUPPORTED_MESSAGE)+ }+ AutomationCommand::DispatchTouchEvent(_) => Some(DISPATCH_TOUCH_EVENT_UNSUPPORTED_MESSAGE),+ AutomationCommand::DispatchDragEvent(_) => Some(DISPATCH_DRAG_EVENT_UNSUPPORTED_MESSAGE),+ AutomationCommand::SynthesizeTapGesture(_) => {Some(SYNTHESIZE_TAP_GESTURE_UNSUPPORTED_MESSAGE)}_ => None,@@ -1305,7 +1307,7 @@ fn start_devtools_input_command_for_owner(}}match command {- DevToolsCommand::ElementClick(command) => match command.operation {+ AutomationCommand::ElementClick(command) => match command.operation {DevToolsElementClickOperation::Prepare { object_id } => start_page_input_command(conn,command_id,@@ -1326,19 +1328,19 @@ fn start_devtools_input_command_for_owner(|page| page.start_dispatch_prepared_element_click(click),),},- DevToolsCommand::DispatchMouseEvent(command) => {+ AutomationCommand::DispatchMouseEvent(command) => {start_devtools_dispatch_mouse_event_command(conn, command_id, owner, command)}- DevToolsCommand::DispatchTouchEvent(command) => {+ AutomationCommand::DispatchTouchEvent(command) => {start_devtools_dispatch_touch_event_command(conn, command_id, owner, command)}- DevToolsCommand::DispatchDragEvent(command) => {+ AutomationCommand::DispatchDragEvent(command) => {start_devtools_dispatch_drag_event_command(conn, command_id, owner, command)}- DevToolsCommand::SynthesizeTapGesture(command) => {+ AutomationCommand::SynthesizeTapGesture(command) => {start_devtools_synthesize_tap_gesture_command(conn, command_id, owner, command)}- DevToolsCommand::DispatchKeyEvent(command) => {+ AutomationCommand::DispatchKeyEvent(command) => {start_devtools_dispatch_key_event_command(conn, command_id, owner, command)}_ => Err(PendingInputCommandStartError {@@ -1363,7 +1365,7 @@ async fn complete_pending_input_command(// retires an outstanding mouse/key ACK as protocol success even// when the old renderer never publishes its normal completion.return CompletedInputCommandResult {- result: Ok(DevToolsCommandResult::Empty),+ result: Ok(AutomationResult::Empty),protocol_events: Vec::new(),};}@@ -1389,7 +1391,7 @@ async fn complete_pending_input_command(settle_completed_input_page_command(conn, &owner, result, command_context);if matches!(kind, PendingInputCommandKind::PrepareElementClick) {decode_element_click_preparation_completion(completion)- .map(DevToolsCommandResult::ElementClickPreparation)+ .map(AutomationResult::ElementClickPreparation).map_err(|error| {DevToolsError::new(DevToolsErrorKind::Internal, error.to_string())})@@ -1400,7 +1402,7 @@ async fn complete_pending_input_command(error.to_string(),)),Ok(Err(error)) => {- Ok(DevToolsCommandResult::ElementClickDispatch(Err(error)))+ Ok(AutomationResult::ElementClickDispatch(Err(error)))}Ok(Ok(outcome)) => handle_input_dispatch_outcome_async(conn,@@ -1411,7 +1413,7 @@ async fn complete_pending_input_command(command_context,).await- .map(|()| DevToolsCommandResult::ElementClickDispatch(Ok(())))+ .map(|()| AutomationResult::ElementClickDispatch(Ok(()))).map_err(|error| {DevToolsError::new(DevToolsErrorKind::Internal, error)}),@@ -1467,7 +1469,7 @@ async fn complete_pending_input_command(protocol_events,};}- Ok(DevToolsCommandResult::Empty)+ Ok(AutomationResult::Empty)}Err(error) => Err(DevToolsError::new(DevToolsErrorKind::Internal,@@ -1508,7 +1510,7 @@ async fn complete_pending_input_command(protocol_events,};}- Ok(DevToolsCommandResult::Empty)+ Ok(AutomationResult::Empty)}Err(error) => Err(DevToolsError::new(DevToolsErrorKind::Internal,@@ -1531,7 +1533,7 @@ async fn complete_pending_input_command(settle_completed_input_page_command(conn, &owner, result, command_context);let result = decode_insert_text_completion(completion);match result {- Ok(_) => Ok(DevToolsCommandResult::Empty),+ Ok(_) => Ok(AutomationResult::Empty),Err(error) => Err(DevToolsError::new(DevToolsErrorKind::Internal,error.to_string(),@@ -1802,12 +1804,12 @@ pub(in crate::domains) async fn emit_file_chooser_activity_background_events_asy#[cfg(test)]mod protocol_neutral_tests {- use crate::devtools_runtime::{- DevToolsCommand, DevToolsCommandContext, DevToolsDispatchDragEventCommand,+ use crate::automation::{+ AutomationCommand, AutomationContext, DevToolsDispatchDragEventCommand,DevToolsDispatchMouseEventCommand, DevToolsDispatchTouchEventCommand, DevToolsDragData,DevToolsDragEventType, DevToolsErrorKind, DevToolsKeyEventType, DevToolsMouseEventType,- DevToolsPointerType, DevToolsProtocol, DevToolsSynthesizeTapGestureCommand,- DevToolsTouchEventType, DevToolsTouchPoint,+ DevToolsPointerType, DevToolsSynthesizeTapGestureCommand, DevToolsTouchEventType,+ DevToolsTouchPoint, FrontendProtocol,};use serde_json::Value;@@ -1832,16 +1834,16 @@ mod protocol_neutral_tests {conn: &mut CdpConnection,command_id: Option<u64>,session_id: Option<&str>,- command: DevToolsCommand,+ command: AutomationCommand,) -> Result<Option<super::PendingInputCommandDispatch>, super::PendingInputCommandStartError>{let owner = CommandOwnerScope::capture(conn, session_id);super::start_devtools_input_command_for_owner(conn, command_id, &owner, command)}- fn cdp_context(session_id: &str) -> DevToolsCommandContext {- DevToolsCommandContext {- protocol: DevToolsProtocol::Cdp,+ fn cdp_context(session_id: &str) -> AutomationContext {+ AutomationContext {+ protocol: FrontendProtocol::Cdp,session_id: Some(session_id.to_owned().into()),target_id: None,browser_context_id: None,@@ -1906,7 +1908,7 @@ mod protocol_neutral_tests {&mut conn,Some(42),Some("SID-mouse"),- DevToolsCommand::DispatchMouseEvent(coordinate_mouse_command("SID-mouse")),+ AutomationCommand::DispatchMouseEvent(coordinate_mouse_command("SID-mouse")),);assert_coordinate_routes_to_document_owner(result);@@ -1935,7 +1937,7 @@ mod protocol_neutral_tests {let command = super::build_cdp_dispatch_key_event_command(&conn, &cmd, parsed);- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-key")@@ -1977,7 +1979,7 @@ mod protocol_neutral_tests {&mut conn,cmd.id,cmd.session_id,- DevToolsCommand::DispatchKeyEvent(command),+ AutomationCommand::DispatchKeyEvent(command),);let Err(error) = result else {@@ -1994,7 +1996,7 @@ mod protocol_neutral_tests {&mut conn,Some(46),Some("SID-touch"),- DevToolsCommand::DispatchTouchEvent(coordinate_touch_command("SID-touch")),+ AutomationCommand::DispatchTouchEvent(coordinate_touch_command("SID-touch")),);assert_coordinate_routes_to_document_owner(result);@@ -2007,7 +2009,7 @@ mod protocol_neutral_tests {&mut conn,Some(48),Some("SID-drag"),- DevToolsCommand::DispatchDragEvent(coordinate_drag_command("SID-drag", 1)),+ AutomationCommand::DispatchDragEvent(coordinate_drag_command("SID-drag", 1)),);assert_coordinate_routes_to_document_owner(result);@@ -2020,7 +2022,7 @@ mod protocol_neutral_tests {&mut conn,Some(49),Some("SID-drag"),- DevToolsCommand::DispatchDragEvent(coordinate_drag_command("SID-drag", 0)),+ AutomationCommand::DispatchDragEvent(coordinate_drag_command("SID-drag", 0)),);assert_coordinate_routes_to_document_owner(result);@@ -2033,7 +2035,7 @@ mod protocol_neutral_tests {&mut conn,Some(51),Some("SID-tap"),- DevToolsCommand::SynthesizeTapGesture(DevToolsSynthesizeTapGestureCommand {+ AutomationCommand::SynthesizeTapGesture(DevToolsSynthesizeTapGestureCommand {context: cdp_context("SID-tap"),x: 1.0,y: 2.0,@@ -2054,14 +2056,14 @@ mod producer_tests {};use serde_json::json;+ use crate::automation::{+ AutomationEvent, BrowserDownloadProgressEvent, BrowserDownloadWillBeginEvent,+ DevToolsFrameId, webdriver_bidi_node_shared_id_for_backend_node_id,+ };use crate::conn::{BackgroundProtocolEvent, BrowserContext, CdpConnection, CommandDispatchContext,CommandOwnerScope, TargetPageResidenceIdentity, build_event,};- use crate::devtools_runtime::{- AutomationEvent, BrowserDownloadProgressEvent, BrowserDownloadWillBeginEvent,- DevToolsFrameId, webdriver_bidi_node_shared_id_for_backend_node_id,- };use crate::domains::activity::ProtocolOutputPayloads;fn renderer_document_identity_for_test(diff --git a/moli-protocol/src/domains/input/file_chooser.rs b/moli-protocol/src/domains/input/file_chooser.rsindex ca2715699..c6bd6e804 100644--- a/moli-protocol/src/domains/input/file_chooser.rs+++ b/moli-protocol/src/domains/input/file_chooser.rs@@ -3,12 +3,12 @@ use moli_core::page::{RendererPendingFileChooserActivation,};+use crate::automation::{+ DevToolsRemoteHandleId, webdriver_bidi_node_shared_id_for_backend_node_id,+};use crate::conn::{BackgroundProtocolEvent, CdpConnection, CommandOwnerScope, TargetPageResidenceIdentity,};-use crate::devtools_runtime::{- DevToolsRemoteHandleId, webdriver_bidi_node_shared_id_for_backend_node_id,-};/// A renderer file-chooser activation bound to the exact Page residence from/// which it was captured, with its causal Document and frame frozen as eventdiff --git a/moli-protocol/src/domains/input/key.rs b/moli-protocol/src/domains/input/key.rsindex 00552a38b..801e96715 100644--- a/moli-protocol/src/domains/input/key.rs+++ b/moli-protocol/src/domains/input/key.rs@@ -1,5 +1,5 @@use super::*;-use crate::devtools_runtime::DevToolsKeyEventType;+use crate::automation::DevToolsKeyEventType;use chromiumoxide_cdp::cdp::browser_protocol::input::{DispatchKeyEventParams as KeyEventParams, DispatchKeyEventType as KeyEventType,InsertTextParams,diff --git a/moli-protocol/src/domains/input/tests.rs b/moli-protocol/src/domains/input/tests.rsindex 79f6712bb..6568ba86d 100644--- a/moli-protocol/src/domains/input/tests.rs+++ b/moli-protocol/src/domains/input/tests.rs@@ -323,7 +323,7 @@ async fn completed_mouse_event_does_not_restore_replaced_page_state() {&mut CommandDispatchContext::default(),).await;- assert!(matches!(completed.result, Ok(DevToolsCommandResult::Empty)));+ assert!(matches!(completed.result, Ok(AutomationResult::Empty)));assert!(completed.protocol_events.is_empty());assert!(ctx.conn@@ -378,7 +378,7 @@ async fn pending_mouse_event_acknowledges_when_page_is_replaced_before_renderer_&mut CommandDispatchContext::default(),).await;- assert!(matches!(completed.result, Ok(DevToolsCommandResult::Empty)));+ assert!(matches!(completed.result, Ok(AutomationResult::Empty)));assert!(completed.protocol_events.is_empty());}diff --git a/moli-protocol/src/domains/input/tests/element_click.rs b/moli-protocol/src/domains/input/tests/element_click.rsindex b35be0795..8407e5214 100644--- a/moli-protocol/src/domains/input/tests/element_click.rs+++ b/moli-protocol/src/domains/input/tests/element_click.rs@@ -1,6 +1,6 @@use super::*;-use crate::devtools_runtime::{- DevToolsElementClickCommand, DevToolsElementClickOperation, DevToolsProtocol,+use crate::automation::{+ DevToolsElementClickCommand, DevToolsElementClickOperation, FrontendProtocol,};use moli_core::page::{RendererElementClickError, RendererElementClickTarget, RendererPreparedPointerClick,@@ -9,17 +9,19 @@ use moli_core::page::{async fn command(ctx: &mut TestContext,operation: DevToolsElementClickOperation,-) -> DevToolsCommandResult {+) -> AutomationResult {ctx.conn- .execute_devtools_command(DevToolsCommand::ElementClick(DevToolsElementClickCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,- session_id: None,- target_id: None,- browser_context_id: None,+ .execute_automation_command(AutomationCommand::ElementClick(+ DevToolsElementClickCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,+ session_id: None,+ target_id: None,+ browser_context_id: None,+ },+ operation,},- operation,- }))+ )).await.into_parts().0@@ -36,9 +38,9 @@ async fn prepare(ctx: &mut TestContext) -> RendererPreparedPointerClick {).await{- DevToolsCommandResult::ElementClickPreparation(Ok(- RendererElementClickTarget::Pointer(click),- )) => click,+ AutomationResult::ElementClickPreparation(Ok(RendererElementClickTarget::Pointer(+ click,+ ))) => click,result => panic!("expected prepared pointer click: {result:?}"),}}@@ -67,7 +69,7 @@ async fn native_element_click_rejects_stale_preparation_before_observable_input(let click = prepare(&mut ctx).await;assert!(evaluate_bool(&mut ctx, &format!("(()=>{{const target=document.getElementById('target');{mutation};return true}})()")).await);let result = command(&mut ctx, DevToolsElementClickOperation::Dispatch(click)).await;- let DevToolsCommandResult::ElementClickDispatch(result) = result else {+ let AutomationResult::ElementClickDispatch(result) = result else {panic!("unexpected dispatch result: {result:?}")};assert_eq!(@@ -100,7 +102,7 @@ async fn native_element_click_stops_after_document_replacement_in_pointer_handlelet click = prepare(&mut ctx).await;assert!(matches!(command(&mut ctx, DevToolsElementClickOperation::Dispatch(click)).await,- DevToolsCommandResult::ElementClickDispatch(Ok(()))+ AutomationResult::ElementClickDispatch(Ok(()))));assert_eq!(evaluate_string(&mut ctx, "JSON.stringify(successorEvents)").await,diff --git a/moli-protocol/src/domains/log.rs b/moli-protocol/src/domains/log.rsindex cc0192cbf..b1d8c48b0 100644--- a/moli-protocol/src/domains/log.rs+++ b/moli-protocol/src/domains/log.rs@@ -1,4 +1,4 @@-use crate::devtools_runtime::{DevToolsError, DevToolsErrorKind};+use crate::automation::{DevToolsError, DevToolsErrorKind};use crate::conn::{CdpConnection, Cmd, DevToolsLogViolationThreshold};use crate::domains::actions::LogAction;@@ -171,8 +171,8 @@ fn append_log_replay_snapshot(#[cfg(test)]mod tests {+ use crate::automation::AutomationEvent;use crate::conn::BrowserContext;- use crate::devtools_runtime::AutomationEvent;use crate::domains::observable_output::{ObservableOutputProjectionStep, ObservablePreparedOutputSlot,live_log_prepared_outputs_for_renderer_network_fact,diff --git a/moli-protocol/src/domains/native.rs b/moli-protocol/src/domains/native.rsindex 304170e0f..acffd62f9 100644--- a/moli-protocol/src/domains/native.rs+++ b/moli-protocol/src/domains/native.rs@@ -137,7 +137,7 @@ pub(crate) fn start_operation(Err(error) => return NativeCommandStep::Complete(CommandOutputPlan::error(-32000, error)),};let command_id = cmd.id.expect("a native frontend command has a call id");- match page.start_native_frontend_command(command_id, cmd.session_id, operation) {+ match page.start_cdp_call(command_id, cmd.session_id, operation) {Ok((pending, guard)) => NativeCommandStep::Pending(PendingNativeCommand {session_id: cmd.session_id.map(str::to_owned),residence,@@ -352,8 +352,7 @@ mod tests {let (event, sidecar) = events.next().unwrap().into_parts();assert_eq!(event["method"], "DOM.setChildNodes");assert_eq!(event["sessionId"], "SID-native");- let Some(crate::devtools_runtime::AutomationEvent::DomSetChildNodes(sidecar)) = sidecar- else {+ let Some(crate::automation::AutomationEvent::DomSetChildNodes(sidecar)) = sidecar else {panic!("native DOM notifications retain their typed automation event");};assert_eq!(sidecar.parent_node_id, 3);diff --git a/moli-protocol/src/domains/native/node.rs b/moli-protocol/src/domains/native/node.rsindex 13b24bde2..0a0fbfaaa 100644--- a/moli-protocol/src/domains/native/node.rs+++ b/moli-protocol/src/domains/native/node.rs@@ -6,7 +6,7 @@ use moli_core::{};use serde::Deserialize;-use crate::devtools_runtime::DevToolsDomNodeReference;+use crate::automation::DevToolsDomNodeReference;#[derive(Deserialize, Default)]#[serde(rename_all = "camelCase")]diff --git a/moli-protocol/src/domains/network.rs b/moli-protocol/src/domains/network.rsindex bcb921add..edc239515 100644--- a/moli-protocol/src/domains/network.rs+++ b/moli-protocol/src/domains/network.rs@@ -1,9 +1,9 @@-use crate::conn::{CdpConnection, Cmd, CommandOwnerScope};-use crate::devtools_runtime::{- DevToolsAddNetworkDataCollectorCommand, DevToolsBrowserContextId, DevToolsCommand,- DevToolsCommandResult, DevToolsError, DevToolsErrorKind,+use crate::automation::{+ AutomationCommand, AutomationResult, DevToolsAddNetworkDataCollectorCommand,+ DevToolsBrowserContextId, DevToolsError, DevToolsErrorKind,DevToolsRemoveNetworkDataCollectorCommand, DevToolsSetCacheBehaviorCommand, DevToolsTargetId,};+use crate::conn::{CdpConnection, Cmd, CommandOwnerScope};use super::storage::{CdpCookieParam, DeleteCookiesParams, associated_cookies_to_json, cookie_query_report_to_json,@@ -300,20 +300,20 @@ pub(crate) fn start_network_domain_command_dispatch(pub(crate) fn execute_devtools_network_command(conn: &mut CdpConnection,- command: DevToolsCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+ command: AutomationCommand,+) -> Result<AutomationResult, DevToolsError> {match command {- DevToolsCommand::AddNetworkDataCollector(command) => {+ AutomationCommand::AddNetworkDataCollector(command) => {add_network_data_collector_result(conn, command)}- DevToolsCommand::RemoveNetworkDataCollector(command) => {+ AutomationCommand::RemoveNetworkDataCollector(command) => {remove_network_data_collector_result(conn, command)}- DevToolsCommand::DisownNetworkData(command) => {+ AutomationCommand::DisownNetworkData(command) => {response_body::disown_network_data_result(conn, command)}- DevToolsCommand::GetNetworkData(command) => get_network_data_result(conn, command),- DevToolsCommand::SetCacheBehavior(command) => set_cache_behavior_result(conn, command),+ AutomationCommand::GetNetworkData(command) => get_network_data_result(conn, command),+ AutomationCommand::SetCacheBehavior(command) => set_cache_behavior_result(conn, command),_ => Err(DevToolsError::new(DevToolsErrorKind::Unsupported,"UnsupportedDevToolsNetworkCommand",@@ -324,7 +324,7 @@ pub(crate) fn execute_devtools_network_command(fn add_network_data_collector_result(conn: &mut CdpConnection,mut command: DevToolsAddNetworkDataCollectorCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {command.target_ids = validate_network_data_collector_target_ids(conn, &command.target_ids)?;command.browser_context_ids =resolve_network_data_collector_browser_context_ids(conn, &command.browser_context_ids)?;@@ -334,10 +334,10 @@ fn add_network_data_collector_result(fn remove_network_data_collector_result(conn: &mut CdpConnection,command: DevToolsRemoveNetworkDataCollectorCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {conn.network_data_collectors.remove_collector(&command.collector_id)?;- Ok(DevToolsCommandResult::Empty)+ Ok(AutomationResult::Empty)}fn validate_network_data_collector_target_ids(@@ -419,7 +419,7 @@ fn is_moli_internal_default_user_context(browser_context_id: &str) -> bool {fn set_cache_behavior_result(conn: &mut CdpConnection,command: DevToolsSetCacheBehaviorCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let target_ids = if command.target_ids.is_empty() {conn.set_global_cache_disabled(command.cache_disabled);top_level_target_ids(conn)@@ -434,7 +434,7 @@ fn set_cache_behavior_result());}}- Ok(DevToolsCommandResult::Empty)+ Ok(AutomationResult::Empty)}fn top_level_target_ids(conn: &CdpConnection) -> Vec<String> {diff --git a/moli-protocol/src/domains/network/agent.rs b/moli-protocol/src/domains/network/agent.rsindex 92e1d120b..0ac5abb76 100644--- a/moli-protocol/src/domains/network/agent.rs+++ b/moli-protocol/src/domains/network/agent.rs@@ -3,8 +3,8 @@ use std::collections::{HashMap, HashSet};use moli_bounded_buffer::{BoundedByteBuffer, ByteLimits, InsertOutcome};use moli_core::page::{ScriptNetworkOutputItem, SubresourceNetworkRequestHandle};+use crate::automation::DevToolsNetworkDataType;use crate::conn::{CapturedBody, ConnectionNetworkRequestIdAllocator};-use crate::devtools_runtime::DevToolsNetworkDataType;use super::{PendingNetworkBacklogDeliverySnapshot, PendingSubresourceNetworkActivity,diff --git a/moli-protocol/src/domains/network/backlog.rs b/moli-protocol/src/domains/network/backlog.rsindex 908a8c3d6..82c35001e 100644--- a/moli-protocol/src/domains/network/backlog.rs+++ b/moli-protocol/src/domains/network/backlog.rs@@ -1,10 +1,10 @@use moli_core::page::{SubresourceBodyFinishedResult, SubresourceResponseBody};+use crate::automation::{DevToolsNetworkInterceptId, DevToolsNetworkResourceType};use crate::conn::{BackgroundProtocolEvent, CdpConnection, CommandOwnerScope, FetchRequestStage,monotonic_timestamp_seconds,};-use crate::devtools_runtime::{DevToolsNetworkInterceptId, DevToolsNetworkResourceType};use crate::domains::network::{NetworkBacklogPreferredRequestId, NetworkPreparedOutputs};use super::events::{@@ -838,7 +838,7 @@ fn record_subresource_response_body_source(session_ids: &[Option<String>],) {let captured_body = crate::conn::CapturedBody::from_subresource_response_body(response_body);- let data_type = crate::devtools_runtime::DevToolsNetworkDataType::Response;+ let data_type = crate::automation::DevToolsNetworkDataType::Response;let collector_ids =conn.network_data_collector_ids_for_owner_body(owner, data_type, captured_body.len());let collection_was_gated = conn.network_data_collection_is_gated_for_body(data_type);@@ -871,7 +871,7 @@ fn record_subresource_request_body(let Some(request_body) = request_body else {return;};- let data_type = crate::devtools_runtime::DevToolsNetworkDataType::Request;+ let data_type = crate::automation::DevToolsNetworkDataType::Request;let collector_ids =conn.network_data_collector_ids_for_owner_body(owner, data_type, request_body.len());let collection_was_gated = conn.network_data_collection_is_gated_for_body(data_type);@@ -902,11 +902,11 @@ fn record_subresource_pending_response_body() {let collector_ids = conn.network_data_collector_ids_for_owner_body(owner,- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,0,);let collection_was_gated = conn.network_data_collection_is_gated_for_body(- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,);let Ok(runtime_slot) = conn.runtime_session_owner_slot_mut_for_owner(owner) else {return;@@ -928,11 +928,11 @@ fn record_subresource_failed_response_body() {let collector_ids = conn.network_data_collector_ids_for_owner_body(owner,- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,0,);let collection_was_gated = conn.network_data_collection_is_gated_for_body(- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,);let Ok(runtime_slot) = conn.runtime_session_owner_slot_mut_for_owner(owner) else {return;@@ -1044,8 +1044,8 @@ mod tests {use url::Url;use crate::{+ automation::{AutomationEvent, DevToolsNetworkResourceType},conn::{CdpConnection, CommandOwnerScope},- devtools_runtime::{AutomationEvent, DevToolsNetworkResourceType},domains::network::{NetworkPreparedOutputs, PendingSubresourceNetworkActivity,PendingSubresourceNetworkActivitySession, TargetNetworkBacklogRequestIdResolver,diff --git a/moli-protocol/src/domains/network/collectors.rs b/moli-protocol/src/domains/network/collectors.rsindex b657c5e19..f53aa7c93 100644--- a/moli-protocol/src/domains/network/collectors.rs+++ b/moli-protocol/src/domains/network/collectors.rs@@ -1,11 +1,11 @@use std::collections::{HashMap, HashSet};-use crate::conn::CapturedBody;-use crate::devtools_runtime::{- DevToolsAddNetworkDataCollectorCommand, DevToolsAddNetworkDataCollectorResult,- DevToolsCommandResult, DevToolsError, DevToolsErrorKind, DevToolsNetworkDataCollectorId,- DevToolsNetworkDataType,+use crate::automation::{+ AutomationResult, DevToolsAddNetworkDataCollectorCommand,+ DevToolsAddNetworkDataCollectorResult, DevToolsError, DevToolsErrorKind,+ DevToolsNetworkDataCollectorId, DevToolsNetworkDataType,};+use crate::conn::CapturedBody;const MAX_TOTAL_COLLECTED_SIZE: u64 = 200_000_000;@@ -34,7 +34,7 @@ impl NetworkDataCollectorStore {pub(crate) fn add_collector(&mut self,command: DevToolsAddNetworkDataCollectorCommand,- ) -> Result<DevToolsCommandResult, DevToolsError> {+ ) -> Result<AutomationResult, DevToolsError> {if command.max_encoded_data_size < 1|| command.max_encoded_data_size > MAX_TOTAL_COLLECTED_SIZE{@@ -61,7 +61,7 @@ impl NetworkDataCollectorStore {.collect(),},);- Ok(DevToolsCommandResult::AddNetworkDataCollector(+ Ok(AutomationResult::AddNetworkDataCollector(DevToolsAddNetworkDataCollectorResult {collector_id: DevToolsNetworkDataCollectorId::from(collector_id),},diff --git a/moli-protocol/src/domains/network/cookies.rs b/moli-protocol/src/domains/network/cookies.rsindex 04dde143f..0f40e5ab9 100644--- a/moli-protocol/src/domains/network/cookies.rs+++ b/moli-protocol/src/domains/network/cookies.rs@@ -3,8 +3,8 @@ use serde_json::Value;use url::Url;use super::*;-use crate::devtools_runtime::{- DevToolsBrowserContextId, DevToolsCommand, DevToolsDeleteCookiesCommand,+use crate::automation::{+ AutomationCommand, DevToolsBrowserContextId, DevToolsDeleteCookiesCommand,DevToolsGetCookiesCommand, DevToolsSetCookiesCommand,};use crate::domains::storage::{@@ -19,7 +19,7 @@ pub(super) fn start_get_cookies_command(Ok(command) => command,Err(plan) => return StorageCommandTaskStep::Complete(plan),};- start_devtools_storage_command(conn, cmd.id, DevToolsCommand::GetCookies(command))+ start_devtools_storage_command(conn, cmd.id, AutomationCommand::GetCookies(command))}pub(super) fn start_get_all_cookies_command(@@ -30,7 +30,7 @@ pub(super) fn start_get_all_cookies_command(Ok(command) => command,Err(plan) => return StorageCommandTaskStep::Complete(plan),};- start_devtools_storage_command(conn, cmd.id, DevToolsCommand::GetCookies(command))+ start_devtools_storage_command(conn, cmd.id, AutomationCommand::GetCookies(command))}fn build_cdp_network_get_cookies_command(@@ -48,7 +48,7 @@ fn build_cdp_network_get_cookies_command(.map(|(_, target_id)| ((), target_id)).unwrap_or(((), None));Ok(DevToolsGetCookiesCommand {- context: cmd.devtools_command_context(target_id.as_deref(), Option::<&str>::None),+ context: cmd.automation_context(target_id.as_deref(), Option::<&str>::None),browser_context_id: None,urls,filter: None,@@ -81,7 +81,7 @@ pub(super) fn start_delete_cookies_command(Ok(command) => command,Err(plan) => return StorageCommandTaskStep::Complete(plan),};- start_devtools_storage_command(conn, cmd.id, DevToolsCommand::DeleteCookies(command))+ start_devtools_storage_command(conn, cmd.id, AutomationCommand::DeleteCookies(command))}pub(super) fn start_clear_browser_cookies_command(@@ -93,7 +93,7 @@ pub(super) fn start_clear_browser_cookies_command(.map(|(_, target_id)| ((), target_id)).unwrap_or(((), None));let command = DevToolsDeleteCookiesCommand {- context: cmd.devtools_command_context(target_id.as_deref(), Option::<&str>::None),+ context: cmd.automation_context(target_id.as_deref(), Option::<&str>::None),browser_context_id: None,name: None,url: None,@@ -102,7 +102,7 @@ pub(super) fn start_clear_browser_cookies_command(partition_key: None,filter: None,};- start_devtools_storage_command(conn, cmd.id, DevToolsCommand::DeleteCookies(command))+ start_devtools_storage_command(conn, cmd.id, AutomationCommand::DeleteCookies(command))}fn build_cdp_network_delete_cookies_command(@@ -123,7 +123,7 @@ fn build_cdp_network_delete_cookies_command(.browser_context_id.map(DevToolsBrowserContextId::from);Ok(DevToolsDeleteCookiesCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.clone()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.clone()),browser_context_id,name: params.name,url: params.url,@@ -148,7 +148,7 @@ pub(super) fn start_set_cookie_command(}};let command = build_devtools_set_cookies_command(conn, cmd, None, vec![cookie]);- start_devtools_storage_command(conn, cmd.id, DevToolsCommand::SetCookies(command))+ start_devtools_storage_command(conn, cmd.id, AutomationCommand::SetCookies(command))}#[derive(Deserialize)]@@ -171,7 +171,7 @@ pub(super) fn start_set_cookies_command(}};let command = build_devtools_set_cookies_command(conn, cmd, None, params.cookies);- start_devtools_storage_command(conn, cmd.id, DevToolsCommand::SetCookies(command))+ start_devtools_storage_command(conn, cmd.id, AutomationCommand::SetCookies(command))}fn build_devtools_set_cookies_command(@@ -186,7 +186,7 @@ fn build_devtools_set_cookies_command(.unwrap_or(((), None));let browser_context_id = browser_context_id.map(DevToolsBrowserContextId::from);DevToolsSetCookiesCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.clone()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.clone()),browser_context_id,cookies: cookies.into_iter().map(Into::into).collect(),}@@ -194,7 +194,7 @@ fn build_devtools_set_cookies_command(#[cfg(test)]mod protocol_neutral_tests {- use crate::devtools_runtime::DevToolsProtocol;+ use crate::automation::FrontendProtocol;use serde_json::{Value, json};use crate::conn::{CdpConnection, Cmd};@@ -229,7 +229,7 @@ mod protocol_neutral_tests {panic!("valid Network.getCookies command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-network")@@ -320,7 +320,7 @@ mod protocol_neutral_tests {panic!("valid Network.deleteCookies command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-network")diff --git a/moli-protocol/src/domains/network/events.rs b/moli-protocol/src/domains/network/events.rsindex 9701312e9..df313f66a 100644--- a/moli-protocol/src/domains/network/events.rs+++ b/moli-protocol/src/domains/network/events.rs@@ -1,4 +1,4 @@-use crate::devtools_runtime::{+use crate::automation::{AutomationEvent, DevToolsFetchRequestId, DevToolsFrameId, DevToolsLoaderId,DevToolsNetworkInterceptId, DevToolsNetworkResourceType, DevToolsRequestId, DevToolsTargetId,NetworkRedirectResponseEvent, NetworkRequestEvent,@@ -1293,7 +1293,7 @@ mod tests {use serde_json::{Value, json};use url::Url;- use crate::devtools_runtime::{+ use crate::automation::{AutomationEvent, DevToolsFrameId, DevToolsLoaderId, DevToolsNetworkInterceptId,DevToolsNetworkResourceType, DevToolsRequestId, DevToolsTargetId, NetworkRequestEvent,};diff --git a/moli-protocol/src/domains/network/main_document_progress/emit.rs b/moli-protocol/src/domains/network/main_document_progress/emit.rsindex 3e7508506..dd8b8bbae 100644--- a/moli-protocol/src/domains/network/main_document_progress/emit.rs+++ b/moli-protocol/src/domains/network/main_document_progress/emit.rs@@ -1,4 +1,4 @@-use crate::devtools_runtime::{+use crate::automation::{AutomationEvent, DevToolsFrameId, DevToolsLoaderId, DevToolsNetworkResourceType,DevToolsRequestId, DevToolsTargetId, NetworkRedirectResponseEvent, NetworkRequestEvent,};diff --git a/moli-protocol/src/domains/network/main_document_progress/gate.rs b/moli-protocol/src/domains/network/main_document_progress/gate.rsindex ec73ed40a..68a1dba90 100644--- a/moli-protocol/src/domains/network/main_document_progress/gate.rs+++ b/moli-protocol/src/domains/network/main_document_progress/gate.rs@@ -1,7 +1,7 @@use parking_lot::{Mutex, MutexGuard};use std::sync::Arc;-use crate::devtools_runtime::AutomationEvent;+use crate::automation::AutomationEvent;use serde_json::Value;use crate::conn::{BackgroundEventSender, BackgroundProtocolEvent, build_event};diff --git a/moli-protocol/src/domains/network/main_document_progress/mod.rs b/moli-protocol/src/domains/network/main_document_progress/mod.rsindex 80ab431d0..27087b8cf 100644--- a/moli-protocol/src/domains/network/main_document_progress/mod.rs+++ b/moli-protocol/src/domains/network/main_document_progress/mod.rs@@ -16,12 +16,12 @@ use moli_fetch::{use std::sync::Arc;use url::Url;+use crate::automation::DevToolsRequestFailure;use crate::conn::{BackgroundEventSender, BackgroundProtocolEvent, CapturedBody, CdpConnection,CompletedDownloadBodyArtifact, DownloadNavigation, LoadedNavigation, NavigationDispatchState,NavigationLoadOutcome, NavigationRequestBlocked, ResponseCommitReady, TargetRuntimeSlot,};-use crate::devtools_runtime::DevToolsRequestFailure;#[cfg(test)]use gate::MainDocumentProgressDrain;@@ -459,11 +459,11 @@ fn completed_document_body_progress_queue(let encoded_data_length = body.len();let collector_ids = conn.network_data_collector_ids_for_session_owner_body(owner_session_id,- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,encoded_data_length,);let collection_was_gated = conn.network_data_collection_is_gated_for_body(- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,);if network_observed&& !synthetic@@ -471,7 +471,7 @@ fn completed_document_body_progress_queue({conn.record_collected_network_data_body(request_id,- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,body.clone(),collector_ids.iter().cloned(),collection_was_gated,@@ -1424,7 +1424,7 @@ fn record_child_document_response_body(session_ids: &[Option<String>],response_body: Option<&moli_core::page::SubresourceResponseBody>,) {- let data_type = crate::devtools_runtime::DevToolsNetworkDataType::Response;+ let data_type = crate::automation::DevToolsNetworkDataType::Response;let encoded_data_length = response_body.map_or(0, |body| body.len());let collector_ids = conn.network_data_collector_ids_for_session_owner_body(owner_session_id,@@ -2209,11 +2209,11 @@ fn record_pending_main_document_response_body(};let collector_ids = conn.network_data_collector_ids_for_session_owner_body(state.session_id.as_deref(),- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,0,);let collection_was_gated = conn.network_data_collection_is_gated_for_body(- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,);if let Ok(runtime_slot) = conn.runtime_session_owner_slot_mut(state.session_id.as_deref()) {runtime_slot.record_pending_response_body_with_collector_scope(@@ -2239,7 +2239,7 @@ pub(crate) fn record_main_document_request_body(return;};let session_ids = main_document_network_event_session_ids(conn, state.session_id.as_deref());- let data_type = crate::devtools_runtime::DevToolsNetworkDataType::Request;+ let data_type = crate::automation::DevToolsNetworkDataType::Request;let collector_ids = conn.network_data_collector_ids_for_session_owner_body(state.session_id.as_deref(),data_type,@@ -2287,11 +2287,11 @@ pub(crate) fn record_failed_main_document_response_body(let session_ids = main_document_network_event_session_ids(conn, state.session_id.as_deref());let collector_ids = conn.network_data_collector_ids_for_session_owner_body(state.session_id.as_deref(),- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,0,);let collection_was_gated = conn.network_data_collection_is_gated_for_body(- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,);if let Ok(runtime_slot) = conn.runtime_session_owner_slot_mut(state.session_id.as_deref()) {runtime_slot.record_failed_response_body_with_collector_scope(@@ -2314,11 +2314,11 @@ pub(crate) fn record_completed_main_document_response_body(let session_ids = main_document_network_event_session_ids(conn, state.session_id.as_deref());let collector_ids = conn.network_data_collector_ids_for_session_owner_body(state.session_id.as_deref(),- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,response_body.len(),);let collection_was_gated = conn.network_data_collection_is_gated_for_body(- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,);if network_enabled&& !synthetic@@ -2326,7 +2326,7 @@ pub(crate) fn record_completed_main_document_response_body({conn.record_collected_network_data_body(request_id,- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,response_body.clone(),collector_ids.iter().cloned(),collection_was_gated,diff --git a/moli-protocol/src/domains/network/main_document_progress/tests.rs b/moli-protocol/src/domains/network/main_document_progress/tests.rsindex 18d65e685..5901712a9 100644--- a/moli-protocol/src/domains/network/main_document_progress/tests.rs+++ b/moli-protocol/src/domains/network/main_document_progress/tests.rs@@ -1,4 +1,4 @@-use crate::devtools_runtime::{AutomationEvent, DevToolsNetworkResourceType};+use crate::automation::{AutomationEvent, DevToolsNetworkResourceType};use moli_cookie_jar::{StoredCookieQueryReport, StoredCookieSetRejectionReason, StoredCookieSetStatus,};@@ -20,7 +20,7 @@ use super::*;#[test]fn aborted_navigation_preserves_the_document_without_hiding_other_failures() {- use crate::devtools_runtime::DevToolsRequestFailure;+ use crate::automation::DevToolsRequestFailure;for error in [anyhow::Error::new(moli_fetch::FetchCancelled),diff --git a/moli-protocol/src/domains/network/output.rs b/moli-protocol/src/domains/network/output.rsindex f7eb25eed..fe27b312d 100644--- a/moli-protocol/src/domains/network/output.rs+++ b/moli-protocol/src/domains/network/output.rs@@ -5,8 +5,8 @@ use moli_core::page::{use serde_json::Value;use url::Url;+use crate::automation::DevToolsNetworkInterceptId;use crate::conn::PendingSubresourceFetchRequest;-use crate::devtools_runtime::DevToolsNetworkInterceptId;#[derive(Clone, Debug, PartialEq)]pub(crate) struct TargetSubresourceFetchPauseOutput {diff --git a/moli-protocol/src/domains/network/response_body.rs b/moli-protocol/src/domains/network/response_body.rsindex e9d2ec7d2..7a0e392cf 100644--- a/moli-protocol/src/domains/network/response_body.rs+++ b/moli-protocol/src/domains/network/response_body.rs@@ -2,12 +2,12 @@ use base64::{Engine as _, engine::general_purpose::STANDARD as BASE64_STANDARD};use serde_json::{Value, json};use super::{CapturedRequestBody, CapturedResponseBody, collectors::CollectedNetworkDataBody};-use crate::conn::{CdpConnection, Cmd, TargetRuntimeSlot};-use crate::devtools_runtime::{- DevToolsCommandResult, DevToolsDisownNetworkDataCommand, DevToolsError, DevToolsErrorKind,+use crate::automation::{+ AutomationResult, DevToolsDisownNetworkDataCommand, DevToolsError, DevToolsErrorKind,DevToolsGetNetworkDataCommand, DevToolsNetworkDataBytesType, DevToolsNetworkDataCollectorId,DevToolsNetworkDataResult, DevToolsNetworkDataType, DevToolsRequestId,};+use crate::conn::{CdpConnection, Cmd, TargetRuntimeSlot};use crate::domains::command_output::CommandOutputPlan;fn network_events_enabled_for_session(@@ -116,7 +116,7 @@ pub(super) fn get_request_post_data_command_output_plan(pub(crate) fn get_network_data_result(conn: &mut CdpConnection,command: DevToolsGetNetworkDataCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {if command.disown {let Some(collector) = command.collector.as_ref() else {return Err(DevToolsError::new(@@ -173,15 +173,13 @@ pub(crate) fn get_network_data_result() {return Err(no_such_network_data());}- Ok(DevToolsCommandResult::NetworkData(network_data_result(- body,- )))+ Ok(AutomationResult::NetworkData(network_data_result(body)))}pub(crate) fn disown_network_data_result(conn: &mut CdpConnection,command: DevToolsDisownNetworkDataCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {conn.network_data_collectors.ensure_collector_exists(&command.collector_id)?;let body_was_collected_by_collector = {@@ -211,7 +209,7 @@ pub(crate) fn disown_network_data_result(command.data_type,&command.collector_id,)?;- Ok(DevToolsCommandResult::Empty)+ Ok(AutomationResult::Empty)}enum NetworkDataBody<'a> {diff --git a/moli-protocol/src/domains/network/tests/cache.rs b/moli-protocol/src/domains/network/tests/cache.rsindex 268c93f99..720be24e4 100644--- a/moli-protocol/src/domains/network/tests/cache.rs+++ b/moli-protocol/src/domains/network/tests/cache.rs@@ -789,13 +789,11 @@ async fn devtools_set_cache_behavior_global_updates_existing_targets_and_defaultlet result = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::SetCacheBehavior(- crate::devtools_runtime::DevToolsSetCacheBehaviorCommand {- context: crate::devtools_runtime::DevToolsCommandContext {- protocol: crate::devtools_runtime::DevToolsProtocol::WebDriverBidi,- session_id: Some(crate::devtools_runtime::DevToolsSessionId::from(- "bidi-session-1",- )),+ .execute_automation_command(crate::automation::AutomationCommand::SetCacheBehavior(+ crate::automation::DevToolsSetCacheBehaviorCommand {+ context: crate::automation::AutomationContext {+ protocol: crate::automation::FrontendProtocol::WebDriverBidi,+ session_id: Some(crate::automation::DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,},@@ -807,10 +805,7 @@ async fn devtools_set_cache_behavior_global_updates_existing_targets_and_default.into_parts().0.expect("global BiDi cache behavior should succeed");- assert_eq!(- result,- crate::devtools_runtime::DevToolsCommandResult::Empty- );+ assert_eq!(result, crate::automation::AutomationResult::Empty);let bc = ctx.conn.browser_context.as_ref().expect("browser context");assert!(bc.active_page_target().effective_policy().cache_disabled());@@ -842,19 +837,15 @@ async fn devtools_set_cache_behavior_contexts_only_updates_requested_targets() {ctx.conn.install_browser_context_fixture_for_test(bc);ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::SetCacheBehavior(- crate::devtools_runtime::DevToolsSetCacheBehaviorCommand {- context: crate::devtools_runtime::DevToolsCommandContext {- protocol: crate::devtools_runtime::DevToolsProtocol::WebDriverBidi,- session_id: Some(crate::devtools_runtime::DevToolsSessionId::from(- "bidi-session-1",- )),+ .execute_automation_command(crate::automation::AutomationCommand::SetCacheBehavior(+ crate::automation::DevToolsSetCacheBehaviorCommand {+ context: crate::automation::AutomationContext {+ protocol: crate::automation::FrontendProtocol::WebDriverBidi,+ session_id: Some(crate::automation::DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,},- target_ids: vec![crate::devtools_runtime::DevToolsTargetId::from(- "TID-background",- )],+ target_ids: vec![crate::automation::DevToolsTargetId::from("TID-background")],cache_disabled: true,},))@@ -886,19 +877,15 @@ async fn devtools_set_cache_behavior_rejects_unknown_context() {let error = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::SetCacheBehavior(- crate::devtools_runtime::DevToolsSetCacheBehaviorCommand {- context: crate::devtools_runtime::DevToolsCommandContext {- protocol: crate::devtools_runtime::DevToolsProtocol::WebDriverBidi,- session_id: Some(crate::devtools_runtime::DevToolsSessionId::from(- "bidi-session-1",- )),+ .execute_automation_command(crate::automation::AutomationCommand::SetCacheBehavior(+ crate::automation::DevToolsSetCacheBehaviorCommand {+ context: crate::automation::AutomationContext {+ protocol: crate::automation::FrontendProtocol::WebDriverBidi,+ session_id: Some(crate::automation::DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,},- target_ids: vec![crate::devtools_runtime::DevToolsTargetId::from(- "TID-missing",- )],+ target_ids: vec![crate::automation::DevToolsTargetId::from("TID-missing")],cache_disabled: true,},))@@ -909,7 +896,7 @@ async fn devtools_set_cache_behavior_rejects_unknown_context() {assert_eq!(error.kind,- crate::devtools_runtime::DevToolsErrorKind::NoSuchTarget+ crate::automation::DevToolsErrorKind::NoSuchTarget);assert_eq!(error.message, "NoSuchTarget");}@@ -919,13 +906,11 @@ async fn devtools_set_cache_behavior_without_contexts_sets_future_default() {let mut ctx = TestContext::new();ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::SetCacheBehavior(- crate::devtools_runtime::DevToolsSetCacheBehaviorCommand {- context: crate::devtools_runtime::DevToolsCommandContext {- protocol: crate::devtools_runtime::DevToolsProtocol::WebDriverBidi,- session_id: Some(crate::devtools_runtime::DevToolsSessionId::from(- "bidi-session-1",- )),+ .execute_automation_command(crate::automation::AutomationCommand::SetCacheBehavior(+ crate::automation::DevToolsSetCacheBehaviorCommand {+ context: crate::automation::AutomationContext {+ protocol: crate::automation::FrontendProtocol::WebDriverBidi,+ session_id: Some(crate::automation::DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,},diff --git a/moli-protocol/src/domains/network/tests/response_body.rs b/moli-protocol/src/domains/network/tests/response_body.rsindex 4c31aba9f..18addbe4b 100644--- a/moli-protocol/src/domains/network/tests/response_body.rs+++ b/moli-protocol/src/domains/network/tests/response_body.rs@@ -15,10 +15,10 @@ use crate::domains::network::{use super::*;-fn bidi_network_context(session_id: &str) -> crate::devtools_runtime::DevToolsCommandContext {- crate::devtools_runtime::DevToolsCommandContext {- protocol: crate::devtools_runtime::DevToolsProtocol::WebDriverBidi,- session_id: Some(crate::devtools_runtime::DevToolsSessionId::from(session_id)),+fn bidi_network_context(session_id: &str) -> crate::automation::AutomationContext {+ crate::automation::AutomationContext {+ protocol: crate::automation::FrontendProtocol::WebDriverBidi,+ session_id: Some(crate::automation::DevToolsSessionId::from(session_id)),target_id: None,browser_context_id: None,}@@ -564,19 +564,19 @@ async fn get_request_post_data_uses_text_projection_while_bidi_collector_keeps_tlet (result, _) = ctx.conn- .execute_devtools_command(- crate::devtools_runtime::DevToolsCommand::AddNetworkDataCollector(- crate::devtools_runtime::DevToolsAddNetworkDataCollectorCommand {- context: crate::devtools_runtime::DevToolsCommandContext {- protocol: crate::devtools_runtime::DevToolsProtocol::WebDriverBidi,- session_id: Some(crate::devtools_runtime::DevToolsSessionId::from("SID-1")),+ .execute_automation_command(+ crate::automation::AutomationCommand::AddNetworkDataCollector(+ crate::automation::DevToolsAddNetworkDataCollectorCommand {+ context: crate::automation::AutomationContext {+ protocol: crate::automation::FrontendProtocol::WebDriverBidi,+ session_id: Some(crate::automation::DevToolsSessionId::from("SID-1")),target_id: None,browser_context_id: None,},- collector_id: crate::devtools_runtime::DevToolsNetworkDataCollectorId::from(+ collector_id: crate::automation::DevToolsNetworkDataCollectorId::from("collector-multipart-request-bytes",),- data_types: vec![crate::devtools_runtime::DevToolsNetworkDataType::Request],+ data_types: vec![crate::automation::DevToolsNetworkDataType::Request],max_encoded_data_size: 1000,target_ids: Vec::new(),browser_context_ids: Vec::new(),@@ -587,7 +587,7 @@ async fn get_request_post_data_uses_text_projection_while_bidi_collector_keeps_t.into_parts();assert!(matches!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::AddNetworkDataCollector(_))+ Ok(crate::automation::AutomationResult::AddNetworkDataCollector(_))));let multipart_text = "----MoliFormDataBoundary0000\r\nContent-Disposition: form-data; name=\"field\"\r\n\r\nvalue\r\n----MoliFormDataBoundary0000\r\nContent-Disposition: form-data; name=\"file\"; filename=\"a.bin\"\r\nContent-Type: application/octet-stream\r\n\r\n";@@ -646,7 +646,7 @@ async fn get_request_post_data_uses_text_projection_while_bidi_collector_keeps_t.network_data_collectors.collected_body("REQ-multipart",- crate::devtools_runtime::DevToolsNetworkDataType::Request,+ crate::automation::DevToolsNetworkDataType::Request,).expect("BiDi collector should retain the request body");assert_eq!(@@ -671,16 +671,16 @@ async fn get_network_data_returns_bidi_response_body_bytes() {let (result, _) = ctx.conn- .execute_devtools_command(- crate::devtools_runtime::DevToolsCommand::AddNetworkDataCollector(- crate::devtools_runtime::DevToolsAddNetworkDataCollectorCommand {+ .execute_automation_command(+ crate::automation::AutomationCommand::AddNetworkDataCollector(+ crate::automation::DevToolsAddNetworkDataCollectorCommand {context: bidi_network_context("bidi-session-1"),- collector_id: crate::devtools_runtime::DevToolsNetworkDataCollectorId::from(+ collector_id: crate::automation::DevToolsNetworkDataCollectorId::from("collector-bidi-bytes",),data_types: vec![- crate::devtools_runtime::DevToolsNetworkDataType::Response,- crate::devtools_runtime::DevToolsNetworkDataType::Request,+ crate::automation::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Request,],max_encoded_data_size: 1000,target_ids: Vec::new(),@@ -692,12 +692,12 @@ async fn get_network_data_returns_bidi_response_body_bytes() {.into_parts();assert!(matches!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::AddNetworkDataCollector(_))+ Ok(crate::automation::AutomationResult::AddNetworkDataCollector(_))));let response_collector_ids = ctx.conn.network_data_collector_ids_for_session_owner_body(Some("bidi-session-1"),- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,"bidi body".len(),);ctx.conn@@ -714,7 +714,7 @@ async fn get_network_data_returns_bidi_response_body_bytes() {let binary_response = CapturedBody::from_bytes(vec![0x00, 0xff]);let binary_response_collector_ids = ctx.conn.network_data_collector_ids_for_session_owner_body(Some("bidi-session-1"),- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,binary_response.len(),);ctx.conn@@ -731,7 +731,7 @@ async fn get_network_data_returns_bidi_response_body_bytes() {let primary_response_collector_ids =ctx.conn.network_data_collector_ids_for_session_owner_body(Some("bidi-session-1"),- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,"primary body".len(),);ctx.conn@@ -747,7 +747,7 @@ async fn get_network_data_returns_bidi_response_body_bytes() {let request_collector_ids = ctx.conn.network_data_collector_ids_for_session_owner_body(Some("bidi-session-1"),- crate::devtools_runtime::DevToolsNetworkDataType::Request,+ crate::automation::DevToolsNetworkDataType::Request,"bidi request body".len(),);ctx.conn@@ -764,7 +764,7 @@ async fn get_network_data_returns_bidi_response_body_bytes() {let binary_request = vec![0x00, 0xff, b'a'];let binary_request_collector_ids = ctx.conn.network_data_collector_ids_for_session_owner_body(Some("bidi-session-1"),- crate::devtools_runtime::DevToolsNetworkDataType::Request,+ crate::automation::DevToolsNetworkDataType::Request,binary_request.len(),);ctx.conn@@ -780,18 +780,16 @@ async fn get_network_data_returns_bidi_response_body_bytes() {let (result, scheduler_events) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {- context: crate::devtools_runtime::DevToolsCommandContext {- protocol: crate::devtools_runtime::DevToolsProtocol::WebDriverBidi,- session_id: Some(crate::devtools_runtime::DevToolsSessionId::from(- "bidi-session-1",- )),+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {+ context: crate::automation::AutomationContext {+ protocol: crate::automation::FrontendProtocol::WebDriverBidi,+ session_id: Some(crate::automation::DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,},- request_id: crate::devtools_runtime::DevToolsRequestId::from("REQ-bidi-text"),- data_type: crate::devtools_runtime::DevToolsNetworkDataType::Response,+ request_id: crate::automation::DevToolsRequestId::from("REQ-bidi-text"),+ data_type: crate::automation::DevToolsNetworkDataType::Response,collector: None,disown: false,},@@ -802,9 +800,9 @@ async fn get_network_data_returns_bidi_response_body_bytes() {assert!(scheduler_events.is_empty());assert_eq!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::NetworkData(- crate::devtools_runtime::DevToolsNetworkDataResult {- bytes_type: crate::devtools_runtime::DevToolsNetworkDataBytesType::String,+ Ok(crate::automation::AutomationResult::NetworkData(+ crate::automation::DevToolsNetworkDataResult {+ bytes_type: crate::automation::DevToolsNetworkDataBytesType::String,value: "bidi body".to_owned(),},))@@ -812,18 +810,16 @@ async fn get_network_data_returns_bidi_response_body_bytes() {let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {- context: crate::devtools_runtime::DevToolsCommandContext {- protocol: crate::devtools_runtime::DevToolsProtocol::WebDriverBidi,- session_id: Some(crate::devtools_runtime::DevToolsSessionId::from(- "bidi-session-1",- )),+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {+ context: crate::automation::AutomationContext {+ protocol: crate::automation::FrontendProtocol::WebDriverBidi,+ session_id: Some(crate::automation::DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,},- request_id: crate::devtools_runtime::DevToolsRequestId::from("REQ-bidi-request"),- data_type: crate::devtools_runtime::DevToolsNetworkDataType::Request,+ request_id: crate::automation::DevToolsRequestId::from("REQ-bidi-request"),+ data_type: crate::automation::DevToolsNetworkDataType::Request,collector: None,disown: false,},@@ -833,9 +829,9 @@ async fn get_network_data_returns_bidi_response_body_bytes() {assert_eq!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::NetworkData(- crate::devtools_runtime::DevToolsNetworkDataResult {- bytes_type: crate::devtools_runtime::DevToolsNetworkDataBytesType::String,+ Ok(crate::automation::AutomationResult::NetworkData(+ crate::automation::DevToolsNetworkDataResult {+ bytes_type: crate::automation::DevToolsNetworkDataBytesType::String,value: "bidi request body".to_owned(),},))@@ -843,20 +839,16 @@ async fn get_network_data_returns_bidi_response_body_bytes() {let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {- context: crate::devtools_runtime::DevToolsCommandContext {- protocol: crate::devtools_runtime::DevToolsProtocol::WebDriverBidi,- session_id: Some(crate::devtools_runtime::DevToolsSessionId::from(- "bidi-session-1",- )),+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {+ context: crate::automation::AutomationContext {+ protocol: crate::automation::FrontendProtocol::WebDriverBidi,+ session_id: Some(crate::automation::DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,},- request_id: crate::devtools_runtime::DevToolsRequestId::from(- "REQ-bidi-request-binary",- ),- data_type: crate::devtools_runtime::DevToolsNetworkDataType::Request,+ request_id: crate::automation::DevToolsRequestId::from("REQ-bidi-request-binary"),+ data_type: crate::automation::DevToolsNetworkDataType::Request,collector: None,disown: false,},@@ -866,9 +858,9 @@ async fn get_network_data_returns_bidi_response_body_bytes() {assert_eq!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::NetworkData(- crate::devtools_runtime::DevToolsNetworkDataResult {- bytes_type: crate::devtools_runtime::DevToolsNetworkDataBytesType::Base64,+ Ok(crate::automation::AutomationResult::NetworkData(+ crate::automation::DevToolsNetworkDataResult {+ bytes_type: crate::automation::DevToolsNetworkDataBytesType::Base64,value: "AP9h".to_owned(),},))@@ -876,18 +868,16 @@ async fn get_network_data_returns_bidi_response_body_bytes() {let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {- context: crate::devtools_runtime::DevToolsCommandContext {- protocol: crate::devtools_runtime::DevToolsProtocol::WebDriverBidi,- session_id: Some(crate::devtools_runtime::DevToolsSessionId::from(- "bidi-session-1",- )),+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {+ context: crate::automation::AutomationContext {+ protocol: crate::automation::FrontendProtocol::WebDriverBidi,+ session_id: Some(crate::automation::DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,},- request_id: crate::devtools_runtime::DevToolsRequestId::from("REQ-bidi-binary"),- data_type: crate::devtools_runtime::DevToolsNetworkDataType::Response,+ request_id: crate::automation::DevToolsRequestId::from("REQ-bidi-binary"),+ data_type: crate::automation::DevToolsNetworkDataType::Response,collector: None,disown: false,},@@ -897,9 +887,9 @@ async fn get_network_data_returns_bidi_response_body_bytes() {assert_eq!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::NetworkData(- crate::devtools_runtime::DevToolsNetworkDataResult {- bytes_type: crate::devtools_runtime::DevToolsNetworkDataBytesType::Base64,+ Ok(crate::automation::AutomationResult::NetworkData(+ crate::automation::DevToolsNetworkDataResult {+ bytes_type: crate::automation::DevToolsNetworkDataBytesType::Base64,value: "AP8=".to_owned(),},))@@ -907,18 +897,16 @@ async fn get_network_data_returns_bidi_response_body_bytes() {let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {- context: crate::devtools_runtime::DevToolsCommandContext {- protocol: crate::devtools_runtime::DevToolsProtocol::WebDriverBidi,- session_id: Some(crate::devtools_runtime::DevToolsSessionId::from(- "bidi-session-1",- )),+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {+ context: crate::automation::AutomationContext {+ protocol: crate::automation::FrontendProtocol::WebDriverBidi,+ session_id: Some(crate::automation::DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,},- request_id: crate::devtools_runtime::DevToolsRequestId::from("REQ-bidi-primary"),- data_type: crate::devtools_runtime::DevToolsNetworkDataType::Response,+ request_id: crate::automation::DevToolsRequestId::from("REQ-bidi-primary"),+ data_type: crate::automation::DevToolsNetworkDataType::Response,collector: None,disown: false,},@@ -928,9 +916,9 @@ async fn get_network_data_returns_bidi_response_body_bytes() {assert_eq!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::NetworkData(- crate::devtools_runtime::DevToolsNetworkDataResult {- bytes_type: crate::devtools_runtime::DevToolsNetworkDataBytesType::String,+ Ok(crate::automation::AutomationResult::NetworkData(+ crate::automation::DevToolsNetworkDataResult {+ bytes_type: crate::automation::DevToolsNetworkDataBytesType::String,value: "primary body".to_owned(),},))@@ -938,18 +926,16 @@ async fn get_network_data_returns_bidi_response_body_bytes() {let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {- context: crate::devtools_runtime::DevToolsCommandContext {- protocol: crate::devtools_runtime::DevToolsProtocol::WebDriverBidi,- session_id: Some(crate::devtools_runtime::DevToolsSessionId::from(- "bidi-session-2",- )),+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {+ context: crate::automation::AutomationContext {+ protocol: crate::automation::FrontendProtocol::WebDriverBidi,+ session_id: Some(crate::automation::DevToolsSessionId::from("bidi-session-2")),target_id: None,browser_context_id: None,},- request_id: crate::devtools_runtime::DevToolsRequestId::from("REQ-bidi-text"),- data_type: crate::devtools_runtime::DevToolsNetworkDataType::Response,+ request_id: crate::automation::DevToolsRequestId::from("REQ-bidi-text"),+ data_type: crate::automation::DevToolsNetworkDataType::Response,collector: None,disown: false,},@@ -959,26 +945,24 @@ async fn get_network_data_returns_bidi_response_body_bytes() {assert_eq!(result,- Err(crate::devtools_runtime::DevToolsError::new(- crate::devtools_runtime::DevToolsErrorKind::NoSuchNetworkData,+ Err(crate::automation::DevToolsError::new(+ crate::automation::DevToolsErrorKind::NoSuchNetworkData,"no such network data",)));let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {- context: crate::devtools_runtime::DevToolsCommandContext {- protocol: crate::devtools_runtime::DevToolsProtocol::WebDriverBidi,- session_id: Some(crate::devtools_runtime::DevToolsSessionId::from(- "bidi-session-2",- )),+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {+ context: crate::automation::AutomationContext {+ protocol: crate::automation::FrontendProtocol::WebDriverBidi,+ session_id: Some(crate::automation::DevToolsSessionId::from("bidi-session-2")),target_id: None,browser_context_id: None,},- request_id: crate::devtools_runtime::DevToolsRequestId::from("REQ-bidi-request"),- data_type: crate::devtools_runtime::DevToolsNetworkDataType::Request,+ request_id: crate::automation::DevToolsRequestId::from("REQ-bidi-request"),+ data_type: crate::automation::DevToolsNetworkDataType::Request,collector: None,disown: false,},@@ -988,8 +972,8 @@ async fn get_network_data_returns_bidi_response_body_bytes() {assert_eq!(result,- Err(crate::devtools_runtime::DevToolsError::new(- crate::devtools_runtime::DevToolsErrorKind::NoSuchNetworkData,+ Err(crate::automation::DevToolsError::new(+ crate::automation::DevToolsErrorKind::NoSuchNetworkData,"no such network data",)));@@ -1015,16 +999,14 @@ async fn network_data_collectors_gate_get_data_disown_and_remove() {] {let (result, _) = ctx.conn- .execute_devtools_command(- crate::devtools_runtime::DevToolsCommand::AddNetworkDataCollector(- crate::devtools_runtime::DevToolsAddNetworkDataCollectorCommand {+ .execute_automation_command(+ crate::automation::AutomationCommand::AddNetworkDataCollector(+ crate::automation::DevToolsAddNetworkDataCollectorCommand {context: bidi_network_context("bidi-session-1"),- collector_id: crate::devtools_runtime::DevToolsNetworkDataCollectorId::from(+ collector_id: crate::automation::DevToolsNetworkDataCollectorId::from(collector,),- data_types: vec![- crate::devtools_runtime::DevToolsNetworkDataType::Response,- ],+ data_types: vec![crate::automation::DevToolsNetworkDataType::Response],max_encoded_data_size,target_ids: Vec::new(),browser_context_ids: Vec::new(),@@ -1036,9 +1018,9 @@ async fn network_data_collectors_gate_get_data_disown_and_remove() {assert_eq!(result,Ok(- crate::devtools_runtime::DevToolsCommandResult::AddNetworkDataCollector(- crate::devtools_runtime::DevToolsAddNetworkDataCollectorResult {- collector_id: crate::devtools_runtime::DevToolsNetworkDataCollectorId::from(+ crate::automation::AutomationResult::AddNetworkDataCollector(+ crate::automation::DevToolsAddNetworkDataCollectorResult {+ collector_id: crate::automation::DevToolsNetworkDataCollectorId::from(collector,),},@@ -1050,7 +1032,7 @@ async fn network_data_collectors_gate_get_data_disown_and_remove() {let body_text = "collector body";let collector_ids = ctx.conn.network_data_collector_ids_for_session_owner_body(Some("bidi-session-1"),- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,body_text.len(),);ctx.conn@@ -1066,16 +1048,14 @@ async fn network_data_collectors_gate_get_data_disown_and_remove() {let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {context: bidi_network_context("bidi-session-1"),- request_id: crate::devtools_runtime::DevToolsRequestId::from(- "REQ-before-collector",- ),- data_type: crate::devtools_runtime::DevToolsNetworkDataType::Response,- collector: Some(- crate::devtools_runtime::DevToolsNetworkDataCollectorId::from("collector-ok"),- ),+ request_id: crate::automation::DevToolsRequestId::from("REQ-before-collector"),+ data_type: crate::automation::DevToolsNetworkDataType::Response,+ collector: Some(crate::automation::DevToolsNetworkDataCollectorId::from(+ "collector-ok",+ )),disown: false,},))@@ -1083,22 +1063,22 @@ async fn network_data_collectors_gate_get_data_disown_and_remove() {.into_parts();assert_eq!(result,- Err(crate::devtools_runtime::DevToolsError::new(- crate::devtools_runtime::DevToolsErrorKind::NoSuchNetworkData,+ Err(crate::automation::DevToolsError::new(+ crate::automation::DevToolsErrorKind::NoSuchNetworkData,"no such network data",)));let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {context: bidi_network_context("bidi-session-1"),- request_id: crate::devtools_runtime::DevToolsRequestId::from("REQ-collected"),- data_type: crate::devtools_runtime::DevToolsNetworkDataType::Response,- collector: Some(- crate::devtools_runtime::DevToolsNetworkDataCollectorId::from("collector-ok"),- ),+ request_id: crate::automation::DevToolsRequestId::from("REQ-collected"),+ data_type: crate::automation::DevToolsNetworkDataType::Response,+ collector: Some(crate::automation::DevToolsNetworkDataCollectorId::from(+ "collector-ok",+ )),disown: false,},))@@ -1106,9 +1086,9 @@ async fn network_data_collectors_gate_get_data_disown_and_remove() {.into_parts();assert_eq!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::NetworkData(- crate::devtools_runtime::DevToolsNetworkDataResult {- bytes_type: crate::devtools_runtime::DevToolsNetworkDataBytesType::String,+ Ok(crate::automation::AutomationResult::NetworkData(+ crate::automation::DevToolsNetworkDataResult {+ bytes_type: crate::automation::DevToolsNetworkDataBytesType::String,value: "collector body".to_owned(),},))@@ -1116,16 +1096,14 @@ async fn network_data_collectors_gate_get_data_disown_and_remove() {let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {context: bidi_network_context("bidi-session-1"),- request_id: crate::devtools_runtime::DevToolsRequestId::from("REQ-collected"),- data_type: crate::devtools_runtime::DevToolsNetworkDataType::Response,- collector: Some(- crate::devtools_runtime::DevToolsNetworkDataCollectorId::from(- "collector-small",- ),- ),+ request_id: crate::automation::DevToolsRequestId::from("REQ-collected"),+ data_type: crate::automation::DevToolsNetworkDataType::Response,+ collector: Some(crate::automation::DevToolsNetworkDataCollectorId::from(+ "collector-small",+ )),disown: false,},))@@ -1133,43 +1111,38 @@ async fn network_data_collectors_gate_get_data_disown_and_remove() {.into_parts();assert_eq!(result,- Err(crate::devtools_runtime::DevToolsError::new(- crate::devtools_runtime::DevToolsErrorKind::NoSuchNetworkData,+ Err(crate::automation::DevToolsError::new(+ crate::automation::DevToolsErrorKind::NoSuchNetworkData,"no such network data",)));let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::DisownNetworkData(- crate::devtools_runtime::DevToolsDisownNetworkDataCommand {+ .execute_automation_command(crate::automation::AutomationCommand::DisownNetworkData(+ crate::automation::DevToolsDisownNetworkDataCommand {context: bidi_network_context("bidi-session-1"),- request_id: crate::devtools_runtime::DevToolsRequestId::from("REQ-collected"),- data_type: crate::devtools_runtime::DevToolsNetworkDataType::Response,- collector_id: crate::devtools_runtime::DevToolsNetworkDataCollectorId::from(+ request_id: crate::automation::DevToolsRequestId::from("REQ-collected"),+ data_type: crate::automation::DevToolsNetworkDataType::Response,+ collector_id: crate::automation::DevToolsNetworkDataCollectorId::from("collector-disown-command",),},)).await.into_parts();- assert_eq!(- result,- Ok(crate::devtools_runtime::DevToolsCommandResult::Empty)- );+ assert_eq!(result, Ok(crate::automation::AutomationResult::Empty));let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {context: bidi_network_context("bidi-session-1"),- request_id: crate::devtools_runtime::DevToolsRequestId::from("REQ-collected"),- data_type: crate::devtools_runtime::DevToolsNetworkDataType::Response,- collector: Some(- crate::devtools_runtime::DevToolsNetworkDataCollectorId::from(- "collector-disown-command",- ),- ),+ request_id: crate::automation::DevToolsRequestId::from("REQ-collected"),+ data_type: crate::automation::DevToolsNetworkDataType::Response,+ collector: Some(crate::automation::DevToolsNetworkDataCollectorId::from(+ "collector-disown-command",+ )),disown: false,},))@@ -1177,19 +1150,19 @@ async fn network_data_collectors_gate_get_data_disown_and_remove() {.into_parts();assert_eq!(result,- Err(crate::devtools_runtime::DevToolsError::new(- crate::devtools_runtime::DevToolsErrorKind::NoSuchNetworkData,+ Err(crate::automation::DevToolsError::new(+ crate::automation::DevToolsErrorKind::NoSuchNetworkData,"no such network data",)));let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {context: bidi_network_context("bidi-session-1"),- request_id: crate::devtools_runtime::DevToolsRequestId::from("REQ-collected"),- data_type: crate::devtools_runtime::DevToolsNetworkDataType::Response,+ request_id: crate::automation::DevToolsRequestId::from("REQ-collected"),+ data_type: crate::automation::DevToolsNetworkDataType::Response,collector: None,disown: false,},@@ -1198,21 +1171,19 @@ async fn network_data_collectors_gate_get_data_disown_and_remove() {.into_parts();assert!(matches!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::NetworkData(- _- ))+ Ok(crate::automation::AutomationResult::NetworkData(_))));let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {context: bidi_network_context("bidi-session-1"),- request_id: crate::devtools_runtime::DevToolsRequestId::from("REQ-collected"),- data_type: crate::devtools_runtime::DevToolsNetworkDataType::Response,- collector: Some(- crate::devtools_runtime::DevToolsNetworkDataCollectorId::from("collector-ok"),- ),+ request_id: crate::automation::DevToolsRequestId::from("REQ-collected"),+ data_type: crate::automation::DevToolsNetworkDataType::Response,+ collector: Some(crate::automation::DevToolsNetworkDataCollectorId::from(+ "collector-ok",+ )),disown: true,},))@@ -1220,21 +1191,19 @@ async fn network_data_collectors_gate_get_data_disown_and_remove() {.into_parts();assert!(matches!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::NetworkData(- _- ))+ Ok(crate::automation::AutomationResult::NetworkData(_))));let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {context: bidi_network_context("bidi-session-1"),- request_id: crate::devtools_runtime::DevToolsRequestId::from("REQ-collected"),- data_type: crate::devtools_runtime::DevToolsNetworkDataType::Response,- collector: Some(- crate::devtools_runtime::DevToolsNetworkDataCollectorId::from("collector-ok"),- ),+ request_id: crate::automation::DevToolsRequestId::from("REQ-collected"),+ data_type: crate::automation::DevToolsNetworkDataType::Response,+ collector: Some(crate::automation::DevToolsNetworkDataCollectorId::from(+ "collector-ok",+ )),disown: false,},))@@ -1242,19 +1211,19 @@ async fn network_data_collectors_gate_get_data_disown_and_remove() {.into_parts();assert_eq!(result,- Err(crate::devtools_runtime::DevToolsError::new(- crate::devtools_runtime::DevToolsErrorKind::NoSuchNetworkData,+ Err(crate::automation::DevToolsError::new(+ crate::automation::DevToolsErrorKind::NoSuchNetworkData,"no such network data",)));let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {context: bidi_network_context("bidi-session-1"),- request_id: crate::devtools_runtime::DevToolsRequestId::from("REQ-collected"),- data_type: crate::devtools_runtime::DevToolsNetworkDataType::Response,+ request_id: crate::automation::DevToolsRequestId::from("REQ-collected"),+ data_type: crate::automation::DevToolsNetworkDataType::Response,collector: None,disown: false,},@@ -1263,19 +1232,19 @@ async fn network_data_collectors_gate_get_data_disown_and_remove() {.into_parts();assert_eq!(result,- Err(crate::devtools_runtime::DevToolsError::new(- crate::devtools_runtime::DevToolsErrorKind::NoSuchNetworkData,+ Err(crate::automation::DevToolsError::new(+ crate::automation::DevToolsErrorKind::NoSuchNetworkData,"no such network data",)));let (result, _) = ctx.conn- .execute_devtools_command(- crate::devtools_runtime::DevToolsCommand::RemoveNetworkDataCollector(- crate::devtools_runtime::DevToolsRemoveNetworkDataCollectorCommand {+ .execute_automation_command(+ crate::automation::AutomationCommand::RemoveNetworkDataCollector(+ crate::automation::DevToolsRemoveNetworkDataCollectorCommand {context: bidi_network_context("bidi-session-1"),- collector_id: crate::devtools_runtime::DevToolsNetworkDataCollectorId::from(+ collector_id: crate::automation::DevToolsNetworkDataCollectorId::from("collector-small",),},@@ -1283,18 +1252,15 @@ async fn network_data_collectors_gate_get_data_disown_and_remove() {).await.into_parts();- assert_eq!(- result,- Ok(crate::devtools_runtime::DevToolsCommandResult::Empty)- );+ assert_eq!(result, Ok(crate::automation::AutomationResult::Empty));let (result, _) = ctx.conn- .execute_devtools_command(- crate::devtools_runtime::DevToolsCommand::RemoveNetworkDataCollector(- crate::devtools_runtime::DevToolsRemoveNetworkDataCollectorCommand {+ .execute_automation_command(+ crate::automation::AutomationCommand::RemoveNetworkDataCollector(+ crate::automation::DevToolsRemoveNetworkDataCollectorCommand {context: bidi_network_context("bidi-session-1"),- collector_id: crate::devtools_runtime::DevToolsNetworkDataCollectorId::from(+ collector_id: crate::automation::DevToolsNetworkDataCollectorId::from("collector-small",),},@@ -1304,8 +1270,8 @@ async fn network_data_collectors_gate_get_data_disown_and_remove() {.into_parts();assert_eq!(result,- Err(crate::devtools_runtime::DevToolsError::new(- crate::devtools_runtime::DevToolsErrorKind::NoSuchNetworkCollector,+ Err(crate::automation::DevToolsError::new(+ crate::automation::DevToolsErrorKind::NoSuchNetworkCollector,"no such network collector",)));@@ -1319,16 +1285,15 @@ async fn network_data_collector_body_persists_after_target_artifact_cleanup() {bc.attach_active_session("bidi-session-1".to_owned());ctx.conn.install_browser_context_fixture_for_test(bc);- let collector_id =- crate::devtools_runtime::DevToolsNetworkDataCollectorId::from("collector-persist");+ let collector_id = crate::automation::DevToolsNetworkDataCollectorId::from("collector-persist");let (result, _) = ctx.conn- .execute_devtools_command(- crate::devtools_runtime::DevToolsCommand::AddNetworkDataCollector(- crate::devtools_runtime::DevToolsAddNetworkDataCollectorCommand {+ .execute_automation_command(+ crate::automation::AutomationCommand::AddNetworkDataCollector(+ crate::automation::DevToolsAddNetworkDataCollectorCommand {context: bidi_network_context("bidi-session-1"),collector_id: collector_id.clone(),- data_types: vec![crate::devtools_runtime::DevToolsNetworkDataType::Response],+ data_types: vec![crate::automation::DevToolsNetworkDataType::Response],max_encoded_data_size: 1000,target_ids: Vec::new(),browser_context_ids: Vec::new(),@@ -1339,11 +1304,11 @@ async fn network_data_collector_body_persists_after_target_artifact_cleanup() {.into_parts();assert!(matches!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::AddNetworkDataCollector(_))+ Ok(crate::automation::AutomationResult::AddNetworkDataCollector(_))));let request_id = "REQ-persist";- let data_type = crate::devtools_runtime::DevToolsNetworkDataType::Response;+ let data_type = crate::automation::DevToolsNetworkDataType::Response;let body = CapturedBody::from_string("persistent collector body".to_owned());let collector_ids = ctx.conn.network_data_collector_ids_for_session_owner_body(Some("bidi-session-1"),@@ -1370,14 +1335,14 @@ async fn network_data_collector_body_persists_after_target_artifact_cleanup() {fn get_collected_command(request_id: &str,- data_type: crate::devtools_runtime::DevToolsNetworkDataType,- collector_id: crate::devtools_runtime::DevToolsNetworkDataCollectorId,+ data_type: crate::automation::DevToolsNetworkDataType,+ collector_id: crate::automation::DevToolsNetworkDataCollectorId,disown: bool,- ) -> crate::devtools_runtime::DevToolsCommand {- crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {+ ) -> crate::automation::AutomationCommand {+ crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {context: bidi_network_context("bidi-session-1"),- request_id: crate::devtools_runtime::DevToolsRequestId::from(request_id),+ request_id: crate::automation::DevToolsRequestId::from(request_id),data_type,collector: Some(collector_id),disown,@@ -1387,7 +1352,7 @@ async fn network_data_collector_body_persists_after_target_artifact_cleanup() {let (result, _) = ctx.conn- .execute_devtools_command(get_collected_command(+ .execute_automation_command(get_collected_command(request_id,data_type,collector_id.clone(),@@ -1397,9 +1362,9 @@ async fn network_data_collector_body_persists_after_target_artifact_cleanup() {.into_parts();assert_eq!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::NetworkData(- crate::devtools_runtime::DevToolsNetworkDataResult {- bytes_type: crate::devtools_runtime::DevToolsNetworkDataBytesType::String,+ Ok(crate::automation::AutomationResult::NetworkData(+ crate::automation::DevToolsNetworkDataResult {+ bytes_type: crate::automation::DevToolsNetworkDataBytesType::String,value: "persistent collector body".to_owned(),},))@@ -1412,7 +1377,7 @@ async fn network_data_collector_body_persists_after_target_artifact_cleanup() {let (result, _) = ctx.conn- .execute_devtools_command(get_collected_command(+ .execute_automation_command(get_collected_command(request_id,data_type,collector_id.clone(),@@ -1422,9 +1387,9 @@ async fn network_data_collector_body_persists_after_target_artifact_cleanup() {.into_parts();assert_eq!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::NetworkData(- crate::devtools_runtime::DevToolsNetworkDataResult {- bytes_type: crate::devtools_runtime::DevToolsNetworkDataBytesType::String,+ Ok(crate::automation::AutomationResult::NetworkData(+ crate::automation::DevToolsNetworkDataResult {+ bytes_type: crate::automation::DevToolsNetworkDataBytesType::String,value: "persistent collector body".to_owned(),},))@@ -1432,7 +1397,7 @@ async fn network_data_collector_body_persists_after_target_artifact_cleanup() {let (result, _) = ctx.conn- .execute_devtools_command(get_collected_command(+ .execute_automation_command(get_collected_command(request_id,data_type,collector_id.clone(),@@ -1442,14 +1407,12 @@ async fn network_data_collector_body_persists_after_target_artifact_cleanup() {.into_parts();assert!(matches!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::NetworkData(- _- ))+ Ok(crate::automation::AutomationResult::NetworkData(_))));let (result, _) = ctx.conn- .execute_devtools_command(get_collected_command(+ .execute_automation_command(get_collected_command(request_id,data_type,collector_id,@@ -1459,8 +1422,8 @@ async fn network_data_collector_body_persists_after_target_artifact_cleanup() {.into_parts();assert_eq!(result,- Err(crate::devtools_runtime::DevToolsError::new(- crate::devtools_runtime::DevToolsErrorKind::NoSuchNetworkData,+ Err(crate::automation::DevToolsError::new(+ crate::automation::DevToolsErrorKind::NoSuchNetworkData,"no such network data",)));@@ -1474,14 +1437,13 @@ async fn network_data_explicit_collector_prefers_collected_body_over_stale_targebc.attach_active_session("bidi-session-1".to_owned());ctx.conn.install_browser_context_fixture_for_test(bc);- let collector_id =- crate::devtools_runtime::DevToolsNetworkDataCollectorId::from("collector-shadow");- let data_type = crate::devtools_runtime::DevToolsNetworkDataType::Response;+ let collector_id = crate::automation::DevToolsNetworkDataCollectorId::from("collector-shadow");+ let data_type = crate::automation::DevToolsNetworkDataType::Response;let (result, _) = ctx.conn- .execute_devtools_command(- crate::devtools_runtime::DevToolsCommand::AddNetworkDataCollector(- crate::devtools_runtime::DevToolsAddNetworkDataCollectorCommand {+ .execute_automation_command(+ crate::automation::AutomationCommand::AddNetworkDataCollector(+ crate::automation::DevToolsAddNetworkDataCollectorCommand {context: bidi_network_context("bidi-session-1"),collector_id: collector_id.clone(),data_types: vec![data_type],@@ -1495,7 +1457,7 @@ async fn network_data_explicit_collector_prefers_collected_body_over_stale_targe.into_parts();assert!(matches!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::AddNetworkDataCollector(_))+ Ok(crate::automation::AutomationResult::AddNetworkDataCollector(_))));let request_id = "REQ-shadow";@@ -1526,10 +1488,10 @@ async fn network_data_explicit_collector_prefers_collected_body_over_stale_targelet (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {context: bidi_network_context("bidi-session-1"),- request_id: crate::devtools_runtime::DevToolsRequestId::from(request_id),+ request_id: crate::automation::DevToolsRequestId::from(request_id),data_type,collector: Some(collector_id),disown: false,@@ -1539,9 +1501,9 @@ async fn network_data_explicit_collector_prefers_collected_body_over_stale_targe.into_parts();assert_eq!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::NetworkData(- crate::devtools_runtime::DevToolsNetworkDataResult {- bytes_type: crate::devtools_runtime::DevToolsNetworkDataBytesType::String,+ Ok(crate::automation::AutomationResult::NetworkData(+ crate::automation::DevToolsNetworkDataResult {+ bytes_type: crate::automation::DevToolsNetworkDataBytesType::String,value: "collector-owned body".to_owned(),},))@@ -1557,15 +1519,15 @@ async fn network_data_explicit_collector_rejects_unconfigured_data_type() {ctx.conn.install_browser_context_fixture_for_test(bc);let collector_id =- crate::devtools_runtime::DevToolsNetworkDataCollectorId::from("collector-request-only");+ crate::automation::DevToolsNetworkDataCollectorId::from("collector-request-only");let (result, _) = ctx.conn- .execute_devtools_command(- crate::devtools_runtime::DevToolsCommand::AddNetworkDataCollector(- crate::devtools_runtime::DevToolsAddNetworkDataCollectorCommand {+ .execute_automation_command(+ crate::automation::AutomationCommand::AddNetworkDataCollector(+ crate::automation::DevToolsAddNetworkDataCollectorCommand {context: bidi_network_context("bidi-session-1"),collector_id: collector_id.clone(),- data_types: vec![crate::devtools_runtime::DevToolsNetworkDataType::Request],+ data_types: vec![crate::automation::DevToolsNetworkDataType::Request],max_encoded_data_size: 1000,target_ids: Vec::new(),browser_context_ids: Vec::new(),@@ -1576,7 +1538,7 @@ async fn network_data_explicit_collector_rejects_unconfigured_data_type() {.into_parts();assert!(matches!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::AddNetworkDataCollector(_))+ Ok(crate::automation::AutomationResult::AddNetworkDataCollector(_))));ctx.conn@@ -1592,11 +1554,11 @@ async fn network_data_explicit_collector_rejects_unconfigured_data_type() {let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {context: bidi_network_context("bidi-session-1"),- request_id: crate::devtools_runtime::DevToolsRequestId::from("REQ-type-mismatch"),- data_type: crate::devtools_runtime::DevToolsNetworkDataType::Response,+ request_id: crate::automation::DevToolsRequestId::from("REQ-type-mismatch"),+ data_type: crate::automation::DevToolsNetworkDataType::Response,collector: Some(collector_id),disown: false,},@@ -1605,8 +1567,8 @@ async fn network_data_explicit_collector_rejects_unconfigured_data_type() {.into_parts();assert_eq!(result,- Err(crate::devtools_runtime::DevToolsError::new(- crate::devtools_runtime::DevToolsErrorKind::NoSuchNetworkData,+ Err(crate::automation::DevToolsError::new(+ crate::automation::DevToolsErrorKind::NoSuchNetworkData,"no such network data",)));@@ -1622,14 +1584,14 @@ async fn network_data_without_collector_requires_matching_collected_data_type()let (result, _) = ctx.conn- .execute_devtools_command(- crate::devtools_runtime::DevToolsCommand::AddNetworkDataCollector(- crate::devtools_runtime::DevToolsAddNetworkDataCollectorCommand {+ .execute_automation_command(+ crate::automation::AutomationCommand::AddNetworkDataCollector(+ crate::automation::DevToolsAddNetworkDataCollectorCommand {context: bidi_network_context("bidi-session-1"),- collector_id: crate::devtools_runtime::DevToolsNetworkDataCollectorId::from(+ collector_id: crate::automation::DevToolsNetworkDataCollectorId::from("collector-request-only",),- data_types: vec![crate::devtools_runtime::DevToolsNetworkDataType::Request],+ data_types: vec![crate::automation::DevToolsNetworkDataType::Request],max_encoded_data_size: 1000,target_ids: Vec::new(),browser_context_ids: Vec::new(),@@ -1640,10 +1602,10 @@ async fn network_data_without_collector_requires_matching_collected_data_type().into_parts();assert!(matches!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::AddNetworkDataCollector(_))+ Ok(crate::automation::AutomationResult::AddNetworkDataCollector(_))));- let data_type = crate::devtools_runtime::DevToolsNetworkDataType::Response;+ let data_type = crate::automation::DevToolsNetworkDataType::Response;assert!(!ctx.conn.network_data_collection_is_gated_for_body(data_type),@@ -1662,10 +1624,10 @@ async fn network_data_without_collector_requires_matching_collected_data_type()let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {context: bidi_network_context("bidi-session-1"),- request_id: crate::devtools_runtime::DevToolsRequestId::from(+ request_id: crate::automation::DevToolsRequestId::from("REQ-response-not-collected",),data_type,@@ -1677,8 +1639,8 @@ async fn network_data_without_collector_requires_matching_collected_data_type().into_parts();assert_eq!(result,- Err(crate::devtools_runtime::DevToolsError::new(- crate::devtools_runtime::DevToolsErrorKind::NoSuchNetworkData,+ Err(crate::automation::DevToolsError::new(+ crate::automation::DevToolsErrorKind::NoSuchNetworkData,"no such network data",)));@@ -1703,20 +1665,16 @@ async fn network_data_collector_membership_uses_recorded_target_scope() {] {let (result, _) = ctx.conn- .execute_devtools_command(- crate::devtools_runtime::DevToolsCommand::AddNetworkDataCollector(- crate::devtools_runtime::DevToolsAddNetworkDataCollectorCommand {+ .execute_automation_command(+ crate::automation::AutomationCommand::AddNetworkDataCollector(+ crate::automation::DevToolsAddNetworkDataCollectorCommand {context: bidi_network_context("bidi-session-1"),- collector_id: crate::devtools_runtime::DevToolsNetworkDataCollectorId::from(+ collector_id: crate::automation::DevToolsNetworkDataCollectorId::from(collector,),- data_types: vec![- crate::devtools_runtime::DevToolsNetworkDataType::Response,- ],+ data_types: vec![crate::automation::DevToolsNetworkDataType::Response],max_encoded_data_size: 1000,- target_ids: vec![crate::devtools_runtime::DevToolsTargetId::from(- target_id,- )],+ target_ids: vec![crate::automation::DevToolsTargetId::from(target_id)],browser_context_ids: Vec::new(),},),@@ -1726,9 +1684,9 @@ async fn network_data_collector_membership_uses_recorded_target_scope() {assert_eq!(result,Ok(- crate::devtools_runtime::DevToolsCommandResult::AddNetworkDataCollector(- crate::devtools_runtime::DevToolsAddNetworkDataCollectorResult {- collector_id: crate::devtools_runtime::DevToolsNetworkDataCollectorId::from(+ crate::automation::AutomationResult::AddNetworkDataCollector(+ crate::automation::DevToolsAddNetworkDataCollectorResult {+ collector_id: crate::automation::DevToolsNetworkDataCollectorId::from(collector,),},@@ -1740,7 +1698,7 @@ async fn network_data_collector_membership_uses_recorded_target_scope() {let body_text = "scoped body";let collector_ids = ctx.conn.network_data_collector_ids_for_session_owner_body(Some("bidi-session-1"),- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,body_text.len(),);ctx.conn@@ -1756,16 +1714,14 @@ async fn network_data_collector_membership_uses_recorded_target_scope() {let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {context: bidi_network_context("bidi-session-1"),- request_id: crate::devtools_runtime::DevToolsRequestId::from("REQ-scoped"),- data_type: crate::devtools_runtime::DevToolsNetworkDataType::Response,- collector: Some(- crate::devtools_runtime::DevToolsNetworkDataCollectorId::from(- "collector-active",- ),- ),+ request_id: crate::automation::DevToolsRequestId::from("REQ-scoped"),+ data_type: crate::automation::DevToolsNetworkDataType::Response,+ collector: Some(crate::automation::DevToolsNetworkDataCollectorId::from(+ "collector-active",+ )),disown: false,},))@@ -1773,9 +1729,9 @@ async fn network_data_collector_membership_uses_recorded_target_scope() {.into_parts();assert_eq!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::NetworkData(- crate::devtools_runtime::DevToolsNetworkDataResult {- bytes_type: crate::devtools_runtime::DevToolsNetworkDataBytesType::String,+ Ok(crate::automation::AutomationResult::NetworkData(+ crate::automation::DevToolsNetworkDataResult {+ bytes_type: crate::automation::DevToolsNetworkDataBytesType::String,value: body_text.to_owned(),},))@@ -1783,16 +1739,14 @@ async fn network_data_collector_membership_uses_recorded_target_scope() {let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {context: bidi_network_context("bidi-session-1"),- request_id: crate::devtools_runtime::DevToolsRequestId::from("REQ-scoped"),- data_type: crate::devtools_runtime::DevToolsNetworkDataType::Response,- collector: Some(- crate::devtools_runtime::DevToolsNetworkDataCollectorId::from(- "collector-other",- ),- ),+ request_id: crate::automation::DevToolsRequestId::from("REQ-scoped"),+ data_type: crate::automation::DevToolsNetworkDataType::Response,+ collector: Some(crate::automation::DevToolsNetworkDataCollectorId::from(+ "collector-other",+ )),disown: false,},))@@ -1800,8 +1754,8 @@ async fn network_data_collector_membership_uses_recorded_target_scope() {.into_parts();assert_eq!(result,- Err(crate::devtools_runtime::DevToolsError::new(- crate::devtools_runtime::DevToolsErrorKind::NoSuchNetworkData,+ Err(crate::automation::DevToolsError::new(+ crate::automation::DevToolsErrorKind::NoSuchNetworkData,"no such network data",)));@@ -1822,16 +1776,16 @@ async fn network_data_collector_gated_body_without_match_is_not_readable() {let (result, _) = ctx.conn- .execute_devtools_command(- crate::devtools_runtime::DevToolsCommand::AddNetworkDataCollector(- crate::devtools_runtime::DevToolsAddNetworkDataCollectorCommand {+ .execute_automation_command(+ crate::automation::AutomationCommand::AddNetworkDataCollector(+ crate::automation::DevToolsAddNetworkDataCollectorCommand {context: bidi_network_context("bidi-session-1"),- collector_id: crate::devtools_runtime::DevToolsNetworkDataCollectorId::from(+ collector_id: crate::automation::DevToolsNetworkDataCollectorId::from("collector-other",),- data_types: vec![crate::devtools_runtime::DevToolsNetworkDataType::Response],+ data_types: vec![crate::automation::DevToolsNetworkDataType::Response],max_encoded_data_size: 1000,- target_ids: vec![crate::devtools_runtime::DevToolsTargetId::from("TID-other")],+ target_ids: vec![crate::automation::DevToolsTargetId::from("TID-other")],browser_context_ids: Vec::new(),},),@@ -1840,11 +1794,11 @@ async fn network_data_collector_gated_body_without_match_is_not_readable() {.into_parts();assert!(matches!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::AddNetworkDataCollector(_))+ Ok(crate::automation::AutomationResult::AddNetworkDataCollector(_))));let body_text = "active body";- let data_type = crate::devtools_runtime::DevToolsNetworkDataType::Response;+ let data_type = crate::automation::DevToolsNetworkDataType::Response;let collection_was_gated = ctx.conn.network_data_collection_is_gated_for_body(data_type);@@ -1872,10 +1826,10 @@ async fn network_data_collector_gated_body_without_match_is_not_readable() {let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {context: bidi_network_context("bidi-session-1"),- request_id: crate::devtools_runtime::DevToolsRequestId::from("REQ-unmatched"),+ request_id: crate::automation::DevToolsRequestId::from("REQ-unmatched"),data_type,collector: None,disown: false,@@ -1885,8 +1839,8 @@ async fn network_data_collector_gated_body_without_match_is_not_readable() {.into_parts();assert_eq!(result,- Err(crate::devtools_runtime::DevToolsError::new(- crate::devtools_runtime::DevToolsErrorKind::NoSuchNetworkData,+ Err(crate::automation::DevToolsError::new(+ crate::automation::DevToolsErrorKind::NoSuchNetworkData,"no such network data",)));@@ -1902,45 +1856,45 @@ async fn get_network_data_reports_unimplemented_or_missing_data_with_bidi_errorsfor (request_id, data_type, collector, expected_kind) in [("REQ-pending",- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,None,- crate::devtools_runtime::DevToolsErrorKind::NoSuchNetworkData,+ crate::automation::DevToolsErrorKind::NoSuchNetworkData,),("REQ-missing",- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,None,- crate::devtools_runtime::DevToolsErrorKind::NoSuchNetworkData,+ crate::automation::DevToolsErrorKind::NoSuchNetworkData,),("REQ-pending",- crate::devtools_runtime::DevToolsNetworkDataType::Request,+ crate::automation::DevToolsNetworkDataType::Request,None,- crate::devtools_runtime::DevToolsErrorKind::NoSuchNetworkData,+ crate::automation::DevToolsErrorKind::NoSuchNetworkData,),("REQ-pending",- crate::devtools_runtime::DevToolsNetworkDataType::Response,+ crate::automation::DevToolsNetworkDataType::Response,Some("collector-1"),- crate::devtools_runtime::DevToolsErrorKind::NoSuchNetworkCollector,+ crate::automation::DevToolsErrorKind::NoSuchNetworkCollector,),] {let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {- context: crate::devtools_runtime::DevToolsCommandContext {- protocol: crate::devtools_runtime::DevToolsProtocol::WebDriverBidi,- session_id: Some(crate::devtools_runtime::DevToolsSessionId::from(+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {+ context: crate::automation::AutomationContext {+ protocol: crate::automation::FrontendProtocol::WebDriverBidi,+ session_id: Some(crate::automation::DevToolsSessionId::from("bidi-session-1",)),target_id: None,browser_context_id: None,},- request_id: crate::devtools_runtime::DevToolsRequestId::from(request_id),+ request_id: crate::automation::DevToolsRequestId::from(request_id),data_type,collector: collector- .map(crate::devtools_runtime::DevToolsNetworkDataCollectorId::from),+ .map(crate::automation::DevToolsNetworkDataCollectorId::from),disown: false,},))@@ -2217,14 +2171,14 @@ fetch("/upload", {method: "POST", body: formData})let (result, _) = ctx.conn- .execute_devtools_command(- crate::devtools_runtime::DevToolsCommand::AddNetworkDataCollector(- crate::devtools_runtime::DevToolsAddNetworkDataCollectorCommand {+ .execute_automation_command(+ crate::automation::AutomationCommand::AddNetworkDataCollector(+ crate::automation::DevToolsAddNetworkDataCollectorCommand {context: bidi_network_context("SID-1"),- collector_id: crate::devtools_runtime::DevToolsNetworkDataCollectorId::from(+ collector_id: crate::automation::DevToolsNetworkDataCollectorId::from("collector-request-body",),- data_types: vec![crate::devtools_runtime::DevToolsNetworkDataType::Request],+ data_types: vec![crate::automation::DevToolsNetworkDataType::Request],max_encoded_data_size: 4096,target_ids: Vec::new(),browser_context_ids: Vec::new(),@@ -2235,7 +2189,7 @@ fetch("/upload", {method: "POST", body: formData}).into_parts();assert!(matches!(result,- Ok(crate::devtools_runtime::DevToolsCommandResult::AddNetworkDataCollector(_))+ Ok(crate::automation::AutomationResult::AddNetworkDataCollector(_))));ctx.process_async(json!({@@ -2273,16 +2227,14 @@ fetch("/upload", {method: "POST", body: formData})let (result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetNetworkData(- crate::devtools_runtime::DevToolsGetNetworkDataCommand {+ .execute_automation_command(crate::automation::AutomationCommand::GetNetworkData(+ crate::automation::DevToolsGetNetworkDataCommand {context: bidi_network_context("SID-1"),- request_id: crate::devtools_runtime::DevToolsRequestId::from(request_id),- data_type: crate::devtools_runtime::DevToolsNetworkDataType::Request,- collector: Some(- crate::devtools_runtime::DevToolsNetworkDataCollectorId::from(- "collector-request-body",- ),- ),+ request_id: crate::automation::DevToolsRequestId::from(request_id),+ data_type: crate::automation::DevToolsNetworkDataType::Request,+ collector: Some(crate::automation::DevToolsNetworkDataCollectorId::from(+ "collector-request-body",+ )),disown: false,},))@@ -2290,12 +2242,12 @@ fetch("/upload", {method: "POST", body: formData}).into_parts();let result = result.expect("multipart request body should be collected");- let crate::devtools_runtime::DevToolsCommandResult::NetworkData(data) = result else {+ let crate::automation::AutomationResult::NetworkData(data) = result else {panic!("expected network data result");};assert_eq!(data.bytes_type,- crate::devtools_runtime::DevToolsNetworkDataBytesType::Base64+ crate::automation::DevToolsNetworkDataBytesType::Base64);let decoded = BASE64_STANDARD.decode(data.value)diff --git a/moli-protocol/src/domains/observable_output/emission.rs b/moli-protocol/src/domains/observable_output/emission.rsindex d302ffcc0..1809a711f 100644--- a/moli-protocol/src/domains/observable_output/emission.rs+++ b/moli-protocol/src/domains/observable_output/emission.rs@@ -8,8 +8,8 @@ use super::output_queue::{ObservableSessionAuditsPreparedRange,};use super::runtime_emission::mark_runtime_observable_emission_cursor_for_session_owner;+use crate::automation::DevToolsTargetId;use crate::conn::{BackgroundProtocolEvent, CdpConnection, monotonic_timestamp_seconds};-use crate::devtools_runtime::DevToolsTargetId;use crate::domains::activity::{ProtocolOutputPayloads, ProtocolOutputProjectionContext, ProtocolOutputSlot,};diff --git a/moli-protocol/src/domains/observable_output/items.rs b/moli-protocol/src/domains/observable_output/items.rsindex 5fe676aa9..5567def0e 100644--- a/moli-protocol/src/domains/observable_output/items.rs+++ b/moli-protocol/src/domains/observable_output/items.rs@@ -1,6 +1,6 @@use std::collections::HashMap;-use crate::devtools_runtime::{+use crate::automation::{DevToolsScriptException, DevToolsStackCallFrame, DevToolsStackTrace, DevToolsTargetId,LogEntryEvent, RuntimeConsoleEvent, ScriptExceptionEvent,};@@ -605,8 +605,8 @@ fn parse_stack_location(location: &str) -> Option<(&str, u64, u64)> {#[cfg(test)]mod tests {+ use crate::automation::AutomationEvent;use crate::conn::BackgroundProtocolEvent;- use crate::devtools_runtime::AutomationEvent;use serde_json::json;use super::ObservableOutputItem;@@ -767,7 +767,7 @@ Error: Console#[test]fn runtime_console_background_event_preserves_sidecar_and_message() {- let target_id = crate::devtools_runtime::DevToolsTargetId::from("TID-1");+ let target_id = crate::automation::DevToolsTargetId::from("TID-1");let event = super::runtime_console_api_called_background_event(Some("SID-1"),Some(&target_id),@@ -808,7 +808,7 @@ Error: Console#[test]fn runtime_exception_background_event_preserves_sidecar_and_message() {- let target_id = crate::devtools_runtime::DevToolsTargetId::from("TID-1");+ let target_id = crate::automation::DevToolsTargetId::from("TID-1");let event = super::runtime_exception_thrown_background_event(Some("SID-1"),Some(&target_id),diff --git a/moli-protocol/src/domains/page.rs b/moli-protocol/src/domains/page.rsindex 7ef9cc938..67f53b4e5 100644--- a/moli-protocol/src/domains/page.rs+++ b/moli-protocol/src/domains/page.rs@@ -1,14 +1,13 @@-use crate::devtools_runtime::{- DevToolsAddPreloadScriptCommand, DevToolsCaptureScreenshotClip,- DevToolsCaptureScreenshotCommand, DevToolsCaptureScreenshotResult, DevToolsCommand,- DevToolsCommandContext, DevToolsCommandResult, DevToolsError, DevToolsErrorKind,- DevToolsGetFrameTreeCommand, DevToolsGetFrameTreeResult, DevToolsGetFrameTreesCommand,- DevToolsGetFrameTreesResult, DevToolsGetJavaScriptDialogCommand,- DevToolsGetLayoutMetricsCommand, DevToolsHandleJavaScriptDialogCommand,- DevToolsJavaScriptDialogResult, DevToolsLayoutMetricsResult, DevToolsPrintToPdfCommand,- DevToolsPrintToPdfTransferMode, DevToolsProtocol, DevToolsScreenshotClip,- DevToolsSetJavaScriptDialogPromptTextCommand, DevToolsTargetInfo, DevToolsTargetKind,- UserPromptClosedEvent,+use crate::automation::{+ AutomationCommand, AutomationContext, AutomationResult, DevToolsAddPreloadScriptCommand,+ DevToolsCaptureScreenshotClip, DevToolsCaptureScreenshotCommand,+ DevToolsCaptureScreenshotResult, DevToolsError, DevToolsErrorKind, DevToolsGetFrameTreeCommand,+ DevToolsGetFrameTreeResult, DevToolsGetFrameTreesCommand, DevToolsGetFrameTreesResult,+ DevToolsGetJavaScriptDialogCommand, DevToolsGetLayoutMetricsCommand,+ DevToolsHandleJavaScriptDialogCommand, DevToolsJavaScriptDialogResult,+ DevToolsLayoutMetricsResult, DevToolsPrintToPdfCommand, DevToolsPrintToPdfTransferMode,+ DevToolsScreenshotClip, DevToolsSetJavaScriptDialogPromptTextCommand, DevToolsTargetInfo,+ DevToolsTargetKind, FrontendProtocol, UserPromptClosedEvent,};use base64::{Engine as _, engine::general_purpose::STANDARD as BASE64_STANDARD};use chromiumoxide_cdp::cdp::browser_protocol::page::{@@ -1614,61 +1613,61 @@ fn page_set_download_behavior_command_output_plan(pub(crate) async fn execute_devtools_page_command_async_with_protocol_events(conn: &mut CdpConnection,- command: DevToolsCommand,+ command: AutomationCommand,background_command_id: Option<u64>,) -> (- Result<DevToolsCommandResult, DevToolsError>,+ Result<AutomationResult, DevToolsError>,Vec<crate::conn::BackgroundProtocolEvent>,Option<moli_core::RendererOutputFence>,) {match command {- DevToolsCommand::GetFrameTree(command) => (+ AutomationCommand::GetFrameTree(command) => (execute_devtools_get_frame_tree_command_async(conn, command).await,Vec::new(),None,),- DevToolsCommand::GetFrameTrees(command) => (+ AutomationCommand::GetFrameTrees(command) => (execute_devtools_get_frame_trees_command_async(conn, command).await,Vec::new(),None,),- DevToolsCommand::GetNavigationHistory(command) => (+ AutomationCommand::GetNavigationHistory(command) => (navigation::execute_devtools_get_navigation_history_command(conn, command),Vec::new(),None,),- DevToolsCommand::GetLayoutMetrics(command) => (+ AutomationCommand::GetLayoutMetrics(command) => (execute_devtools_get_layout_metrics_command(conn, command).await,Vec::new(),None,),- DevToolsCommand::GetJavaScriptDialog(command) => (+ AutomationCommand::GetJavaScriptDialog(command) => (execute_devtools_get_javascript_dialog_command(conn, command),Vec::new(),None,),- DevToolsCommand::SetJavaScriptDialogPromptText(command) => (+ AutomationCommand::SetJavaScriptDialogPromptText(command) => (execute_devtools_set_javascript_dialog_prompt_text_command(conn, command),Vec::new(),None,),- DevToolsCommand::HandleJavaScriptDialog(command) => {+ AutomationCommand::HandleJavaScriptDialog(command) => {let (result, events) = execute_devtools_handle_javascript_dialog_command(conn, command);(result, events, None)}- DevToolsCommand::CaptureScreenshot(command) => {+ AutomationCommand::CaptureScreenshot(command) => {let (result, predecessor) =execute_devtools_capture_screenshot_command(conn, command).await;(result, Vec::new(), predecessor)}- DevToolsCommand::PrintToPdf(command) => (+ AutomationCommand::PrintToPdf(command) => (execute_devtools_print_to_pdf_command(conn, command),Vec::new(),None,),- command @ (DevToolsCommand::Navigate(_)- | DevToolsCommand::Reload(_)- | DevToolsCommand::TraverseHistory(_)) => {+ command @ (AutomationCommand::Navigate(_)+ | AutomationCommand::Reload(_)+ | AutomationCommand::TraverseHistory(_)) => {navigation::execute_devtools_navigation_command_async_with_protocol_events(conn,command,@@ -1676,8 +1675,8 @@ pub(crate) async fn execute_devtools_page_command_async_with_protocol_events().await}- command @ (DevToolsCommand::AddPreloadScript(_)- | DevToolsCommand::RemovePreloadScript(_)) => {+ command @ (AutomationCommand::AddPreloadScript(_)+ | AutomationCommand::RemovePreloadScript(_)) => {preload::execute_devtools_preload_command_async(conn, command).await}_ => (@@ -1702,7 +1701,7 @@ fn page_route_for_context_id(fn page_command_owner(conn: &CdpConnection,- context: &DevToolsCommandContext,+ context: &AutomationContext,) -> Result<CommandOwnerScope, DevToolsError> {conn.command_owner_scope_for_devtools_context(context).ok_or_else(|| {@@ -1846,31 +1845,31 @@ fn try_start_page_set_document_content_command(fn start_devtools_page_command(conn: &mut CdpConnection,command_id: Option<u64>,- command: DevToolsCommand,+ command: AutomationCommand,) -> PageCommandTaskStep {match command {- DevToolsCommand::GetFrameTree(command) => start_devtools_get_frame_tree_command(+ AutomationCommand::GetFrameTree(command) => start_devtools_get_frame_tree_command(conn,command_id,command,FrameTreeCommandOutputKind::FrameTree,),- DevToolsCommand::GetLayoutMetrics(command) => {+ AutomationCommand::GetLayoutMetrics(command) => {start_devtools_get_layout_metrics_command(conn, command_id, command)}- DevToolsCommand::GetJavaScriptDialog(command) => {+ AutomationCommand::GetJavaScriptDialog(command) => {let owner = page_command_owner(conn, &command.context);PageCommandTaskStep::Complete(match owner {Ok(owner) => match finish_devtools_get_javascript_dialog_command(conn, &owner) {Ok(result) => CommandOutputPlan::from_devtools_result(- DevToolsCommandResult::JavaScriptDialog(result),+ AutomationResult::JavaScriptDialog(result),),Err(error) => CommandOutputPlan::from_devtools_error(error),},Err(error) => CommandOutputPlan::from_devtools_error(error),})}- DevToolsCommand::SetJavaScriptDialogPromptText(command) => {+ AutomationCommand::SetJavaScriptDialogPromptText(command) => {let owner = page_command_owner(conn, &command.context);PageCommandTaskStep::Complete(match owner {Ok(owner) => match finish_devtools_set_javascript_dialog_prompt_text_command(@@ -1882,13 +1881,13 @@ fn start_devtools_page_command(Err(error) => CommandOutputPlan::from_devtools_error(error),})}- DevToolsCommand::HandleJavaScriptDialog(command) => PageCommandTaskStep::Complete(+ AutomationCommand::HandleJavaScriptDialog(command) => PageCommandTaskStep::Complete(complete_devtools_handle_javascript_dialog_command(conn, command),),- DevToolsCommand::CaptureScreenshot(command) => {+ AutomationCommand::CaptureScreenshot(command) => {start_devtools_capture_screenshot_command(conn, command_id, command)}- DevToolsCommand::PrintToPdf(command) => {+ AutomationCommand::PrintToPdf(command) => {start_devtools_print_to_pdf_command(conn, command_id, command)}_ => PageCommandTaskStep::Complete(CommandOutputPlan::error(@@ -2234,11 +2233,9 @@ pub(crate) async fn complete_pending_page_command(}};match page.finish_layout_metrics(completion) {- Ok(metrics) => {- CommandOutputPlan::from_devtools_result(DevToolsCommandResult::LayoutMetrics(- layout_metrics_result_from_renderer(metrics),- ))- }+ Ok(metrics) => CommandOutputPlan::from_devtools_result(+ AutomationResult::LayoutMetrics(layout_metrics_result_from_renderer(metrics)),+ ),Err(error) => CommandOutputPlan::error(-32000,format!("Failed to finish layout metrics: {error}"),@@ -2265,14 +2262,14 @@ pub(crate) async fn complete_pending_page_command(};match page.finish_capture_screenshot(completion) {Ok(RendererCaptureScreenshotReply::Captured(image)) => {- CommandOutputPlan::from_devtools_result(- DevToolsCommandResult::CaptureScreenshot(DevToolsCaptureScreenshotResult {+ CommandOutputPlan::from_devtools_result(AutomationResult::CaptureScreenshot(+ DevToolsCaptureScreenshotResult {mime_type: image.mime_type,width: image.width,height: image.height,bytes: image.bytes,- }),- )+ },+ ))}Ok(RendererCaptureScreenshotReply::LayoutDisabled) => {CommandOutputPlan::error(-32000, CAPTURE_SCREENSHOT_LAYOUT_DISABLED_MESSAGE)diff --git a/moli-protocol/src/domains/page/capture.rs b/moli-protocol/src/domains/page/capture.rsindex 5c43797a3..ae05bbc3b 100644--- a/moli-protocol/src/domains/page/capture.rs+++ b/moli-protocol/src/domains/page/capture.rs@@ -96,7 +96,7 @@ pub(super) fn build_cdp_capture_screenshot_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Ok(DevToolsCaptureScreenshotCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),format: params.format,quality,clip: params.clip.map(|clip| {@@ -136,7 +136,7 @@ pub(super) fn try_start_page_capture_screenshot_command(Ok(command) => command,Err(plan) => return PageCommandTaskStep::Complete(plan),};- start_devtools_page_command(conn, cmd.id, DevToolsCommand::CaptureScreenshot(command))+ start_devtools_page_command(conn, cmd.id, AutomationCommand::CaptureScreenshot(command))}#[derive(Default, Deserialize)]@@ -277,7 +277,7 @@ pub(super) fn build_cdp_print_to_pdf_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Ok(DevToolsPrintToPdfCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),landscape: params.landscape,print_background: params.print_background,scale: params.scale,@@ -355,10 +355,10 @@ pub(super) fn print_to_pdf_page_size_error(pub(super) async fn execute_devtools_get_layout_metrics_command(conn: &mut CdpConnection,command: DevToolsGetLayoutMetricsCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let owner = page_command_owner(conn, &command.context)?;let result = execute_devtools_get_layout_metrics_for_current_owner(conn, &owner).await;- result.map(DevToolsCommandResult::LayoutMetrics)+ result.map(AutomationResult::LayoutMetrics)}pub(super) async fn execute_devtools_get_layout_metrics_for_current_owner(@@ -461,7 +461,7 @@ pub(super) async fn execute_devtools_capture_screenshot_command(conn: &mut CdpConnection,command: DevToolsCaptureScreenshotCommand,) -> (- Result<DevToolsCommandResult, DevToolsError>,+ Result<AutomationResult, DevToolsError>,Option<moli_core::RendererOutputFence>,) {let mut predecessor = None;@@ -499,7 +499,7 @@ pub(super) async fn execute_devtools_capture_screenshot_command(.map_err(|error| capture_error(error.to_string()))?;match reply {RendererCaptureScreenshotReply::Captured(image) => Ok(- DevToolsCommandResult::CaptureScreenshot(DevToolsCaptureScreenshotResult {+ AutomationResult::CaptureScreenshot(DevToolsCaptureScreenshotResult {mime_type: image.mime_type,width: image.width,height: image.height,@@ -521,14 +521,14 @@ pub(super) async fn execute_devtools_capture_screenshot_command(pub(super) fn execute_devtools_print_to_pdf_command(conn: &mut CdpConnection,command: DevToolsPrintToPdfCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {validate_page_capture_target_context(conn, &command.context)?;Err(devtools_print_to_pdf_error(&command))}pub(super) fn validate_page_capture_target_context(conn: &CdpConnection,- context: &DevToolsCommandContext,+ context: &AutomationContext,) -> Result<(), DevToolsError> {if let Some(target_id) = context.target_id.as_ref() {page_capture_route_for_context_id(conn, target_id.as_str())?;@@ -551,7 +551,7 @@ pub(super) fn start_devtools_capture_screenshot_command(if let Err(error) = validate_page_capture_target_context(conn, &command.context) {return PageCommandTaskStep::Complete(CommandOutputPlan::from_devtools_error(error));}- if command.context.protocol != DevToolsProtocol::Cdp {+ if command.context.protocol != FrontendProtocol::Cdp {return PageCommandTaskStep::Complete(CommandOutputPlan::from_devtools_error(devtools_capture_screenshot_error(&command),));@@ -599,7 +599,7 @@ pub(super) fn start_devtools_print_to_pdf_command(if let Err(error) = validate_page_capture_target_context(conn, &command.context) {return PageCommandTaskStep::Complete(CommandOutputPlan::from_devtools_error(error));}- if command.context.protocol != DevToolsProtocol::Cdp {+ if command.context.protocol != FrontendProtocol::Cdp {return PageCommandTaskStep::Complete(complete_devtools_print_to_pdf_command(conn, command,));@@ -662,13 +662,13 @@ pub(super) fn start_devtools_print_to_pdf_command(pub(super) fn build_cdp_get_layout_metrics_command(conn: &CdpConnection,cmd: &Cmd<'_>,-) -> crate::devtools_runtime::DevToolsGetLayoutMetricsCommand {+) -> crate::automation::DevToolsGetLayoutMetricsCommand {let (browser_context_id, target_id) = conn.target_owner_identity_for_session(cmd.session_id).map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));- crate::devtools_runtime::DevToolsGetLayoutMetricsCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ crate::automation::DevToolsGetLayoutMetricsCommand {+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),}}@@ -677,13 +677,13 @@ pub(super) fn try_start_page_get_layout_metrics_command(cmd: &Cmd<'_>,) -> PageCommandTaskStep {let command = build_cdp_get_layout_metrics_command(conn, cmd);- start_devtools_page_command(conn, cmd.id, DevToolsCommand::GetLayoutMetrics(command))+ start_devtools_page_command(conn, cmd.id, AutomationCommand::GetLayoutMetrics(command))}pub(super) fn start_devtools_get_layout_metrics_command(conn: &mut CdpConnection,command_id: Option<u64>,- command: crate::devtools_runtime::DevToolsGetLayoutMetricsCommand,+ command: crate::automation::DevToolsGetLayoutMetricsCommand,) -> PageCommandTaskStep {let command_session_id = command.context.session_id.as_ref().map(|id| id.as_str());let owner_scope = CommandOwnerScope::capture(conn, command_session_id);@@ -717,5 +717,5 @@ pub(super) fn try_start_page_print_to_pdf_command(Ok(command) => command,Err(plan) => return PageCommandTaskStep::Complete(plan),};- start_devtools_page_command(conn, cmd.id, DevToolsCommand::PrintToPdf(command))+ start_devtools_page_command(conn, cmd.id, AutomationCommand::PrintToPdf(command))}diff --git a/moli-protocol/src/domains/page/javascript_dialog.rs b/moli-protocol/src/domains/page/javascript_dialog.rsindex d76e58fbf..ed5626ff3 100644--- a/moli-protocol/src/domains/page/javascript_dialog.rs+++ b/moli-protocol/src/domains/page/javascript_dialog.rs@@ -38,7 +38,7 @@ pub(super) fn handle_javascript_dialog_command(match start_devtools_page_command(conn,cmd.id,- DevToolsCommand::HandleJavaScriptDialog(command),+ AutomationCommand::HandleJavaScriptDialog(command),) {PageCommandTaskStep::Complete(plan) => plan,PageCommandTaskStep::Pending(_) => {@@ -60,7 +60,7 @@ pub(super) fn build_cdp_handle_javascript_dialog_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));Ok(DevToolsHandleJavaScriptDialogCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),accept: params.accept,prompt_text: params.prompt_text.unwrap_or_default(),})@@ -111,7 +111,7 @@ pub(super) fn finish_devtools_set_javascript_dialog_prompt_text_command(conn: &mut CdpConnection,command: DevToolsSetJavaScriptDialogPromptTextCommand,owner: &CommandOwnerScope,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let current_page_owner = conn.target_page_residence_identity_for_owner(owner);let Some(result) = conn.with_target_devtools_session_state_for_owner_mut(owner, |state| {let dialog_state = &mut state.page_session_state.javascript_dialog_state;@@ -136,7 +136,7 @@ pub(super) fn finish_devtools_set_javascript_dialog_prompt_text_command("No dialog is showing",));}- Ok(DevToolsCommandResult::Empty)+ Ok(AutomationResult::Empty)}) else {return Err(DevToolsError::new(DevToolsErrorKind::NoSuchAlert,@@ -209,16 +209,16 @@ pub(in crate::domains) async fn emit_javascript_dialog_activity_background_eventpub(super) fn execute_devtools_get_javascript_dialog_command(conn: &mut CdpConnection,command: DevToolsGetJavaScriptDialogCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let owner = page_command_owner(conn, &command.context)?;let result = finish_devtools_get_javascript_dialog_command(conn, &owner);- result.map(DevToolsCommandResult::JavaScriptDialog)+ result.map(AutomationResult::JavaScriptDialog)}pub(super) fn execute_devtools_set_javascript_dialog_prompt_text_command(conn: &mut CdpConnection,command: DevToolsSetJavaScriptDialogPromptTextCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let owner = page_command_owner(conn, &command.context)?;finish_devtools_set_javascript_dialog_prompt_text_command(conn, command, &owner)}@@ -227,7 +227,7 @@ pub(super) fn execute_devtools_handle_javascript_dialog_command(conn: &mut CdpConnection,command: DevToolsHandleJavaScriptDialogCommand,) -> (- Result<DevToolsCommandResult, DevToolsError>,+ Result<AutomationResult, DevToolsError>,Vec<BackgroundProtocolEvent>,) {let owner = match page_command_owner(conn, &command.context) {@@ -236,7 +236,7 @@ pub(super) fn execute_devtools_handle_javascript_dialog_command(};let result = finish_devtools_handle_javascript_dialog_command(conn, command, &owner);match result {- Ok(event) => (Ok(DevToolsCommandResult::Empty), vec![event]),+ Ok(event) => (Ok(AutomationResult::Empty), vec![event]),Err(error) => (Err(error), Vec::new()),}}@@ -244,13 +244,13 @@ pub(super) fn execute_devtools_handle_javascript_dialog_command(#[cfg(test)]use moli_core::page::RendererPendingJavaScriptDialog;+use crate::automation::PageJavaScriptDialogOpeningEvent;use crate::conn::{BackgroundProtocolEvent, CdpConnection, TargetPageProtocolAttachmentIdentity,TargetPreparedJavaScriptDialog, TargetPreparedJavaScriptDialogRoute,};#[cfg(test)]use crate::conn::{TargetJavaScriptDialogScopeObserver, TargetPageResidenceIdentity};-use crate::devtools_runtime::PageJavaScriptDialogOpeningEvent;pub(super) type PreparedJavaScriptDialog = TargetPreparedJavaScriptDialog;diff --git a/moli-protocol/src/domains/page/lifecycle.rs b/moli-protocol/src/domains/page/lifecycle.rsindex dde75b4a8..254ab37ca 100644--- a/moli-protocol/src/domains/page/lifecycle.rs+++ b/moli-protocol/src/domains/page/lifecycle.rs@@ -1,4 +1,4 @@-use crate::devtools_runtime::{+use crate::automation::{DevToolsFrameId, DevToolsLoaderId, DevToolsTargetId, NavigationFrameEvent,NavigationFrameEventKind, NavigationLifecycleEvent, PageLifecycleEvent,};diff --git a/moli-protocol/src/domains/page/native.rs b/moli-protocol/src/domains/page/native.rsindex da0962c60..c7f412a96 100644--- a/moli-protocol/src/domains/page/native.rs+++ b/moli-protocol/src/domains/page/native.rs@@ -33,9 +33,9 @@ fn prepare(|reply| match reply {Ok(Reply::LayoutMetrics(metrics)) => {Response::success(CommandOutputPlan::devtools_result_payload(- DevToolsCommandResult::LayoutMetrics(- layout_metrics_result_from_renderer(metrics),- ),+ AutomationResult::LayoutMetrics(layout_metrics_result_from_renderer(+ metrics,+ )),))}Err(error) => Response::error(@@ -68,7 +68,7 @@ fn prepare(Ok(Reply::CaptureScreenshot(RendererCaptureScreenshotReply::Captured(image,))) => Response::success(CommandOutputPlan::devtools_result_payload(- DevToolsCommandResult::CaptureScreenshot(DevToolsCaptureScreenshotResult {+ AutomationResult::CaptureScreenshot(DevToolsCaptureScreenshotResult {mime_type: image.mime_type,width: image.width,height: image.height,diff --git a/moli-protocol/src/domains/page/navigation.rs b/moli-protocol/src/domains/page/navigation.rsindex ad89a4120..7418b1fba 100644--- a/moli-protocol/src/domains/page/navigation.rs+++ b/moli-protocol/src/domains/page/navigation.rs@@ -1,11 +1,11 @@-use crate::devtools_runtime::{- DevToolsCommand, DevToolsCommandResult, DevToolsError, DevToolsErrorKind, DevToolsFrameId,+use crate::automation::{+ AutomationCommand, AutomationResult, DevToolsError, DevToolsErrorKind, DevToolsFrameId,DevToolsGetNavigationHistoryCommand, DevToolsGetNavigationHistoryResult,DevToolsHistoryTraversalDestination, DevToolsLoaderId, DevToolsNavigateCommand,DevToolsNavigateResult, DevToolsNavigationHistoryEntry, DevToolsNavigationId,- DevToolsNavigationWait, DevToolsProtocol, DevToolsReloadCommand, DevToolsTargetId,- DevToolsTraverseHistoryCommand, DevToolsTraverseHistoryResult, SameDocumentNavigationEvent,- webdriver_bidi_navigation_id_from_loader_id,+ DevToolsNavigationWait, DevToolsReloadCommand, DevToolsTargetId,+ DevToolsTraverseHistoryCommand, DevToolsTraverseHistoryResult, FrontendProtocol,+ SameDocumentNavigationEvent, webdriver_bidi_navigation_id_from_loader_id,};use chromiumoxide_cdp::cdp::browser_protocol::page::{NavigateParams, NavigateToHistoryEntryParams, ReloadParams,@@ -211,7 +211,7 @@ const CHILD_FRAME_NAVIGATION_LOAD_GATE_TIMEOUT: std::time::Duration =#[derive(Debug, Clone)]struct DirectNavigationResult {- protocol: DevToolsProtocol,+ protocol: FrontendProtocol,result_kind: DevToolsNavigationCommandResultKind,url: String,frame_id: Option<DevToolsFrameId>,@@ -223,12 +223,12 @@ struct DirectNavigationResult {impl DirectNavigationResult {fn navigate(- protocol: DevToolsProtocol,+ protocol: FrontendProtocol,frame_id: Option<&str>,loader_id: Option<&str>,url: impl Into<String>,) -> Self {- let navigation_id = if protocol == DevToolsProtocol::WebDriverBidi {+ let navigation_id = if protocol == FrontendProtocol::WebDriverBidi {loader_id.map(webdriver_bidi_navigation_id_from_loader_id)} else {None@@ -237,12 +237,12 @@ impl DirectNavigationResult {protocol,result_kind: DevToolsNavigationCommandResultKind::Navigate,url: url.into(),- frame_id: if protocol == DevToolsProtocol::WebDriverBidi {+ frame_id: if protocol == FrontendProtocol::WebDriverBidi {None} else {frame_id.map(DevToolsFrameId::from)},- loader_id: if protocol == DevToolsProtocol::WebDriverBidi {+ loader_id: if protocol == FrontendProtocol::WebDriverBidi {None} else {loader_id.map(DevToolsLoaderId::from)@@ -255,7 +255,7 @@ impl DirectNavigationResult {fn empty() -> Self {Self {- protocol: DevToolsProtocol::Cdp,+ protocol: FrontendProtocol::Cdp,result_kind: DevToolsNavigationCommandResultKind::Empty,url: String::new(),frame_id: None,@@ -266,7 +266,7 @@ impl DirectNavigationResult {}}- fn traverse_history(protocol: DevToolsProtocol, same_document: bool) -> Self {+ fn traverse_history(protocol: FrontendProtocol, same_document: bool) -> Self {Self {protocol,result_kind: DevToolsNavigationCommandResultKind::TraverseHistory { same_document },@@ -290,11 +290,11 @@ impl DirectNavigationResult {}fn set_navigation_identity(&mut self, frame_id: &str, loader_id: &str) {- if self.protocol != DevToolsProtocol::WebDriverBidi {+ if self.protocol != FrontendProtocol::WebDriverBidi {self.frame_id = Some(DevToolsFrameId::from(frame_id));self.loader_id = Some(DevToolsLoaderId::from(loader_id));}- self.navigation_id = (self.protocol == DevToolsProtocol::WebDriverBidi)+ self.navigation_id = (self.protocol == FrontendProtocol::WebDriverBidi).then(|| webdriver_bidi_navigation_id_from_loader_id(loader_id));}@@ -317,16 +317,14 @@ impl DirectNavigationResult {}}- fn into_result(self) -> DevToolsCommandResult {+ fn into_result(self) -> AutomationResult {match self.result_kind {- DevToolsNavigationCommandResultKind::Empty => DevToolsCommandResult::Empty,+ DevToolsNavigationCommandResultKind::Empty => AutomationResult::Empty,DevToolsNavigationCommandResultKind::TraverseHistory { same_document } => {- DevToolsCommandResult::TraverseHistory(DevToolsTraverseHistoryResult {- same_document,- })+ AutomationResult::TraverseHistory(DevToolsTraverseHistoryResult { same_document })}DevToolsNavigationCommandResultKind::Navigate => {- DevToolsCommandResult::Navigate(DevToolsNavigateResult {+ AutomationResult::Navigate(DevToolsNavigateResult {navigation_id: self.navigation_id,frame_id: self.frame_id,loader_id: self.loader_id,@@ -702,7 +700,7 @@ pub(super) fn try_start_navigate_command_dispatch(start_devtools_page_command(conn,cmd.id,- DevToolsCommand::Navigate(shared_command),+ AutomationCommand::Navigate(shared_command),DevToolsNavigationStartOptions {owner,result_projection,@@ -719,7 +717,7 @@ fn build_cdp_navigate_command(referrer: Option<&str>,) -> DevToolsNavigateCommand {DevToolsNavigateCommand {- context: cmd.devtools_command_context(target_id, Option::<&str>::None),+ context: cmd.automation_context(target_id, Option::<&str>::None),url: url.to_owned(),referrer: referrer.map(str::to_owned),wait: DevToolsNavigationWait::DocumentInstalled,@@ -732,16 +730,14 @@ fn cdp_navigate_result_payload(loader_id: Option<&str>,url: &str,) -> Value {- CommandOutputPlan::devtools_result_payload(DevToolsCommandResult::Navigate(- DevToolsNavigateResult {- navigation_id: navigation_id.map(Into::into),- frame_id: frame_id.map(DevToolsFrameId::from),- loader_id: loader_id.map(DevToolsLoaderId::from),- url: url.to_owned(),- error_text: None,- is_download: None,- },- ))+ CommandOutputPlan::devtools_result_payload(AutomationResult::Navigate(DevToolsNavigateResult {+ navigation_id: navigation_id.map(Into::into),+ frame_id: frame_id.map(DevToolsFrameId::from),+ loader_id: loader_id.map(DevToolsLoaderId::from),+ url: url.to_owned(),+ error_text: None,+ is_download: None,+ }))}fn webdriver_bidi_navigate_result_payload(loader_id: Option<&str>, url: &str) -> Value {@@ -755,12 +751,12 @@ fn webdriver_bidi_navigate_result_payload(loader_id: Option<&str>, url: &str) ->}fn protocol_neutral_navigate_result_payload(- protocol: DevToolsProtocol,+ protocol: FrontendProtocol,frame_id: Option<&str>,loader_id: Option<&str>,url: &str,) -> Value {- if protocol == DevToolsProtocol::WebDriverBidi {+ if protocol == FrontendProtocol::WebDriverBidi {webdriver_bidi_navigate_result_payload(loader_id, url)} else {cdp_navigate_result_payload(None, frame_id, loader_id, url)@@ -777,13 +773,13 @@ fn update_navigation_result_payload_identity(return;};match protocol {- DevToolsProtocol::Cdp | DevToolsProtocol::WebDriverClassic => {+ FrontendProtocol::Cdp | FrontendProtocol::WebDriverClassic => {if payload.contains_key("frameId") {payload.insert("frameId".to_owned(), json!(frame_id));payload.insert("loaderId".to_owned(), json!(loader_id));}}- DevToolsProtocol::WebDriverBidi => {+ FrontendProtocol::WebDriverBidi => {if payload.contains_key("navigation") {payload.insert("navigation".to_owned(),@@ -804,11 +800,11 @@ struct DevToolsNavigationStartOptions {fn start_devtools_page_command(conn: &mut CdpConnection,command_id: Option<u64>,- command: DevToolsCommand,+ command: AutomationCommand,options: DevToolsNavigationStartOptions,) -> PageCommandTaskStep {match command {- DevToolsCommand::Navigate(command) => {+ AutomationCommand::Navigate(command) => {let start = start_devtools_navigate_command(conn,command_id,@@ -825,10 +821,10 @@ fn start_devtools_page_command(&options.reloaded_after_crash_session_ids,)}- DevToolsCommand::Reload(command) => {+ AutomationCommand::Reload(command) => {start_devtools_reload_command(conn, command_id, &command, options)}- DevToolsCommand::TraverseHistory(command) => {+ AutomationCommand::TraverseHistory(command) => {start_devtools_traverse_history_command(conn, command_id, &command, options)}_ => PageCommandTaskStep::Complete(CommandOutputPlan::error(@@ -840,10 +836,10 @@ fn start_devtools_page_command(pub(crate) async fn execute_devtools_navigation_command_async_with_protocol_events(conn: &mut CdpConnection,- command: DevToolsCommand,+ command: AutomationCommand,background_command_id: Option<u64>,) -> (- Result<DevToolsCommandResult, DevToolsError>,+ Result<AutomationResult, DevToolsError>,Vec<crate::conn::BackgroundProtocolEvent>,Option<moli_core::RendererOutputFence>,) {@@ -897,7 +893,7 @@ pub(crate) async fn execute_devtools_navigation_command_async_with_protocol_evenpub(crate) fn execute_devtools_get_navigation_history_command(conn: &mut CdpConnection,command: DevToolsGetNavigationHistoryCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let target_id = command.context.target_id@@ -914,7 +910,7 @@ pub(crate) fn execute_devtools_get_navigation_history_command("NoSuchTarget",));};- Ok(DevToolsCommandResult::GetNavigationHistory(+ Ok(AutomationResult::GetNavigationHistory(DevToolsGetNavigationHistoryResult {current_index,entries: entries@@ -933,24 +929,24 @@ pub(crate) fn execute_devtools_get_navigation_history_command(fn devtools_navigation_target_route(conn: &CdpConnection,- command: &DevToolsCommand,+ command: &AutomationCommand,) -> Result<CdpSessionRoute, DevToolsError> {let target_id = match command {- DevToolsCommand::Navigate(command) => command.context.target_id.as_ref(),- DevToolsCommand::Reload(command) => command.context.target_id.as_ref(),- DevToolsCommand::TraverseHistory(command) => command.context.target_id.as_ref(),+ AutomationCommand::Navigate(command) => command.context.target_id.as_ref(),+ AutomationCommand::Reload(command) => command.context.target_id.as_ref(),+ AutomationCommand::TraverseHistory(command) => command.context.target_id.as_ref(),_ => None,}.ok_or_else(|| DevToolsError::new(DevToolsErrorKind::NoSuchTarget, "NoSuchTarget"))?;if let Some(route) = conn.target_session_route_for_target_id(target_id.as_str()) {return Ok(route);}- if matches!(command, DevToolsCommand::Navigate(_))+ if matches!(command, AutomationCommand::Navigate(_))&& let Some(route) = conn.target_session_route_for_child_frame_id(target_id.as_str()){return Ok(route);}- if matches!(command, DevToolsCommand::TraverseHistory(_))+ if matches!(command, AutomationCommand::TraverseHistory(_))&& conn.has_attached_child_frame_id(target_id.as_str()){return Err(DevToolsError::new(@@ -967,7 +963,7 @@ fn devtools_navigation_target_route(fn start_protocol_neutral_navigation_command(conn: &mut CdpConnection,route: CdpSessionRoute,- command: DevToolsCommand,+ command: AutomationCommand,background_command_id: Option<u64>,) -> (PageCommandTaskStep,@@ -975,8 +971,8 @@ fn start_protocol_neutral_navigation_command() {let wait = devtools_navigation_wait(&command);let result_url = match &command {- DevToolsCommand::Navigate(command) => command.url.clone(),- DevToolsCommand::Reload(_) => {+ AutomationCommand::Navigate(command) => command.url.clone(),+ AutomationCommand::Reload(_) => {let owner = CommandOwnerScope::for_route(route.clone());match conn.runtime_session_owner_target_url_for_owner(&owner) {Some(url) => url,@@ -992,12 +988,12 @@ fn start_protocol_neutral_navigation_command(}}}- DevToolsCommand::TraverseHistory(_) => String::new(),+ AutomationCommand::TraverseHistory(_) => String::new(),_ => String::new(),};let result_kind = DevToolsNavigationCommandResultKind::Navigate;let mut direct_result = match &command {- DevToolsCommand::Navigate(command) => {+ AutomationCommand::Navigate(command) => {let loader_id = if child_frame_navigation_target_id(conn, command).is_some() {None} else {@@ -1014,17 +1010,17 @@ fn start_protocol_neutral_navigation_command(command.url.clone(),)}- DevToolsCommand::Reload(command) => DirectNavigationResult::navigate(+ AutomationCommand::Reload(command) => DirectNavigationResult::navigate(command.context.protocol,None,Some(LOADER_ID),result_url.clone(),),- DevToolsCommand::TraverseHistory(command) => {+ AutomationCommand::TraverseHistory(command) => {DirectNavigationResult::traverse_history(command.context.protocol, false)}_ => DirectNavigationResult {- protocol: DevToolsProtocol::Cdp,+ protocol: FrontendProtocol::Cdp,result_kind,url: result_url.clone(),frame_id: None,@@ -1037,7 +1033,7 @@ fn start_protocol_neutral_navigation_command(let command_owner = CommandOwnerScope::for_route(route.clone());let reloaded_after_crash_session_ids = reloaded_after_crash_session_ids(conn, &command_owner);let step = match command {- DevToolsCommand::Navigate(command) => {+ AutomationCommand::Navigate(command) => {if Url::parse(&command.url).is_err() {let error =DevToolsError::new(DevToolsErrorKind::Internal, "Invalid navigation URL");@@ -1064,7 +1060,7 @@ fn start_protocol_neutral_navigation_command(start_devtools_page_command(conn,background_command_id,- DevToolsCommand::Navigate(command),+ AutomationCommand::Navigate(command),DevToolsNavigationStartOptions {owner: command_owner.clone(),result_projection,@@ -1073,7 +1069,7 @@ fn start_protocol_neutral_navigation_command(},)}- DevToolsCommand::Reload(mut command) => {+ AutomationCommand::Reload(mut command) => {let result_payload = protocol_neutral_navigate_result_payload(command.context.protocol,None,@@ -1086,7 +1082,7 @@ fn start_protocol_neutral_navigation_command(start_devtools_page_command(conn,background_command_id,- DevToolsCommand::Reload(command),+ AutomationCommand::Reload(command),DevToolsNavigationStartOptions {owner: command_owner.clone(),result_projection,@@ -1095,7 +1091,7 @@ fn start_protocol_neutral_navigation_command(},)}- DevToolsCommand::TraverseHistory(mut command) => {+ AutomationCommand::TraverseHistory(mut command) => {let result_protocol = command.context.protocol;command.context.session_id = None;match resolve_devtools_history_traversal_destination(@@ -1106,7 +1102,7 @@ fn start_protocol_neutral_navigation_command(Ok(ResolvedDevToolsHistoryTraversal::Noop) => {return (PageCommandTaskStep::Complete(CommandOutputPlan::from_devtools_result(- DevToolsCommandResult::Empty,+ AutomationResult::Empty,)),Ok(DirectNavigationResult::empty()),);@@ -1134,7 +1130,7 @@ fn start_protocol_neutral_navigation_command(start_devtools_page_command(conn,background_command_id,- DevToolsCommand::TraverseHistory(command),+ AutomationCommand::TraverseHistory(command),DevToolsNavigationStartOptions {owner: command_owner,result_projection: NavigationResultProjection::new(result_protocol, json!({})),@@ -1164,11 +1160,11 @@ enum DevToolsNavigationCommandResultKind {TraverseHistory { same_document: bool },}-fn devtools_navigation_wait(command: &DevToolsCommand) -> DevToolsNavigationWait {+fn devtools_navigation_wait(command: &AutomationCommand) -> DevToolsNavigationWait {match command {- DevToolsCommand::Navigate(command) => command.wait,- DevToolsCommand::Reload(command) => command.wait,- DevToolsCommand::TraverseHistory(command) => command.wait,+ AutomationCommand::Navigate(command) => command.wait,+ AutomationCommand::Reload(command) => command.wait,+ AutomationCommand::TraverseHistory(command) => command.wait,_ => DevToolsNavigationWait::Load,}}@@ -1250,7 +1246,7 @@ fn direct_navigation_result_from_completed_load(match &completed.navigation {Ok(navigation) => {result.set_navigation_identity(&completed.state.frame_id, &completed.state.loader_id);- if result.protocol != DevToolsProtocol::WebDriverBidi+ if result.protocol != FrontendProtocol::WebDriverBidi&& matches!(navigation, NavigationLoadOutcome::Download(_)){result.loader_id = None;@@ -1300,7 +1296,7 @@ fn direct_navigation_result_from_fetch_continuation(}fn superseded_cdp_page_navigate_payload(state: &NavigationDispatchState) -> Option<Value> {- if state.result_projection.protocol() != DevToolsProtocol::Cdp {+ if state.result_projection.protocol() != FrontendProtocol::Cdp {return None;}let mut result = state.result_projection.payload().clone();@@ -1572,7 +1568,7 @@ pub(super) fn try_start_reload_command_dispatch(start_devtools_page_command(conn,cmd.id,- DevToolsCommand::Reload(shared_command),+ AutomationCommand::Reload(shared_command),DevToolsNavigationStartOptions {owner,result_projection,@@ -1588,7 +1584,7 @@ fn build_cdp_reload_command(params: ReloadParams,) -> DevToolsReloadCommand {DevToolsReloadCommand {- context: cmd.devtools_command_context(target_id, Option::<&str>::None),+ context: cmd.automation_context(target_id, Option::<&str>::None),ignore_cache: params.ignore_cache.unwrap_or(false),script_to_evaluate_on_load: params.script_to_evaluate_on_load,wait: DevToolsNavigationWait::DocumentInstalled,@@ -1663,7 +1659,7 @@ pub(super) fn try_start_navigate_to_history_entry_command_dispatch(start_devtools_page_command(conn,cmd.id,- DevToolsCommand::TraverseHistory(shared_command),+ AutomationCommand::TraverseHistory(shared_command),DevToolsNavigationStartOptions {owner,result_projection,@@ -1680,7 +1676,7 @@ fn build_cdp_traverse_history_command(url: String,) -> DevToolsTraverseHistoryCommand {DevToolsTraverseHistoryCommand {- context: cmd.devtools_command_context(target_id, Option::<&str>::None),+ context: cmd.automation_context(target_id, Option::<&str>::None),destination: DevToolsHistoryTraversalDestination::Entry { entry_id, url },wait: DevToolsNavigationWait::DocumentInstalled,}@@ -1817,7 +1813,7 @@ pub(super) fn complete_pending_same_document_history_traversal_command(.and_then(|page| page.finish_top_level_history_traversal_by_delta(completion));match result {Ok(true) => PageCommandTaskStep::Complete(CommandOutputPlan::from_devtools_result(- DevToolsCommandResult::Empty,+ AutomationResult::Empty,)),Ok(false) => start_history_traversal_url_fallback(conn, command_id, fallback),Err(error) => {@@ -1955,7 +1951,7 @@ fn start_devtools_traverse_history_command() {Ok(ResolvedDevToolsHistoryTraversal::Noop) => {return PageCommandTaskStep::Complete(CommandOutputPlan::from_devtools_result(- DevToolsCommandResult::Empty,+ AutomationResult::Empty,));}Ok(ResolvedDevToolsHistoryTraversal::Entry {@@ -3534,9 +3530,9 @@ pub(crate) async fn emit_same_document_navigation_background_events_async(#[cfg(test)]mod child_frame_attachment_tests {- use crate::devtools_runtime::{- DevToolsCommand, DevToolsHistoryTraversalDestination, DevToolsNavigationWait,- DevToolsProtocol,+ use crate::automation::{+ AutomationCommand, DevToolsHistoryTraversalDestination, DevToolsNavigationWait,+ FrontendProtocol,};use serde_json::{Value, json};@@ -3600,7 +3596,7 @@ mod child_frame_attachment_tests {Some("https://referrer.test/"),);- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-1")@@ -3633,7 +3629,7 @@ mod child_frame_attachment_tests {let step = start_devtools_page_command(&mut conn,cmd.id,- DevToolsCommand::Navigate(command),+ AutomationCommand::Navigate(command),DevToolsNavigationStartOptions {owner,result_projection: NavigationResultProjection::Cdp(json!({})),@@ -3671,7 +3667,7 @@ mod child_frame_attachment_tests {let command = build_cdp_reload_command(&cmd, Some("TID-3"), params);- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-3")@@ -3705,7 +3701,7 @@ mod child_frame_attachment_tests {let step = start_devtools_page_command(&mut conn,cmd.id,- DevToolsCommand::Reload(command),+ AutomationCommand::Reload(command),DevToolsNavigationStartOptions {owner,result_projection: NavigationResultProjection::Cdp(json!({})),@@ -3741,7 +3737,7 @@ mod child_frame_attachment_tests {"https://example.test/history".to_owned(),);- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-5")@@ -3782,7 +3778,7 @@ mod child_frame_attachment_tests {let step = start_devtools_page_command(&mut conn,cmd.id,- DevToolsCommand::TraverseHistory(command),+ AutomationCommand::TraverseHistory(command),DevToolsNavigationStartOptions {owner,result_projection: NavigationResultProjection::Cdp(json!({})),diff --git a/moli-protocol/src/domains/page/pdf.rs b/moli-protocol/src/domains/page/pdf.rsindex be264e3e5..697b8b5bd 100644--- a/moli-protocol/src/domains/page/pdf.rs+++ b/moli-protocol/src/domains/page/pdf.rs@@ -1,6 +1,6 @@use std::{collections::BTreeSet, io::Write as _};-use crate::devtools_runtime::DevToolsPrintToPdfCommand;+use crate::automation::DevToolsPrintToPdfCommand;const POINTS_PER_INCH: f64 = 72.0;const DEFAULT_MARGIN_INCHES: f64 = 1.0 / 2.54;@@ -360,14 +360,12 @@ fn pdf_number(value: f64) -> String {#[cfg(test)]mod tests {use super::*;- use crate::devtools_runtime::{- DevToolsCommandContext, DevToolsPrintToPdfTransferMode, DevToolsProtocol,- };+ use crate::automation::{AutomationContext, DevToolsPrintToPdfTransferMode, FrontendProtocol};fn command() -> DevToolsPrintToPdfCommand {DevToolsPrintToPdfCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::Cdp,+ context: AutomationContext {+ protocol: FrontendProtocol::Cdp,session_id: None,target_id: None,browser_context_id: None,diff --git a/moli-protocol/src/domains/page/preload.rs b/moli-protocol/src/domains/page/preload.rsindex 33d4ef1de..bc05d1ad8 100644--- a/moli-protocol/src/domains/page/preload.rs+++ b/moli-protocol/src/domains/page/preload.rs@@ -1,10 +1,10 @@pub(super) mod native;-use crate::devtools_runtime::{- DevToolsAddPreloadScriptCommand, DevToolsAddPreloadScriptResult, DevToolsCommand,- DevToolsCommandResult, DevToolsError, DevToolsErrorKind, DevToolsPreloadScriptId,- DevToolsPreloadScriptSource, DevToolsProtocol, DevToolsRemovePreloadScriptCommand,- DevToolsTargetId, DevToolsTargetKind,+use crate::automation::{+ AutomationCommand, AutomationResult, DevToolsAddPreloadScriptCommand,+ DevToolsAddPreloadScriptResult, DevToolsError, DevToolsErrorKind, DevToolsPreloadScriptId,+ DevToolsPreloadScriptSource, DevToolsRemovePreloadScriptCommand, DevToolsTargetId,+ DevToolsTargetKind, FrontendProtocol,};use chromiumoxide_cdp::cdp::browser_protocol::page::{AddScriptToEvaluateOnNewDocumentParams, RemoveScriptToEvaluateOnNewDocumentParams,@@ -212,7 +212,7 @@ pub(super) fn add_preload_script_result_plan(identifier: String) -> CommandOutpu}pub(super) fn add_preload_script_result(identifier: String) -> serde_json::Value {- CommandOutputPlan::devtools_result_payload(DevToolsCommandResult::AddPreloadScript(+ CommandOutputPlan::devtools_result_payload(AutomationResult::AddPreloadScript(DevToolsAddPreloadScriptResult {script_id: DevToolsPreloadScriptId::from(identifier),},@@ -235,7 +235,7 @@ fn build_cdp_add_preload_script_command(params: AddScriptToEvaluateOnNewDocumentParams,) -> DevToolsAddPreloadScriptCommand {DevToolsAddPreloadScriptCommand {- context: cmd.devtools_command_context(target_id, browser_context_id),+ context: cmd.automation_context(target_id, browser_context_id),source: DevToolsPreloadScriptSource::RawScript(params.source),world_name: params.world_name,target_ids: target_id.map(|target_id| vec![target_id.into()]),@@ -254,7 +254,7 @@ fn build_cdp_remove_preload_script_command(params: RemoveScriptToEvaluateOnNewDocumentParams,) -> DevToolsRemovePreloadScriptCommand {DevToolsRemovePreloadScriptCommand {- context: cmd.devtools_command_context(target_id, browser_context_id),+ context: cmd.automation_context(target_id, browser_context_id),script_id: DevToolsPreloadScriptId::from(params.identifier.as_ref()),}}@@ -303,13 +303,13 @@ fn start_devtools_preload_command(conn: &mut CdpConnection,command_id: Option<u64>,command_session_id: Option<&str>,- command: DevToolsCommand,+ command: AutomationCommand,) -> PageCommandTaskStep {match command {- DevToolsCommand::AddPreloadScript(command) => {+ AutomationCommand::AddPreloadScript(command) => {start_devtools_add_preload_script_command(conn, command_id, command_session_id, command)}- DevToolsCommand::RemovePreloadScript(command) => {+ AutomationCommand::RemovePreloadScript(command) => {start_devtools_remove_preload_script_command(conn,command_id,@@ -326,14 +326,14 @@ fn start_devtools_preload_command(pub(crate) async fn execute_devtools_preload_command_async(conn: &mut CdpConnection,- command: DevToolsCommand,+ command: AutomationCommand,) -> (- Result<DevToolsCommandResult, DevToolsError>,+ Result<AutomationResult, DevToolsError>,Vec<BackgroundProtocolEvent>,Option<moli_core::RendererOutputFence>,) {match command {- DevToolsCommand::AddPreloadScript(command) => {+ AutomationCommand::AddPreloadScript(command) => {if !command.browser_context_ids.is_empty() {return (execute_devtools_browser_context_add_preload_script_command(conn, command)@@ -344,12 +344,12 @@ pub(crate) async fn execute_devtools_preload_command_async(}execute_devtools_single_route_preload_command_async(conn,- DevToolsCommand::AddPreloadScript(command),+ AutomationCommand::AddPreloadScript(command),).await}- DevToolsCommand::RemovePreloadScript(command)- if command.context.protocol == DevToolsProtocol::WebDriverBidi+ AutomationCommand::RemovePreloadScript(command)+ if command.context.protocol == FrontendProtocol::WebDriverBidi&& command.context.target_id.is_none()&& split_bidi_preload_script_id(&command.script_id).is_none() =>{@@ -366,9 +366,9 @@ pub(crate) async fn execute_devtools_preload_command_async(async fn execute_devtools_single_route_preload_command_async(conn: &mut CdpConnection,- command: DevToolsCommand,+ command: AutomationCommand,) -> (- Result<DevToolsCommandResult, DevToolsError>,+ Result<AutomationResult, DevToolsError>,Vec<BackgroundProtocolEvent>,Option<moli_core::RendererOutputFence>,) {@@ -384,7 +384,7 @@ async fn execute_devtools_single_route_preload_command_async(let mut events = Vec::new();let mut command_context = CommandDispatchContext::default();let result = match command {- DevToolsCommand::AddPreloadScript(command) => {+ AutomationCommand::AddPreloadScript(command) => {execute_devtools_single_route_add_preload_script_command(conn,&owner,@@ -395,11 +395,11 @@ async fn execute_devtools_single_route_preload_command_async().await}- DevToolsCommand::RemovePreloadScript(command) => {+ AutomationCommand::RemovePreloadScript(command) => {match execute_devtools_single_route_remove_preload_script_command(conn, &owner, command).await{- Ok(()) => Ok(DevToolsCommandResult::Empty),+ Ok(()) => Ok(AutomationResult::Empty),Err(error) => Err(error),}}@@ -421,7 +421,7 @@ async fn execute_devtools_single_route_preload_command_async(async fn execute_devtools_browser_context_add_preload_script_command(conn: &mut CdpConnection,command: DevToolsAddPreloadScriptCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let script = document_start_script_from_add_preload_command(&command)?;let browser_context_ids =resolve_bidi_preload_browser_context_ids(conn, &command.browser_context_ids)?;@@ -466,7 +466,7 @@ async fn execute_devtools_browser_context_add_preload_script_command(.await.map_err(|message| devtools_preload_owner_error(&message))?;}- Ok(DevToolsCommandResult::AddPreloadScript(+ Ok(AutomationResult::AddPreloadScript(DevToolsAddPreloadScriptResult {script_id: DevToolsPreloadScriptId::from(identifier),},@@ -480,7 +480,7 @@ async fn execute_devtools_single_route_add_preload_script_command(result_kind: DevToolsPreloadResultKind,events: &mut Vec<BackgroundProtocolEvent>,command_context: &mut CommandDispatchContext,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let identifier = if is_bidi_default_preload_command(&command) {execute_devtools_default_add_preload_script_command(conn, owner, command).await?} else {@@ -591,7 +591,7 @@ async fn execute_devtools_single_route_remove_preload_script_command(return Err(preload_missing_owner_error(conn));};if !removed- && protocol == DevToolsProtocol::WebDriverBidi+ && protocol == FrontendProtocol::WebDriverBidi&& let Some((browser_context_id, _)) = owner_identity.as_ref()&& let Some(browser_context) = conn.browser_context_by_id_mut(browser_context_id)&& let Some(default_registry_key) =@@ -600,7 +600,7 @@ async fn execute_devtools_single_route_remove_preload_script_command(removed = true;registry_key = Some(default_registry_key);}- if !removed && protocol == DevToolsProtocol::WebDriverBidi {+ if !removed && protocol == FrontendProtocol::WebDriverBidi {return Err(DevToolsError::new(DevToolsErrorKind::NoSuchScript,"NoSuchScript",@@ -645,7 +645,7 @@ async fn remove_document_start_script_direct_async(async fn execute_devtools_bidi_browser_context_remove_preload_script_command(conn: &mut CdpConnection,command: DevToolsRemovePreloadScriptCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let script_id = command.script_id.as_str().to_owned();let browser_context_ids = conn.browser_contexts()@@ -685,12 +685,12 @@ async fn execute_devtools_bidi_browser_context_remove_preload_script_command(.await.map_err(|message| devtools_preload_owner_error(&message))?;}- Ok(DevToolsCommandResult::Empty)+ Ok(AutomationResult::Empty)}fn resolve_bidi_preload_browser_context_ids(conn: &mut CdpConnection,- browser_context_ids: &[crate::devtools_runtime::DevToolsBrowserContextId],+ browser_context_ids: &[crate::automation::DevToolsBrowserContextId],) -> Result<Vec<String>, DevToolsError> {let mut resolved = Vec::new();for browser_context_id in browser_context_ids {@@ -755,23 +755,23 @@ fn devtools_preload_internal_error(message: impl Into<String>) -> DevToolsError#[derive(Clone)]enum DevToolsPreloadResultKind {Add {- protocol: DevToolsProtocol,+ protocol: FrontendProtocol,target_id: Option<DevToolsTargetId>,},Remove,}impl DevToolsPreloadResultKind {- fn from_command(command: &DevToolsCommand) -> Result<Self, DevToolsError> {+ fn from_command(command: &AutomationCommand) -> Result<Self, DevToolsError> {match command {- DevToolsCommand::AddPreloadScript(command) => {+ AutomationCommand::AddPreloadScript(command) => {let target_id = add_preload_command_target_id(command)?.cloned();Ok(Self::Add {protocol: command.context.protocol,target_id,})}- DevToolsCommand::RemovePreloadScript(_) => Ok(Self::Remove),+ AutomationCommand::RemovePreloadScript(_) => Ok(Self::Remove),_ => Err(DevToolsError::new(DevToolsErrorKind::Unsupported,"UnsupportedDevToolsCommand",@@ -779,7 +779,7 @@ impl DevToolsPreloadResultKind {}}- fn add_result(self, identifier: String) -> Result<DevToolsCommandResult, DevToolsError> {+ fn add_result(self, identifier: String) -> Result<AutomationResult, DevToolsError> {let Self::Add {protocol,target_id,@@ -790,14 +790,14 @@ impl DevToolsPreloadResultKind {"UnexpectedPreloadResultKind",));};- let script_id = if protocol == DevToolsProtocol::WebDriverBidi+ let script_id = if protocol == FrontendProtocol::WebDriverBidi&& let Some(target_id) = target_id{format!("{}:{identifier}", target_id.as_str())} else {identifier};- Ok(DevToolsCommandResult::AddPreloadScript(+ Ok(AutomationResult::AddPreloadScript(DevToolsAddPreloadScriptResult {script_id: DevToolsPreloadScriptId::from(script_id),},@@ -807,10 +807,10 @@ impl DevToolsPreloadResultKind {fn devtools_preload_command_target_route(conn: &mut CdpConnection,- command: DevToolsCommand,-) -> Result<(CdpSessionRoute, DevToolsCommand), DevToolsError> {+ command: AutomationCommand,+) -> Result<(CdpSessionRoute, AutomationCommand), DevToolsError> {match command {- DevToolsCommand::AddPreloadScript(command) => {+ AutomationCommand::AddPreloadScript(command) => {let route = if let Some(target_id) = add_preload_command_target_id(&command)? {if conn.target_session_route_for_child_frame_id(target_id.as_str())@@ -828,11 +828,11 @@ fn devtools_preload_command_target_route(} else {default_add_preload_command_route(conn)?};- Ok((route, DevToolsCommand::AddPreloadScript(command)))+ Ok((route, AutomationCommand::AddPreloadScript(command)))}- DevToolsCommand::RemovePreloadScript(command) => {+ AutomationCommand::RemovePreloadScript(command) => {let (route, command) = remove_preload_command_target_route(conn, command)?;- Ok((route, DevToolsCommand::RemovePreloadScript(command)))+ Ok((route, AutomationCommand::RemovePreloadScript(command)))}_ => Err(DevToolsError::new(DevToolsErrorKind::Unsupported,@@ -865,7 +865,7 @@ fn add_preload_command_target_id(}fn is_bidi_default_preload_command(command: &DevToolsAddPreloadScriptCommand) -> bool {- command.context.protocol == DevToolsProtocol::WebDriverBidi+ command.context.protocol == FrontendProtocol::WebDriverBidi&& command.target_ids.is_none()&& command.context.target_id.is_none()&& command.browser_context_ids.is_empty()@@ -898,7 +898,7 @@ fn remove_preload_command_target_route(.ok_or_else(|| DevToolsError::new(DevToolsErrorKind::NoSuchTarget, "NoSuchTarget"))?;return Ok((route, command));}- if command.context.protocol == DevToolsProtocol::WebDriverBidi+ if command.context.protocol == FrontendProtocol::WebDriverBidi&& let Some((target_id, local_script_id)) = split_bidi_preload_script_id(&command.script_id){let route = conn@@ -909,7 +909,7 @@ fn remove_preload_command_target_route(return Ok((route, command));}let script_id = command.script_id.as_str().to_owned();- if command.context.protocol == DevToolsProtocol::WebDriverBidi+ if command.context.protocol == FrontendProtocol::WebDriverBidi&& let Some(route) = find_default_preload_script_route(conn, &script_id){return Ok((route, command));@@ -1067,7 +1067,7 @@ fn remove_preload_script_registration(let script_id = command.script_id.into_string();let renderer_inspector_session_id =conn.target_renderer_runtime_inspector_session_id_for_session(command_session_id);- let script_owner_session = (protocol == DevToolsProtocol::Cdp).then(|| {+ let script_owner_session = (protocol == FrontendProtocol::Cdp).then(|| {DevToolsSessionKey::from_wire_session_id(renderer_inspector_session_id.as_deref())});let owner_identity = conn.target_owner_identity_for_session(command_session_id);@@ -1104,8 +1104,8 @@ fn remove_preload_script_registration(}if !removed {let message = match protocol {- DevToolsProtocol::Cdp => "Script not found",- DevToolsProtocol::WebDriverClassic | DevToolsProtocol::WebDriverBidi => "NoSuchScript",+ FrontendProtocol::Cdp => "Script not found",+ FrontendProtocol::WebDriverClassic | FrontendProtocol::WebDriverBidi => "NoSuchScript",};return Err(CommandOutputPlan::error(-32000, message));}@@ -1158,7 +1158,7 @@ pub(super) fn try_start_add_script_to_evaluate_on_new_document_command(conn,cmd.id,cmd.session_id,- DevToolsCommand::AddPreloadScript(command),+ AutomationCommand::AddPreloadScript(command),))}@@ -1189,7 +1189,7 @@ pub(super) fn try_start_remove_script_to_evaluate_on_new_document_command(conn,cmd.id,cmd.session_id,- DevToolsCommand::RemovePreloadScript(command),+ AutomationCommand::RemovePreloadScript(command),))}@@ -1718,7 +1718,7 @@ async fn add_script_to_evaluate_on_new_document_direct_async(let script = document_start_script_from_add_preload_command(&command)?;let renderer_inspector_session_id =conn.target_renderer_runtime_inspector_session_id_for_owner(owner);- let script_owner_session = (command.context.protocol == DevToolsProtocol::Cdp).then(|| {+ let script_owner_session = (command.context.protocol == FrontendProtocol::Cdp).then(|| {DevToolsSessionKey::from_wire_session_id(renderer_inspector_session_id.as_deref())});let target_id = conn@@ -1802,9 +1802,9 @@ async fn add_script_to_evaluate_on_new_document_direct_async(#[cfg(test)]mod protocol_neutral_tests {- use crate::devtools_runtime::{- DevToolsAddPreloadScriptCommand, DevToolsCommand, DevToolsCommandContext,- DevToolsPreloadScriptSource, DevToolsProtocol,+ use crate::automation::{+ AutomationCommand, AutomationContext, DevToolsAddPreloadScriptCommand,+ DevToolsPreloadScriptSource, FrontendProtocol,};use serde_json::json;@@ -1839,7 +1839,7 @@ mod protocol_neutral_tests {let command =build_cdp_add_preload_script_command(&cmd, Some("TID-preload"), Some("BID-1"), params);- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-preload")@@ -1859,7 +1859,7 @@ mod protocol_neutral_tests {assert_eq!(command.target_ids.as_ref().map(|ids| {ids.iter()- .map(crate::devtools_runtime::DevToolsTargetId::as_str)+ .map(crate::automation::DevToolsTargetId::as_str).collect::<Vec<_>>()}),Some(vec!["TID-preload"])@@ -1868,7 +1868,7 @@ mod protocol_neutral_tests {command.browser_context_ids.iter()- .map(crate::devtools_runtime::DevToolsBrowserContextId::as_str)+ .map(crate::automation::DevToolsBrowserContextId::as_str).collect::<Vec<_>>(),vec!["BID-1"]);@@ -1903,7 +1903,7 @@ mod protocol_neutral_tests {params,);- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.script_id.as_str(), "SCRIPT-1");assert_eq!(command.context.target_id.as_ref().map(|id| id.as_str()),@@ -2061,8 +2061,8 @@ mod protocol_neutral_tests {#[test]fn bidi_add_preload_script_marks_channel_arguments() {let command = DevToolsAddPreloadScriptCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: None,target_id: None,browser_context_id: None,@@ -2127,7 +2127,7 @@ mod protocol_neutral_tests {&mut conn,cmd.id,cmd.session_id,- DevToolsCommand::AddPreloadScript(command),+ AutomationCommand::AddPreloadScript(command),);let PageCommandTaskStep::Complete(plan) = step else {diff --git a/moli-protocol/src/domains/page/producer_tests.rs b/moli-protocol/src/domains/page/producer_tests.rsindex 3366b71be..85947efc3 100644--- a/moli-protocol/src/domains/page/producer_tests.rs+++ b/moli-protocol/src/domains/page/producer_tests.rs@@ -14,10 +14,10 @@ use moli_core::page::{};use serde_json::{Value, json};+use crate::automation::{AutomationEvent, NavigationFrameEventKind};use crate::conn::{BackgroundProtocolEvent, BrowserContext, CdpConnection, CdpTargetFilter, CommandOwnerScope,};-use crate::devtools_runtime::{AutomationEvent, NavigationFrameEventKind};use crate::domains::activity::{ProtocolOutputPayloads, ProtocolOutputProjectionContext};use crate::domains::input::{InputPreparedOutputSlot, InputPreparedOutputs};use crate::testing::TestContext;diff --git a/moli-protocol/src/domains/page/protocol_neutral_tests.rs b/moli-protocol/src/domains/page/protocol_neutral_tests.rsindex 0c4e66e02..b0180de0b 100644--- a/moli-protocol/src/domains/page/protocol_neutral_tests.rs+++ b/moli-protocol/src/domains/page/protocol_neutral_tests.rs@@ -1,7 +1,7 @@-use crate::devtools_runtime::{- DevToolsCaptureScreenshotClip, DevToolsCaptureScreenshotCommand, DevToolsCommand,- DevToolsCommandContext, DevToolsPrintToPdfCommand, DevToolsPrintToPdfTransferMode,- DevToolsProtocol, DevToolsScreenshotClip, DevToolsTargetId,+use crate::automation::{+ AutomationCommand, AutomationContext, DevToolsCaptureScreenshotClip,+ DevToolsCaptureScreenshotCommand, DevToolsPrintToPdfCommand, DevToolsPrintToPdfTransferMode,+ DevToolsScreenshotClip, DevToolsTargetId, FrontendProtocol,};use serde_json::{Value, json};@@ -27,7 +27,7 @@ fn cdp_get_frame_tree_builds_protocol_neutral_command() {let command = build_cdp_get_frame_tree_command(&conn, &cmd);- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-page")@@ -50,7 +50,7 @@ fn devtools_page_entry_routes_get_frame_tree_command_to_page_owner() {let command = build_cdp_get_frame_tree_command(&conn, &cmd);let step =- start_devtools_page_command(&mut conn, cmd.id, DevToolsCommand::GetFrameTree(command));+ start_devtools_page_command(&mut conn, cmd.id, AutomationCommand::GetFrameTree(command));let PageCommandTaskStep::Complete(plan) = step else {panic!("missing browser context should complete through the unified page entry");@@ -76,7 +76,7 @@ fn cdp_get_layout_metrics_builds_protocol_neutral_command() {let command = build_cdp_get_layout_metrics_command(&conn, &cmd);- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-page")@@ -101,7 +101,7 @@ fn devtools_page_entry_routes_get_layout_metrics_command_to_page_owner() {let step = start_devtools_page_command(&mut conn,cmd.id,- DevToolsCommand::GetLayoutMetrics(command),+ AutomationCommand::GetLayoutMetrics(command),);let PageCommandTaskStep::Complete(plan) = step else {@@ -134,7 +134,7 @@ fn cdp_handle_javascript_dialog_builds_protocol_neutral_command() {panic!("valid handleJavaScriptDialog command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-page")@@ -164,7 +164,7 @@ fn devtools_page_entry_routes_handle_javascript_dialog_command_to_page_owner() {let step = start_devtools_page_command(&mut conn,cmd.id,- DevToolsCommand::HandleJavaScriptDialog(command),+ AutomationCommand::HandleJavaScriptDialog(command),);let PageCommandTaskStep::Complete(plan) = step else {@@ -200,7 +200,7 @@ fn cdp_capture_screenshot_builds_requested_capture_command() {panic!("valid captureScreenshot command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-page")@@ -318,8 +318,8 @@ fn cdp_capture_screenshot_rejects_invalid_quality_and_clip() {fn devtools_page_entry_validates_capture_screenshot_target_before_unsupported() {let mut conn = CdpConnection::new();let command = DevToolsCaptureScreenshotCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: None,target_id: Some(DevToolsTargetId::from("missing-target")),browser_context_id: None,@@ -334,7 +334,7 @@ fn devtools_page_entry_validates_capture_screenshot_target_before_unsupported()let step = start_devtools_page_command(&mut conn,Some(131),- DevToolsCommand::CaptureScreenshot(command),+ AutomationCommand::CaptureScreenshot(command),);let PageCommandTaskStep::Complete(plan) = step else {@@ -376,7 +376,7 @@ fn cdp_print_to_pdf_builds_protocol_neutral_command() {panic!("valid printToPDF command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-page")@@ -413,7 +413,8 @@ fn devtools_page_entry_reports_layout_disabled_without_placeholder_payload() {panic!("default printToPDF command should build");};- let step = start_devtools_page_command(&mut conn, cmd.id, DevToolsCommand::PrintToPdf(command));+ let step =+ start_devtools_page_command(&mut conn, cmd.id, AutomationCommand::PrintToPdf(command));let PageCommandTaskStep::Complete(plan) = step else {panic!("printToPDF command should complete through the unified page entry");@@ -434,8 +435,8 @@ fn devtools_page_entry_reports_layout_disabled_without_placeholder_payload() {fn devtools_page_entry_validates_print_to_pdf_target_before_unsupported() {let mut conn = CdpConnection::new();let command = DevToolsPrintToPdfCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: None,target_id: Some(DevToolsTargetId::from("missing-target")),browser_context_id: None,@@ -455,7 +456,7 @@ fn devtools_page_entry_validates_print_to_pdf_target_before_unsupported() {};let step =- start_devtools_page_command(&mut conn, Some(132), DevToolsCommand::PrintToPdf(command));+ start_devtools_page_command(&mut conn, Some(132), AutomationCommand::PrintToPdf(command));let PageCommandTaskStep::Complete(plan) = step else {panic!("print target validation should complete synchronously");diff --git a/moli-protocol/src/domains/page/resource_tree.rs b/moli-protocol/src/domains/page/resource_tree.rsindex 9ca98fa1e..452f810e3 100644--- a/moli-protocol/src/domains/page/resource_tree.rs+++ b/moli-protocol/src/domains/page/resource_tree.rs@@ -168,20 +168,20 @@ pub(crate) fn child_frame_security_identity(pub(super) async fn execute_devtools_get_frame_trees_command_async(conn: &mut CdpConnection,command: DevToolsGetFrameTreesCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let mut frame_trees = Vec::new();for target_info in devtools_browsing_context_target_infos(conn) {let Some(target_id) = target_info.target_id.clone() else {continue;};let frame_tree_command = DevToolsGetFrameTreeCommand {- context: DevToolsCommandContext {+ context: AutomationContext {target_id: Some(target_id),..command.context.clone()},max_depth: command.max_depth,};- let DevToolsCommandResult::GetFrameTree(frame_tree_result) =+ let AutomationResult::GetFrameTree(frame_tree_result) =execute_devtools_get_frame_tree_command_async(conn, frame_tree_command).await?else {return Err(DevToolsError::new(@@ -191,7 +191,7 @@ pub(super) async fn execute_devtools_get_frame_trees_command_async(};frame_trees.push(frame_tree_result);}- Ok(DevToolsCommandResult::GetFrameTrees(+ Ok(AutomationResult::GetFrameTrees(DevToolsGetFrameTreesResult { frame_trees },))}@@ -215,7 +215,7 @@ pub(super) fn devtools_browsing_context_target_infos(pub(super) async fn execute_devtools_get_frame_tree_command_async(conn: &mut CdpConnection,command: DevToolsGetFrameTreeCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let target_info = command.context.target_id@@ -229,14 +229,14 @@ pub(super) async fn execute_devtools_get_frame_tree_command_async(target_info.expect("service worker target info was checked"),command.max_depth,)- .map(DevToolsCommandResult::GetFrameTree);+ .map(AutomationResult::GetFrameTree);}let owner = page_command_owner(conn, &command.context)?;let max_depth = command.max_depth;devtools_frame_tree_for_current_owner_async(conn, command, &owner).await.map(|frame_tree| {- DevToolsCommandResult::GetFrameTree(DevToolsGetFrameTreeResult {+ AutomationResult::GetFrameTree(DevToolsGetFrameTreeResult {frame_tree,target_info,max_depth,@@ -440,7 +440,7 @@ pub(super) fn build_cdp_get_frame_tree_command(.map(|(browser_context_id, target_id)| (Some(browser_context_id), target_id)).unwrap_or((None, None));DevToolsGetFrameTreeCommand {- context: cmd.devtools_command_context(target_id.as_deref(), browser_context_id.as_deref()),+ context: cmd.automation_context(target_id.as_deref(), browser_context_id.as_deref()),max_depth: None,}}diff --git a/moli-protocol/src/domains/page/tests/capture.rs b/moli-protocol/src/domains/page/tests/capture.rsindex 2e3dd6770..d2c7d3679 100644--- a/moli-protocol/src/domains/page/tests/capture.rs+++ b/moli-protocol/src/domains/page/tests/capture.rs@@ -20,7 +20,7 @@ async fn native_snapshot_reads_live_url_and_html_before_adapter_settlement() {).await;let (pending, guard) = ctx.conn.loaded_page_mut_for_protocol_access(None).unwrap()- .start_native_frontend_command(1200, None, RendererNativeOperation::new(+ .start_cdp_call(1200, None, RendererNativeOperation::new(RendererPageCommand::EvaluateExpression {expression: "history.replaceState(null, '', '#current'); document.body.innerHTML = '<p>snapshot current</p>'".to_owned(),await_promise: false,diff --git a/moli-protocol/src/domains/page/tests/dialog.rs b/moli-protocol/src/domains/page/tests/dialog.rsindex e465e9c7c..5b825d58c 100644--- a/moli-protocol/src/domains/page/tests/dialog.rs+++ b/moli-protocol/src/domains/page/tests/dialog.rs@@ -344,24 +344,24 @@ async fn get_javascript_dialog_text_peeks_without_closing_dialog() {}).expect("target session state should exist");- let context = crate::devtools_runtime::DevToolsCommandContext {- protocol: crate::devtools_runtime::DevToolsProtocol::WebDriverClassic,- session_id: Some(crate::devtools_runtime::DevToolsSessionId::from("SID-1")),- target_id: Some(crate::devtools_runtime::DevToolsTargetId::from("TID-1")),+ let context = crate::automation::AutomationContext {+ protocol: crate::automation::FrontendProtocol::WebDriverClassic,+ session_id: Some(crate::automation::DevToolsSessionId::from("SID-1")),+ target_id: Some(crate::automation::DevToolsTargetId::from("TID-1")),browser_context_id: None,};let (result, _, _) = ctx.conn- .execute_devtools_command_with_protocol_events(- crate::devtools_runtime::DevToolsCommand::GetJavaScriptDialog(- crate::devtools_runtime::DevToolsGetJavaScriptDialogCommand {+ .execute_automation_command_with_protocol_events(+ crate::automation::AutomationCommand::GetJavaScriptDialog(+ crate::automation::DevToolsGetJavaScriptDialogCommand {context: context.clone(),},),).await.into_parts_with_protocol_events();- let crate::devtools_runtime::DevToolsCommandResult::JavaScriptDialog(result) =+ let crate::automation::AutomationResult::JavaScriptDialog(result) =result.expect("get dialog text should resolve")else {panic!("get dialog text should return dialog result");@@ -371,9 +371,9 @@ async fn get_javascript_dialog_text_peeks_without_closing_dialog() {let (result, _, events) = ctx.conn- .execute_devtools_command_with_protocol_events(- crate::devtools_runtime::DevToolsCommand::HandleJavaScriptDialog(- crate::devtools_runtime::DevToolsHandleJavaScriptDialogCommand {+ .execute_automation_command_with_protocol_events(+ crate::automation::AutomationCommand::HandleJavaScriptDialog(+ crate::automation::DevToolsHandleJavaScriptDialogCommand {context,accept: true,prompt_text: String::new(),@@ -384,7 +384,7 @@ async fn get_javascript_dialog_text_peeks_without_closing_dialog() {.into_parts_with_protocol_events();assert!(matches!(result.expect("handle dialog should resolve"),- crate::devtools_runtime::DevToolsCommandResult::Empty+ crate::automation::AutomationResult::Empty));let closed_event = events.into_iter()@@ -401,9 +401,7 @@ async fn get_javascript_dialog_text_peeks_without_closing_dialog() {assert_eq!(closed_message["params"]["frameId"], json!("TID-1"));assert!(matches!(closed_sidecar,- Some(crate::devtools_runtime::AutomationEvent::UserPromptClosed(- _- ))+ Some(crate::automation::AutomationEvent::UserPromptClosed(_))));}@@ -423,17 +421,17 @@ async fn set_javascript_dialog_prompt_text_is_used_when_accepting_prompt() {}).expect("target session state should exist");- let context = crate::devtools_runtime::DevToolsCommandContext {- protocol: crate::devtools_runtime::DevToolsProtocol::WebDriverClassic,- session_id: Some(crate::devtools_runtime::DevToolsSessionId::from("SID-1")),- target_id: Some(crate::devtools_runtime::DevToolsTargetId::from("TID-1")),+ let context = crate::automation::AutomationContext {+ protocol: crate::automation::FrontendProtocol::WebDriverClassic,+ session_id: Some(crate::automation::DevToolsSessionId::from("SID-1")),+ target_id: Some(crate::automation::DevToolsTargetId::from("TID-1")),browser_context_id: None,};let (result, _, _) = ctx.conn- .execute_devtools_command_with_protocol_events(- crate::devtools_runtime::DevToolsCommand::SetJavaScriptDialogPromptText(- crate::devtools_runtime::DevToolsSetJavaScriptDialogPromptTextCommand {+ .execute_automation_command_with_protocol_events(+ crate::automation::AutomationCommand::SetJavaScriptDialogPromptText(+ crate::automation::DevToolsSetJavaScriptDialogPromptTextCommand {context: context.clone(),prompt_text: "cheese".to_owned(),},@@ -443,14 +441,14 @@ async fn set_javascript_dialog_prompt_text_is_used_when_accepting_prompt() {.into_parts_with_protocol_events();assert!(matches!(result.expect("set prompt text should resolve"),- crate::devtools_runtime::DevToolsCommandResult::Empty+ crate::automation::AutomationResult::Empty));let (result, _, events) = ctx.conn- .execute_devtools_command_with_protocol_events(- crate::devtools_runtime::DevToolsCommand::HandleJavaScriptDialog(- crate::devtools_runtime::DevToolsHandleJavaScriptDialogCommand {+ .execute_automation_command_with_protocol_events(+ crate::automation::AutomationCommand::HandleJavaScriptDialog(+ crate::automation::DevToolsHandleJavaScriptDialogCommand {context,accept: true,prompt_text: String::new(),@@ -461,7 +459,7 @@ async fn set_javascript_dialog_prompt_text_is_used_when_accepting_prompt() {.into_parts_with_protocol_events();assert!(matches!(result.expect("accept prompt should resolve"),- crate::devtools_runtime::DevToolsCommandResult::Empty+ crate::automation::AutomationResult::Empty));let messages = events.into_iter()diff --git a/moli-protocol/src/domains/page/tests/frame_tree.rs b/moli-protocol/src/domains/page/tests/frame_tree.rsindex a2ed98d2b..30d998074 100644--- a/moli-protocol/src/domains/page/tests/frame_tree.rs+++ b/moli-protocol/src/domains/page/tests/frame_tree.rs@@ -799,20 +799,22 @@ async fn get_frame_tree_targets_service_worker_as_synthetic_context() {let (result, scheduler_events) = ctx.conn- .execute_devtools_command(DevToolsCommand::GetFrameTree(DevToolsGetFrameTreeCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,- session_id: None,- target_id: Some(DevToolsTargetId::from("TID-service-worker")),- browser_context_id: None,+ .execute_automation_command(AutomationCommand::GetFrameTree(+ DevToolsGetFrameTreeCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,+ session_id: None,+ target_id: Some(DevToolsTargetId::from("TID-service-worker")),+ browser_context_id: None,+ },+ max_depth: None,},- max_depth: None,- }))+ )).await.into_parts();assert!(scheduler_events.is_empty());- let DevToolsCommandResult::GetFrameTree(result) =+ let AutomationResult::GetFrameTree(result) =result.expect("GetFrameTree should target service worker")else {panic!("expected GetFrameTree result");@@ -828,7 +830,7 @@ async fn get_frame_tree_targets_service_worker_as_synthetic_context() {);assert_eq!(result.target_info.as_ref().map(|info| info.kind),- Some(crate::devtools_runtime::DevToolsTargetKind::ServiceWorker)+ Some(crate::automation::DevToolsTargetKind::ServiceWorker));}@@ -839,10 +841,10 @@ async fn get_frame_trees_includes_service_worker_target() {let (result, scheduler_events) = ctx.conn- .execute_devtools_command(DevToolsCommand::GetFrameTrees(+ .execute_automation_command(AutomationCommand::GetFrameTrees(DevToolsGetFrameTreesCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: None,target_id: None,browser_context_id: None,@@ -854,7 +856,7 @@ async fn get_frame_trees_includes_service_worker_target() {.into_parts();assert!(scheduler_events.is_empty());- let DevToolsCommandResult::GetFrameTrees(result) =+ let AutomationResult::GetFrameTrees(result) =result.expect("GetFrameTrees should include service worker targets")else {panic!("expected GetFrameTrees result");@@ -873,6 +875,6 @@ async fn get_frame_trees_includes_service_worker_target() {.target_info.as_ref().map(|info| info.kind),- Some(crate::devtools_runtime::DevToolsTargetKind::ServiceWorker)+ Some(crate::automation::DevToolsTargetKind::ServiceWorker));}diff --git a/moli-protocol/src/domains/page/tests/mod.rs b/moli-protocol/src/domains/page/tests/mod.rsindex 79f7fe6c1..bb2701683 100644--- a/moli-protocol/src/domains/page/tests/mod.rs+++ b/moli-protocol/src/domains/page/tests/mod.rs@@ -1,14 +1,14 @@use super::{LOADER_ID, build_mhtml_snapshot, child_frame_security_identity};+use crate::automation::{+ AutomationCommand, AutomationContext, AutomationEvent, AutomationResult,+ DevToolsGetFrameTreeCommand, DevToolsGetFrameTreesCommand, DevToolsTargetId, FrontendProtocol,+ NavigationFrameEventKind,+};use crate::conn::{BrowserContext, CdpCommandTaskStep, CdpSchedulerEvent, EmulatedDeviceMetrics,FetchInterceptionPattern, FetchRequestStage, NETWORK_ERROR_PAGE_URL, PageTargetHost,PendingCdpCommandDispatch, ServiceWorkerTargetState, URL_BASE,};-use crate::devtools_runtime::{- AutomationEvent, DevToolsCommand, DevToolsCommandContext, DevToolsCommandResult,- DevToolsGetFrameTreeCommand, DevToolsGetFrameTreesCommand, DevToolsProtocol, DevToolsTargetId,- NavigationFrameEventKind,-};use crate::testing::{TestContext, wait_until_frame_stopped_loading, wait_until_message, wait_until_messages,wait_until_renderer_document_load, wait_until_scheduler_message,diff --git a/moli-protocol/src/domains/runtime/activity.rs b/moli-protocol/src/domains/runtime/activity.rsindex 3c4dff66c..442b99ffc 100644--- a/moli-protocol/src/domains/runtime/activity.rs+++ b/moli-protocol/src/domains/runtime/activity.rs@@ -587,8 +587,8 @@ mod tests {use serde_json::Value;use serde_json::json;+ use crate::automation::AutomationEvent;use crate::conn::{BrowserContext, CdpConnection, CommandDispatchContext, CommandOwnerScope};- use crate::devtools_runtime::AutomationEvent;use crate::domains::activity::{ProtocolOutputPayloads, ProtocolOutputProjectionContext};use crate::testing::TestContext;diff --git a/moli-protocol/src/domains/runtime/bidi_nodes.rs b/moli-protocol/src/domains/runtime/bidi_nodes.rsindex 9686337b1..0bfd981f3 100644--- a/moli-protocol/src/domains/runtime/bidi_nodes.rs+++ b/moli-protocol/src/domains/runtime/bidi_nodes.rs@@ -4,11 +4,11 @@ use moli_core::page::{};use serde_json::{Map, Value, json};-use crate::conn::{CdpConnection, CommandOwnerScope};-use crate::devtools_runtime::{+use crate::automation::{DevToolsError, DevToolsErrorKind, DevToolsRemoteHandleId, DevToolsRemoteValue,DevToolsSerializationOptions, webdriver_bidi_node_shared_id_for_backend_node_id,};+use crate::conn::{CdpConnection, CommandOwnerScope};#[derive(Debug, Clone, Copy, PartialEq, Eq)]pub(super) enum BidiIncludeShadowTree {@@ -716,7 +716,7 @@ mod tests {use moli_page_types::{DocumentNodeSnapshot, DocumentSnapshotNodeId};use serde_json::{Value, json};- use crate::devtools_runtime::{DevToolsRemoteHandleId, DevToolsRemoteValue};+ use crate::automation::{DevToolsRemoteHandleId, DevToolsRemoteValue};use super::{BidiIncludeShadowTree, BidiNodeSerializationOptions,diff --git a/moli-protocol/src/domains/runtime/dispatcher.rs b/moli-protocol/src/domains/runtime/dispatcher.rsindex 562fef486..7fcbb6a40 100644--- a/moli-protocol/src/domains/runtime/dispatcher.rs+++ b/moli-protocol/src/domains/runtime/dispatcher.rs@@ -2,15 +2,15 @@ use std::collections::HashSet;use serde_json::{Map, Value, json};-use crate::devtools_runtime::{- DevToolsBidiChannelProperties, DevToolsCallFunctionCommand, DevToolsCommand,- DevToolsCommandContext, DevToolsCommandResult, DevToolsDomNodeReference, DevToolsError,- DevToolsErrorKind, DevToolsEvaluateScriptCommand, DevToolsGetFrameOwnerCommand,- DevToolsGetRealmsCommand, DevToolsGetRealmsResult, DevToolsLocateNodesCommand,- DevToolsLocateNodesLocator, DevToolsLocateNodesResult, DevToolsLocateNodesTextMatch,- DevToolsProtocol, DevToolsRealmId, DevToolsReleaseObjectsCommand, DevToolsRemoteHandleId,- DevToolsRemoteValue, DevToolsResolveNodeCommand, DevToolsResultOwnership,- DevToolsScriptException, DevToolsScriptResult, DevToolsSerializationOptions, DevToolsTargetId,+use crate::automation::{+ AutomationCommand, AutomationContext, AutomationResult, DevToolsBidiChannelProperties,+ DevToolsCallFunctionCommand, DevToolsDomNodeReference, DevToolsError, DevToolsErrorKind,+ DevToolsEvaluateScriptCommand, DevToolsGetFrameOwnerCommand, DevToolsGetRealmsCommand,+ DevToolsGetRealmsResult, DevToolsLocateNodesCommand, DevToolsLocateNodesLocator,+ DevToolsLocateNodesResult, DevToolsLocateNodesTextMatch, DevToolsRealmId,+ DevToolsReleaseObjectsCommand, DevToolsRemoteHandleId, DevToolsRemoteValue,+ DevToolsResolveNodeCommand, DevToolsResultOwnership, DevToolsScriptException,+ DevToolsScriptResult, DevToolsSerializationOptions, DevToolsTargetId, FrontendProtocol,RuntimeExecutionContextEvent, is_webdriver_bidi_node_shared_id,webdriver_bidi_node_shared_id_for_backend_node_id,};@@ -22,19 +22,19 @@ use moli_core::page::{use moli_page_types::RendererInspectorResponseDelivery;use crate::conn::{- BackgroundCommandResponsePayload, BackgroundCommandResponsePayloadRef, BackgroundProtocolEvent,- BidiChannelListenerResidence, BidiChannelOwnerAction, BidiChannelPageOwner, CdpConnection,- CdpRendererCommandAccess, CdpRendererCommandPolicy, CdpSchedulerEvent, CdpSessionRoute,- ClaimedPendingInspectorAwait, Cmd, CommandOwnerScope, CompletedMoliDiagnosticsDispatch,+ AutomationCommandDispatchOutcome, AutomationExecutionOutput, BackgroundCommandResponsePayload,+ BackgroundCommandResponsePayloadRef, BackgroundProtocolEvent, BidiChannelListenerResidence,+ BidiChannelOwnerAction, BidiChannelPageOwner, CdpConnection, CdpRendererCommandAccess,+ CdpRendererCommandPolicy, CdpSchedulerEvent, CdpSessionRoute, ClaimedPendingInspectorAwait,+ Cmd, CommandOwnerScope, CompletedMoliDiagnosticsDispatch,CompletedRuntimeBindingPageCommandDispatch, CompletedRuntimeChildDefaultContextLookupDispatch,CompletedRuntimeEnableEventsDispatch, CompletedRuntimeProtocolMessageDispatch,CompletedServiceWorkerRuntimeProtocolMessageDispatch,- CompletedSharedWorkerRuntimeProtocolMessageDispatch, DevToolsCommandDispatchOutcome,- DevToolsCommandExecutionOutput, DuplicatePendingRendererCommand, InspectorCommandDispatch,- ParsedCdpCommand, PendingBidiChannelListener, PendingMoliDiagnosticsDispatch,- PendingRuntimeBindingPageCommandDispatch, PendingRuntimeChildDefaultContextLookupDispatch,- PendingRuntimeEnableEventsDispatch, PendingRuntimeProtocolMessageDispatch,- PendingServiceWorkerRuntimeProtocolMessageDispatch,+ CompletedSharedWorkerRuntimeProtocolMessageDispatch, DuplicatePendingRendererCommand,+ InspectorCommandDispatch, ParsedCdpCommand, PendingBidiChannelListener,+ PendingMoliDiagnosticsDispatch, PendingRuntimeBindingPageCommandDispatch,+ PendingRuntimeChildDefaultContextLookupDispatch, PendingRuntimeEnableEventsDispatch,+ PendingRuntimeProtocolMessageDispatch, PendingServiceWorkerRuntimeProtocolMessageDispatch,PendingSharedWorkerRuntimeProtocolMessageDispatch, ProfilerInspectorCommand,RendererCommandDescriptor, RuntimeBindingDefinition, RuntimeEnableReplayEvent,RuntimeInspectorAsyncCompletionReceiver, RuntimeInspectorResponseReady,@@ -146,7 +146,7 @@ struct DevToolsRuntimeTarget {struct DevToolsRuntimeCommandDispatchState {internal_command_id: u64,- command_context: DevToolsCommandContext,+ command_context: AutomationContext,result_kind: DevToolsRuntimeCommandResultKind,result_ownership: DevToolsResultOwnership,serialization_options: Option<DevToolsSerializationOptions>,@@ -175,7 +175,7 @@ pub struct CompletedDevToolsRuntimeCommandDispatch {pub enum DevToolsRuntimeCommandTaskStep {Pending(Box<PendingDevToolsRuntimeCommandDispatch>),- Complete(Box<DevToolsCommandDispatchOutcome>),+ Complete(Box<AutomationCommandDispatchOutcome>),}impl PendingDevToolsRuntimeCommandDispatch {@@ -1208,19 +1208,19 @@ pub(crate) fn start_moli_diagnostics_command_dispatch(pub(crate) async fn execute_devtools_runtime_command_async_with_protocol_events(conn: &mut CdpConnection,- mut command: DevToolsCommand,-) -> DevToolsCommandExecutionOutput {- if let DevToolsCommand::GetRealms(command) = command {- return DevToolsCommandExecutionOutput::new(+ mut command: AutomationCommand,+) -> AutomationExecutionOutput {+ if let AutomationCommand::GetRealms(command) = command {+ return AutomationExecutionOutput::new(execute_devtools_get_realms_command_async(conn, command).await,);}- if let DevToolsCommand::ReleaseObjects(command) = command {- return DevToolsCommandExecutionOutput::new(+ if let AutomationCommand::ReleaseObjects(command) = command {+ return AutomationExecutionOutput::new(execute_devtools_release_objects_command_async(conn, command).await,);}- if let DevToolsCommand::LocateNodes(command) = command {+ if let AutomationCommand::LocateNodes(command) = command {return execute_devtools_locate_nodes_command_async(conn, command).await;}let result_kind = devtools_runtime_command_result_kind(&command);@@ -1228,7 +1228,7 @@ pub(crate) async fn execute_devtools_runtime_command_async_with_protocol_events(let serialization_options = devtools_runtime_serialization_options(&command);let target = match devtools_runtime_target_async(conn, &command).await {Ok(target) => target,- Err(error) => return DevToolsCommandExecutionOutput::new(Err(error)),+ Err(error) => return AutomationExecutionOutput::new(Err(error)),};// Control commands must reach their Inspector route without first asking// the Page owner for realm inventory. That owner can be the JavaScript@@ -1240,10 +1240,10 @@ pub(crate) async fn execute_devtools_runtime_command_async_with_protocol_events(DevToolsRuntimeCommandResultKind::Empty => None,};let target_owner = CommandOwnerScope::for_route(target.route.clone());- if let DevToolsCommand::CallFunction(call_function) = &mut command+ if let AutomationCommand::CallFunction(call_function) = &mut command&& matches!(call_function.context.protocol,- DevToolsProtocol::WebDriverBidi+ FrontendProtocol::WebDriverBidi)&& let Err(error) = remap_bidi_node_shared_references_for_target_async(conn,@@ -1253,7 +1253,7 @@ pub(crate) async fn execute_devtools_runtime_command_async_with_protocol_events().await{- return DevToolsCommandExecutionOutput::new(Err(error));+ return AutomationExecutionOutput::new(Err(error));}let validation_result = validate_protocol_neutral_runtime_handle_realms(conn,@@ -1262,7 +1262,7 @@ pub(crate) async fn execute_devtools_runtime_command_async_with_protocol_events(target_realm.as_ref(),);if let Err(error) = validation_result {- return DevToolsCommandExecutionOutput::new(Err(error));+ return AutomationExecutionOutput::new(Err(error));}let internal_command_id = conn.next_internal_runtime_command_id();let mut step =@@ -1278,7 +1278,7 @@ pub(crate) async fn execute_devtools_runtime_command_async_with_protocol_events(None,);let Some(response) = response else {- return DevToolsCommandExecutionOutput::from_parts(+ return AutomationExecutionOutput::from_parts(Err(DevToolsError::new(DevToolsErrorKind::Internal,"MissingDevToolsCommandResult",@@ -1288,7 +1288,7 @@ pub(crate) async fn execute_devtools_runtime_command_async_with_protocol_events();};if result_kind == DevToolsRuntimeCommandResultKind::Empty {- return DevToolsCommandExecutionOutput::from_parts(+ return AutomationExecutionOutput::from_parts(devtools_empty_result_from_response(response),protocol_events,renderer_output_predecessor,@@ -1301,7 +1301,7 @@ pub(crate) async fn execute_devtools_runtime_command_async_with_protocol_events() {Ok(result) => result,Err(error) => {- return DevToolsCommandExecutionOutput::from_parts(+ return AutomationExecutionOutput::from_parts(Err(error),protocol_events,renderer_output_predecessor,@@ -1347,7 +1347,7 @@ pub(crate) async fn execute_devtools_runtime_command_async_with_protocol_events(&result,target_realm.as_ref(),);- return DevToolsCommandExecutionOutput::from_parts(+ return AutomationExecutionOutput::from_parts(Ok(result),protocol_events,renderer_output_predecessor,@@ -1361,7 +1361,7 @@ pub(crate) async fn execute_devtools_runtime_command_async_with_protocol_events(.await{pending.forget_scheduler_deferred_inspector_reply(conn);- return DevToolsCommandExecutionOutput::from_parts(+ return AutomationExecutionOutput::from_parts(Err(DevToolsError::new(DevToolsErrorKind::Internal, message)),Vec::new(),None,@@ -1380,22 +1380,22 @@ pub(crate) async fn execute_devtools_runtime_command_async_with_protocol_events(impl CdpConnection {pub async fn start_devtools_runtime_command_dispatch(&mut self,- mut command: DevToolsCommand,+ mut command: AutomationCommand,) -> DevToolsRuntimeCommandTaskStep {let command_context = command.context().clone();- if let DevToolsCommand::GetRealms(command) = command {+ if let AutomationCommand::GetRealms(command) = command {let result = execute_devtools_get_realms_command_async(self, command).await;return self.complete_devtools_runtime_direct_result(command_context, result, Vec::new(), None).await;}- if let DevToolsCommand::ReleaseObjects(command) = command {+ if let AutomationCommand::ReleaseObjects(command) = command {let result = execute_devtools_release_objects_command_async(self, command).await;return self.complete_devtools_runtime_direct_result(command_context, result, Vec::new(), None).await;}- if let DevToolsCommand::LocateNodes(command) = command {+ if let AutomationCommand::LocateNodes(command) = command {let output = execute_devtools_locate_nodes_command_async(self, command).await;let (result, protocol_events, renderer_output_predecessor) = output.into_parts();return self@@ -1434,10 +1434,10 @@ impl CdpConnection {DevToolsRuntimeCommandResultKind::Empty => None,};let target_owner = CommandOwnerScope::for_route(target.route.clone());- if let DevToolsCommand::CallFunction(call_function) = &mut command+ if let AutomationCommand::CallFunction(call_function) = &mut command&& matches!(call_function.context.protocol,- DevToolsProtocol::WebDriverBidi+ FrontendProtocol::WebDriverBidi)&& let Err(error) = remap_bidi_node_shared_references_for_target_async(self,@@ -1631,13 +1631,13 @@ impl CdpConnection {async fn complete_devtools_runtime_direct_result(&mut self,- command_context: DevToolsCommandContext,- result: Result<DevToolsCommandResult, DevToolsError>,+ command_context: AutomationContext,+ result: Result<AutomationResult, DevToolsError>,protocol_events: Vec<BackgroundProtocolEvent>,renderer_output_predecessor: Option<moli_core::RendererOutputFence>,) -> DevToolsRuntimeCommandTaskStep {DevToolsRuntimeCommandTaskStep::Complete(Box::new(- self.finish_devtools_command_dispatch(+ self.finish_automation_command_dispatch(command_context,result,protocol_events,@@ -2131,9 +2131,9 @@ pub(crate) async fn execute_runtime_listener_command_for_owner(#[cfg(test)]mod protocol_neutral_tests {- use crate::devtools_runtime::{- DevToolsCallFunctionCommand, DevToolsCommand, DevToolsCommandContext, DevToolsProtocol,- DevToolsResultOwnership, RuntimeExecutionContextEvent,+ use crate::automation::{+ AutomationCommand, AutomationContext, DevToolsCallFunctionCommand, DevToolsResultOwnership,+ FrontendProtocol, RuntimeExecutionContextEvent,};use moli_core::RendererOwnerLocalHostId;use moli_core::page::{MAX_INSPECTOR_PROTOCOL_VALUE_DEPTH, RendererSharedWorkerConsoleMessage};@@ -2154,18 +2154,17 @@ mod protocol_neutral_tests {};use super::{DevToolsRuntimeTarget, RuntimeCommandTaskStep,- apply_shared_worker_runtime_completion_projection, build_cdp_call_function_command,+ apply_shared_worker_runtime_completion_projection,+ automation_command_has_bidi_script_channel_arguments, build_cdp_call_function_command,build_cdp_evaluate_script_command, cdp_call_argument_from_devtools_argument,devtools_call_function_cdp_arguments, devtools_call_function_declaration,- devtools_call_function_deserializes_bidi_local_values,- devtools_command_has_bidi_script_channel_arguments, locate_nodes_error_from_exception,+ devtools_call_function_deserializes_bidi_local_values, locate_nodes_error_from_exception,materialize_devtools_script_window_remote_value, start_console_inspector_command_dispatch,start_devtools_runtime_command,};- use crate::devtools_runtime::{- DevToolsCommandResult, DevToolsErrorKind, DevToolsLocateNodesLocator,- DevToolsRemoteHandleId, DevToolsRemoteValue, DevToolsScriptException, DevToolsScriptResult,- DevToolsTargetId,+ use crate::automation::{+ AutomationResult, DevToolsErrorKind, DevToolsLocateNodesLocator, DevToolsRemoteHandleId,+ DevToolsRemoteValue, DevToolsScriptException, DevToolsScriptResult, DevToolsTargetId,};fn worker_context_created_event(context_id: i64) -> RuntimeExecutionContextEvent {@@ -2331,7 +2330,7 @@ mod protocol_neutral_tests {let command = build_cdp_evaluate_script_command(&cmd, Some("TID-1"), Some("BID-1"), true);- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-1")@@ -2376,11 +2375,11 @@ mod protocol_neutral_tests {]}));let mut shape_only_result =- DevToolsCommandResult::Script(Box::new(DevToolsScriptResult::Value(shape_only)));+ AutomationResult::Script(Box::new(DevToolsScriptResult::Value(shape_only)));materialize_devtools_script_window_remote_value(&mut shape_only_result, &target);- let DevToolsCommandResult::Script(result) = shape_only_result else {+ let AutomationResult::Script(result) = shape_only_result else {panic!("expected script result");};let DevToolsScriptResult::Value(value) = *result else {@@ -2401,11 +2400,11 @@ mod protocol_neutral_tests {]}));let mut marked_result =- DevToolsCommandResult::Script(Box::new(DevToolsScriptResult::Value(marked_window)));+ AutomationResult::Script(Box::new(DevToolsScriptResult::Value(marked_window)));materialize_devtools_script_window_remote_value(&mut marked_result, &target);- let DevToolsCommandResult::Script(result) = marked_result else {+ let AutomationResult::Script(result) = marked_result else {panic!("expected script result");};let DevToolsScriptResult::Value(value) = *result else {@@ -2579,7 +2578,7 @@ mod protocol_neutral_tests {let command = build_cdp_call_function_command(&cmd, Some("TID-call"), Some("BID-call"));- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-call")@@ -2681,8 +2680,8 @@ mod protocol_neutral_tests {]});let command = DevToolsCallFunctionCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: None,target_id: None,browser_context_id: None,@@ -2759,8 +2758,8 @@ mod protocol_neutral_tests {#[test]fn bidi_call_function_deserializes_nested_unserializable_numbers_and_bigints() {let command = DevToolsCallFunctionCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: None,target_id: None,browser_context_id: None,@@ -2835,8 +2834,8 @@ mod protocol_neutral_tests {#[test]fn bidi_call_function_deserializes_channel_arguments() {let command = DevToolsCallFunctionCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: None,target_id: None,browser_context_id: None,@@ -2869,8 +2868,8 @@ mod protocol_neutral_tests {assert!(devtools_call_function_deserializes_bidi_local_values(&command));- assert!(devtools_command_has_bidi_script_channel_arguments(- &DevToolsCommand::CallFunction(command.clone())+ assert!(automation_command_has_bidi_script_channel_arguments(+ &AutomationCommand::CallFunction(command.clone())));let declaration = devtools_call_function_declaration(&command, true, 1);assert!(!declaration.contains("__moliBidiScriptMessageQueue"));@@ -2901,8 +2900,8 @@ mod protocol_neutral_tests {#[test]fn bidi_call_function_deserializes_nested_remote_references() {let command = DevToolsCallFunctionCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: None,target_id: None,browser_context_id: None,@@ -2990,8 +2989,8 @@ mod protocol_neutral_tests {#[test]fn bidi_call_function_treats_remote_collection_preview_nodes_as_inert() {let command = DevToolsCallFunctionCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: None,target_id: None,browser_context_id: None,@@ -3037,8 +3036,8 @@ mod protocol_neutral_tests {#[test]fn bidi_call_function_passes_remote_node_reference_as_remote_handle() {let command = DevToolsCallFunctionCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: None,target_id: None,browser_context_id: None,@@ -3100,7 +3099,7 @@ mod protocol_neutral_tests {let step = start_devtools_runtime_command(&mut conn,&cmd,- DevToolsCommand::EvaluateScript(command),+ AutomationCommand::EvaluateScript(command),cmd.json.to_owned(),false,RendererInspectorResponseDelivery::AdapterReply,@@ -3144,7 +3143,7 @@ mod protocol_neutral_tests {let step = start_devtools_runtime_command(&mut conn,&cmd,- DevToolsCommand::EvaluateScript(command),+ AutomationCommand::EvaluateScript(command),cmd.json.to_owned(),true,RendererInspectorResponseDelivery::AdapterReply,diff --git a/moli-protocol/src/domains/runtime/dispatcher/bidi_channels.rs b/moli-protocol/src/domains/runtime/dispatcher/bidi_channels.rsindex 064256ab4..2491b339d 100644--- a/moli-protocol/src/domains/runtime/dispatcher/bidi_channels.rs+++ b/moli-protocol/src/domains/runtime/dispatcher/bidi_channels.rs@@ -124,9 +124,9 @@ pub(super) async fn bidi_preload_channel_proxy_handle_async(let value = devtools_probe_remote_value_async(conn,target.clone(),- DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: None,target_id: None,browser_context_id: None,@@ -277,9 +277,9 @@ pub(super) async fn create_bidi_channel_proxy_async(let value = Box::pin(devtools_probe_remote_value_async(conn,call_target,- DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ AutomationCommand::CallFunction(DevToolsCallFunctionCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: None,target_id: command_target_id,browser_context_id: None,diff --git a/moli-protocol/src/domains/runtime/dispatcher/bidi_script_values.rs b/moli-protocol/src/domains/runtime/dispatcher/bidi_script_values.rsindex e85fce312..93f4c0d1b 100644--- a/moli-protocol/src/domains/runtime/dispatcher/bidi_script_values.rs+++ b/moli-protocol/src/domains/runtime/dispatcher/bidi_script_values.rs@@ -3,12 +3,12 @@ use super::*;pub(super) async fn start_protocol_neutral_runtime_command(conn: &mut CdpConnection,target: DevToolsRuntimeTarget,- command: DevToolsCommand,+ command: AutomationCommand,internal_command_id: u64,) -> RuntimeCommandTaskStep {let owner = CommandOwnerScope::for_route(target.route.clone());match command {- DevToolsCommand::EvaluateScript(command) => {+ AutomationCommand::EvaluateScript(command) => {let params = devtools_evaluate_script_params(&command, target.execution_context_id);let json =runtime_inspector_command_json(internal_command_id, "Runtime.evaluate", ¶ms);@@ -23,7 +23,7 @@ pub(super) async fn start_protocol_neutral_runtime_command(};let cmd = Cmd::from_parsed(&parsed).expect("synthesized Runtime command must contain a domain separator");- let command = DevToolsCommand::EvaluateScript(command);+ let command = AutomationCommand::EvaluateScript(command);match prepare_pending_devtools_runtime_inspector_json_for_owner(conn, &cmd, &owner, &command,) {@@ -41,8 +41,8 @@ pub(super) async fn start_protocol_neutral_runtime_command(}}}- DevToolsCommand::CallFunction(mut command) => {- if matches!(command.context.protocol, DevToolsProtocol::WebDriverBidi)+ AutomationCommand::CallFunction(mut command) => {+ if matches!(command.context.protocol, FrontendProtocol::WebDriverBidi)&& let Err(message) = Box::pin(materialize_bidi_channel_argument_proxies_async(conn,&target,@@ -80,7 +80,7 @@ pub(super) async fn start_protocol_neutral_runtime_command(};let cmd = Cmd::from_parsed(&parsed).expect("synthesized Runtime command must contain a domain separator");- let command = DevToolsCommand::CallFunction(command);+ let command = AutomationCommand::CallFunction(command);match prepare_pending_devtools_runtime_inspector_json_for_owner(conn, &cmd, &owner, &command,) {@@ -104,7 +104,7 @@ pub(super) async fn start_protocol_neutral_runtime_command()),}}- DevToolsCommand::TerminateExecution(_) => {+ AutomationCommand::TerminateExecution(_) => {let json = runtime_inspector_command_json(internal_command_id,"Runtime.terminateExecution",@@ -495,7 +495,7 @@ pub(super) fn devtools_call_function_cdp_arguments(pub(super) fn devtools_call_function_deserializes_bidi_local_values(command: &DevToolsCallFunctionCommand,) -> bool {- matches!(command.context.protocol, DevToolsProtocol::WebDriverBidi)+ matches!(command.context.protocol, FrontendProtocol::WebDriverBidi)&& command.this_parameter.iter()diff --git a/moli-protocol/src/domains/runtime/dispatcher/dispatch.rs b/moli-protocol/src/domains/runtime/dispatcher/dispatch.rsindex 40cafdca8..8a3c262f5 100644--- a/moli-protocol/src/domains/runtime/dispatcher/dispatch.rs+++ b/moli-protocol/src/domains/runtime/dispatcher/dispatch.rs@@ -920,7 +920,7 @@ pub(super) fn start_cdp_devtools_script_runtime_command(let await_promise = runtime_command_awaits_promise(cmd, action);let command = match command_kind {RuntimeDevToolsScriptCommand::Evaluate => {- DevToolsCommand::EvaluateScript(build_cdp_evaluate_script_command(+ AutomationCommand::EvaluateScript(build_cdp_evaluate_script_command(cmd,target_id.as_deref(),browser_context_id.as_deref(),@@ -928,7 +928,7 @@ pub(super) fn start_cdp_devtools_script_runtime_command())}RuntimeDevToolsScriptCommand::CallFunctionOn => {- DevToolsCommand::CallFunction(build_cdp_call_function_command(+ AutomationCommand::CallFunction(build_cdp_call_function_command(cmd,target_id.as_deref(),browser_context_id.as_deref(),@@ -955,7 +955,7 @@ pub(super) fn start_cdp_devtools_script_runtime_command(pub(super) fn prepare_pending_devtools_runtime_inspector_json(conn: &CdpConnection,cmd: &Cmd<'_>,- command: &DevToolsCommand,+ command: &AutomationCommand,) -> Result<String, String> {let owner = CommandOwnerScope::capture(conn, cmd.session_id);prepare_pending_devtools_runtime_inspector_json_for_owner(conn, cmd, &owner, command)@@ -965,11 +965,11 @@ pub(super) fn prepare_pending_devtools_runtime_inspector_json_for_owner(conn: &CdpConnection,cmd: &Cmd<'_>,owner: &CommandOwnerScope,- command: &DevToolsCommand,+ command: &AutomationCommand,) -> Result<String, String> {match command {- DevToolsCommand::EvaluateScript(_) => Ok(cmd.json.to_owned()),- DevToolsCommand::CallFunction(command) => {+ AutomationCommand::EvaluateScript(_) => Ok(cmd.json.to_owned()),+ AutomationCommand::CallFunction(command) => {prepare_pending_devtools_call_function_json_for_owner(conn, cmd, owner, command)}_ => Err("UnsupportedDevToolsCommand".to_owned()),@@ -979,7 +979,7 @@ pub(super) fn prepare_pending_devtools_runtime_inspector_json_for_owner(pub(super) fn start_devtools_runtime_command(conn: &mut CdpConnection,cmd: &Cmd<'_>,- command: DevToolsCommand,+ command: AutomationCommand,inspector_json: String,wait_for_deferred_reply: bool,response_delivery: RendererInspectorResponseDelivery,@@ -999,17 +999,17 @@ pub(super) fn start_devtools_runtime_command(pub(super) fn start_devtools_runtime_command_for_owner(conn: &mut CdpConnection,cmd: &Cmd<'_>,- command: DevToolsCommand,+ command: AutomationCommand,inspector_json: String,wait_for_deferred_reply: bool,response_delivery: RendererInspectorResponseDelivery,owner_scope: CommandOwnerScope,) -> RuntimeCommandTaskStep {let (action, action_label, await_promise) = match &command {- DevToolsCommand::EvaluateScript(command) => {+ AutomationCommand::EvaluateScript(command) => {(RuntimeAction::Evaluate, "evaluate", command.await_promise)}- DevToolsCommand::CallFunction(command) => (+ AutomationCommand::CallFunction(command) => (RuntimeAction::CallFunctionOn,"callFunctionOn",command.await_promise,diff --git a/moli-protocol/src/domains/runtime/dispatcher/locate_nodes.rs b/moli-protocol/src/domains/runtime/dispatcher/locate_nodes.rsindex c3c15b25c..362295712 100644--- a/moli-protocol/src/domains/runtime/dispatcher/locate_nodes.rs+++ b/moli-protocol/src/domains/runtime/dispatcher/locate_nodes.rs@@ -3,16 +3,16 @@ use super::*;pub(super) async fn execute_devtools_locate_nodes_command_async(conn: &mut CdpConnection,mut command: DevToolsLocateNodesCommand,-) -> DevToolsCommandExecutionOutput {+) -> AutomationExecutionOutput {if matches!(&command.locator, DevToolsLocateNodesLocator::Context(_)) {return execute_devtools_locate_nodes_context_command_async(conn, command).await;}let target =- match devtools_runtime_target_async(conn, &DevToolsCommand::LocateNodes(command.clone()))+ match devtools_runtime_target_async(conn, &AutomationCommand::LocateNodes(command.clone())).await{Ok(target) => target,- Err(error) => return DevToolsCommandExecutionOutput::new(Err(error)),+ Err(error) => return AutomationExecutionOutput::new(Err(error)),};let context = command.context.clone();let locator = command.locator.clone();@@ -27,17 +27,17 @@ pub(super) async fn execute_devtools_locate_nodes_command_async(.await{Ok(inputs) => inputs,- Err(error) => return DevToolsCommandExecutionOutput::new(Err(error)),+ Err(error) => return AutomationExecutionOutput::new(Err(error)),};let (start_node_arguments, start_node_handles) =match resolve_locate_nodes_start_node_inputs(conn, &context, start_node_inputs).await {Ok(arguments) => arguments,- Err(error) => return DevToolsCommandExecutionOutput::new(Err(error)),+ Err(error) => return AutomationExecutionOutput::new(Err(error)),};let call_function = locate_nodes_call_function_command(command, start_node_arguments);let output = Box::pin(execute_devtools_runtime_command_async_with_protocol_events(conn,- DevToolsCommand::CallFunction(call_function),+ AutomationCommand::CallFunction(call_function),)).await;let (result, protocol_events, renderer_output_predecessor) = output.into_parts();@@ -48,13 +48,13 @@ pub(super) async fn execute_devtools_locate_nodes_command_async(}Err(error) => Err(error),};- DevToolsCommandExecutionOutput::from_parts(result, protocol_events, renderer_output_predecessor)+ AutomationExecutionOutput::from_parts(result, protocol_events, renderer_output_predecessor)}pub(super) async fn execute_devtools_locate_nodes_context_command_async(conn: &mut CdpConnection,command: DevToolsLocateNodesCommand,-) -> DevToolsCommandExecutionOutput {+) -> AutomationExecutionOutput {let DevToolsLocateNodesCommand {context,locator,@@ -64,13 +64,13 @@ pub(super) async fn execute_devtools_locate_nodes_context_command_async(..} = command;let DevToolsLocateNodesLocator::Context(ref frame_id) = locator else {- return DevToolsCommandExecutionOutput::new(Err(DevToolsError::new(+ return AutomationExecutionOutput::new(Err(DevToolsError::new(DevToolsErrorKind::Internal,"UnexpectedLocateNodesContextLocator",)));};if !start_nodes.is_empty() || !start_node_references.is_empty() {- return DevToolsCommandExecutionOutput::new(Err(DevToolsError::new(+ return AutomationExecutionOutput::new(Err(DevToolsError::new(DevToolsErrorKind::InvalidArgument,"Start nodes are not supported",)));@@ -78,7 +78,7 @@ pub(super) async fn execute_devtools_locate_nodes_context_command_async(let owner_result = match crate::domains::dom::execute_devtools_dom_command_async(conn,- DevToolsCommand::GetFrameOwner(DevToolsGetFrameOwnerCommand {+ AutomationCommand::GetFrameOwner(DevToolsGetFrameOwnerCommand {context: context.clone(),frame_id: frame_id.clone(),}),@@ -87,10 +87,10 @@ pub(super) async fn execute_devtools_locate_nodes_context_command_async(.map_err(locate_nodes_context_owner_error){Ok(result) => result,- Err(error) => return DevToolsCommandExecutionOutput::new(Err(error)),+ Err(error) => return AutomationExecutionOutput::new(Err(error)),};- let DevToolsCommandResult::GetFrameOwner(owner_result) = owner_result else {- return DevToolsCommandExecutionOutput::new(Err(DevToolsError::new(+ let AutomationResult::GetFrameOwner(owner_result) = owner_result else {+ return AutomationExecutionOutput::new(Err(DevToolsError::new(DevToolsErrorKind::Internal,"UnexpectedLocateNodesFrameOwnerResult",)));@@ -112,7 +112,7 @@ pub(super) async fn execute_devtools_locate_nodes_context_command_async(.map_err(locate_nodes_context_owner_error){Ok(arguments) => arguments,- Err(error) => return DevToolsCommandExecutionOutput::new(Err(error)),+ Err(error) => return AutomationExecutionOutput::new(Err(error)),};let call_function_context = context.clone();let call_function = DevToolsCallFunctionCommand {@@ -146,14 +146,14 @@ pub(super) async fn execute_devtools_locate_nodes_context_command_async(};let output = Box::pin(execute_devtools_runtime_command_async_with_protocol_events(conn,- DevToolsCommand::CallFunction(call_function),+ AutomationCommand::CallFunction(call_function),)).await;let (result, protocol_events, renderer_output_predecessor) = output.into_parts();release_locate_nodes_start_node_handles(conn, context, start_node_handles).await;let result = result.and_then(|result| {let mut result = locate_nodes_result_from_script_result(result, &locator)?;- if let DevToolsCommandResult::LocateNodes(result) = &mut result+ if let AutomationResult::LocateNodes(result) = &mut result&& result.node_ids.is_empty(){result.node_ids.push(owner_node_id);@@ -163,7 +163,7 @@ pub(super) async fn execute_devtools_locate_nodes_context_command_async(}Ok(result)});- DevToolsCommandExecutionOutput::from_parts(result, protocol_events, renderer_output_predecessor)+ AutomationExecutionOutput::from_parts(result, protocol_events, renderer_output_predecessor)}pub(super) fn locate_nodes_context_owner_error(error: DevToolsError) -> DevToolsError {@@ -286,7 +286,7 @@ pub(super) async fn renderer_locate_nodes_start_node_reference_for_shared_id_asypub(super) async fn resolve_locate_nodes_start_node_inputs(conn: &mut CdpConnection,- context: &DevToolsCommandContext,+ context: &AutomationContext,inputs: Vec<LocateNodesStartNodeInput>,) -> Result<(Vec<Value>, Vec<DevToolsRemoteHandleId>), DevToolsError> {let mut arguments = Vec::with_capacity(inputs.len());@@ -319,7 +319,7 @@ pub(super) async fn resolve_locate_nodes_start_node_inputs(pub(super) async fn resolve_locate_nodes_start_node_reference_arguments(conn: &mut CdpConnection,- context: &DevToolsCommandContext,+ context: &AutomationContext,references: Vec<DevToolsDomNodeReference>,) -> Result<(Vec<Value>, Vec<DevToolsRemoteHandleId>), DevToolsError> {let mut arguments = Vec::with_capacity(references.len());@@ -327,7 +327,7 @@ pub(super) async fn resolve_locate_nodes_start_node_reference_arguments(for reference in references {let result = crate::domains::dom::execute_devtools_dom_command_async(conn,- DevToolsCommand::ResolveNode(DevToolsResolveNodeCommand {+ AutomationCommand::ResolveNode(DevToolsResolveNodeCommand {context: context.clone(),reference,execution_context_id: None,@@ -342,7 +342,7 @@ pub(super) async fn resolve_locate_nodes_start_node_reference_arguments(return Err(error);}};- let DevToolsCommandResult::ResolveNode(result) = result else {+ let AutomationResult::ResolveNode(result) = result else {release_locate_nodes_start_node_handles(conn, context.clone(), handles).await;return Err(DevToolsError::new(DevToolsErrorKind::Internal,@@ -369,7 +369,7 @@ pub(super) async fn resolve_locate_nodes_start_node_reference_arguments(pub(super) async fn release_locate_nodes_start_node_handles(conn: &mut CdpConnection,- context: DevToolsCommandContext,+ context: AutomationContext,handles: Vec<DevToolsRemoteHandleId>,) {if handles.is_empty() {@@ -660,11 +660,11 @@ pub(super) fn locate_nodes_function_declaration(pub(super) async fn locate_nodes_result_from_script_result_async(conn: &mut CdpConnection,target: &DevToolsRuntimeTarget,- result: DevToolsCommandResult,+ result: AutomationResult,locator: &DevToolsLocateNodesLocator,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let mut result = locate_nodes_result_from_script_result(result, locator)?;- if let DevToolsCommandResult::LocateNodes(result) = &mut result {+ if let AutomationResult::LocateNodes(result) = &mut result {materialize_locate_nodes_result_node_ids_async(conn, target, result).await;}Ok(result)@@ -730,10 +730,10 @@ pub(super) fn frontend_node_id_for_locate_node_snapshot(}pub(super) fn locate_nodes_result_from_script_result(- result: DevToolsCommandResult,+ result: AutomationResult,locator: &DevToolsLocateNodesLocator,-) -> Result<DevToolsCommandResult, DevToolsError> {- let DevToolsCommandResult::Script(result) = result else {+) -> Result<AutomationResult, DevToolsError> {+ let AutomationResult::Script(result) = result else {return Err(DevToolsError::new(DevToolsErrorKind::Internal,"UnexpectedLocateNodesResult",@@ -755,12 +755,10 @@ pub(super) fn locate_nodes_result_from_script_result("LocateNodesUnexpectedSerializedArray",));};- Ok(DevToolsCommandResult::LocateNodes(- DevToolsLocateNodesResult {- node_ids: nodes.iter().filter_map(|node| node.node_id).collect(),- nodes,- },- ))+ Ok(AutomationResult::LocateNodes(DevToolsLocateNodesResult {+ node_ids: nodes.iter().filter_map(|node| node.node_id).collect(),+ nodes,+ }))}DevToolsScriptResult::Exception(exception) => {Err(locate_nodes_error_from_exception(exception, locator))diff --git a/moli-protocol/src/domains/runtime/dispatcher/node_values.rs b/moli-protocol/src/domains/runtime/dispatcher/node_values.rsindex 80a239bb0..656af6807 100644--- a/moli-protocol/src/domains/runtime/dispatcher/node_values.rs+++ b/moli-protocol/src/domains/runtime/dispatcher/node_values.rs@@ -209,7 +209,7 @@ pub(super) fn json_pointer_matches_or_descends_from(pointer: &str, ancestor: &stpub(super) async fn materialize_devtools_script_node_remote_value_async(conn: &mut CdpConnection,- result: &mut DevToolsCommandResult,+ result: &mut AutomationResult,serialization_options: Option<&DevToolsSerializationOptions>,target: &DevToolsRuntimeTarget,realm_id: Option<&DevToolsRealmId>,@@ -310,7 +310,7 @@ pub(super) async fn materialize_devtools_script_node_remote_value_async(pub(super) async fn materialize_devtools_script_deep_serialized_node_remote_values_async(conn: &mut CdpConnection,- result: &mut DevToolsCommandResult,+ result: &mut AutomationResult,serialization_options: Option<&DevToolsSerializationOptions>,target: &DevToolsRuntimeTarget,realm_id: Option<&DevToolsRealmId>,@@ -373,7 +373,7 @@ pub(super) async fn materialize_devtools_script_deep_serialized_node_remote_valupub(super) async fn materialize_devtools_script_dom_collection_remote_value_async(conn: &mut CdpConnection,- result: &mut DevToolsCommandResult,+ result: &mut AutomationResult,serialization_options: Option<&DevToolsSerializationOptions>,target: &DevToolsRuntimeTarget,realm_id: Option<&DevToolsRealmId>,@@ -425,9 +425,9 @@ pub(super) async fn devtools_dom_collection_probe_async(target: &DevToolsRuntimeTarget,root_object_id: &str,) -> Result<Option<BidiDomCollectionProbe>, DevToolsError> {- let command = DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let command = AutomationCommand::CallFunction(DevToolsCallFunctionCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: None,target_id: target.window_context_id.clone(),browser_context_id: None,@@ -753,9 +753,9 @@ pub(super) async fn devtools_deep_serialized_path_remote_value_async(js_path: &[Value],serialization_options: Option<&DevToolsSerializationOptions>,) -> Result<Option<DevToolsRemoteValue>, DevToolsError> {- let command = DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let command = AutomationCommand::CallFunction(DevToolsCallFunctionCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: None,target_id: target.window_context_id.clone(),browser_context_id: None,@@ -905,9 +905,9 @@ pub(super) async fn devtools_detached_node_value_async(remote_object_id: String,node_options: &BidiNodeSerializationOptions,) -> Result<Option<Value>, DevToolsError> {- let command = DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let command = AutomationCommand::CallFunction(DevToolsCallFunctionCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: None,target_id: target.window_context_id.clone(),browser_context_id: None,@@ -1021,9 +1021,9 @@ pub(super) async fn devtools_attribute_node_value_async(target: &DevToolsRuntimeTarget,remote_object_id: String,) -> Result<Option<Value>, DevToolsError> {- let command = DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let command = AutomationCommand::CallFunction(DevToolsCallFunctionCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: None,target_id: target.window_context_id.clone(),browser_context_id: None,diff --git a/moli-protocol/src/domains/runtime/dispatcher/remote_values.rs b/moli-protocol/src/domains/runtime/dispatcher/remote_values.rsindex 7d17534c8..a6b11588f 100644--- a/moli-protocol/src/domains/runtime/dispatcher/remote_values.rs+++ b/moli-protocol/src/domains/runtime/dispatcher/remote_values.rs@@ -164,7 +164,7 @@ pub(super) fn devtools_script_result_from_response(response: Value,result_ownership: DevToolsResultOwnership,target_realm: Option<DevToolsRealmId>,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {if let Some(error) = response.get("error") {return Err(devtools_error_from_cdp_error_value(error));}@@ -177,12 +177,12 @@ pub(super) fn devtools_script_result_from_response(if exception.realm.is_none() {exception.realm = target_realm;}- return Ok(DevToolsCommandResult::Script(Box::new(+ return Ok(AutomationResult::Script(Box::new(DevToolsScriptResult::Exception(exception),)));}let remote = result.get("result").unwrap_or(&Value::Null);- Ok(DevToolsCommandResult::Script(Box::new(+ Ok(AutomationResult::Script(Box::new(DevToolsScriptResult::Value(devtools_remote_value_from_cdp(remote,matches!(result_ownership, DevToolsResultOwnership::Root),@@ -193,23 +193,23 @@ pub(super) fn devtools_script_result_from_response(pub(super) fn devtools_empty_result_from_response(response: Value,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {if let Some(error) = response.get("error") {return Err(devtools_error_from_cdp_error_value(error));}- Ok(DevToolsCommandResult::Empty)+ Ok(AutomationResult::Empty)}pub(super) fn validate_protocol_neutral_runtime_handle_realms(conn: &CdpConnection,owner: &CommandOwnerScope,- command: &DevToolsCommand,+ command: &AutomationCommand,target_realm: Option<&DevToolsRealmId>,) -> Result<(), DevToolsError> {- let DevToolsCommand::CallFunction(command) = command else {+ let AutomationCommand::CallFunction(command) = command else {return Ok(());};- if command.context.protocol != DevToolsProtocol::WebDriverBidi {+ if command.context.protocol != FrontendProtocol::WebDriverBidi {return Ok(());}@@ -246,10 +246,10 @@ pub(super) fn validate_protocol_neutral_runtime_handle_realms(pub(super) fn register_devtools_script_result_remote_object_realm(conn: &mut CdpConnection,owner: &CommandOwnerScope,- result: &DevToolsCommandResult,+ result: &AutomationResult,realm_id: Option<&DevToolsRealmId>,) {- let (DevToolsCommandResult::Script(result), Some(realm_id)) = (result, realm_id) else {+ let (AutomationResult::Script(result), Some(realm_id)) = (result, realm_id) else {return;};let DevToolsScriptResult::Value(value) = result.as_ref() else {@@ -279,7 +279,7 @@ pub(super) fn register_devtools_script_result_remote_object_realm(pub(super) fn register_devtools_script_result_remote_object(conn: &mut CdpConnection,owner: &CommandOwnerScope,- result: &DevToolsCommandResult,+ result: &AutomationResult,) {let Some(value) = devtools_script_result_remote_value(result) else {return;@@ -294,7 +294,7 @@ pub(super) fn register_devtools_script_result_remote_object(}pub(super) fn materialize_devtools_script_window_remote_value(- result: &mut DevToolsCommandResult,+ result: &mut AutomationResult,target: &DevToolsRuntimeTarget,) {let Some(target_window_context_id) = target.window_context_id.clone() else {@@ -366,7 +366,7 @@ pub(super) fn deep_serialized_string_value(value: &Value) -> Option<String> {}pub(super) fn devtools_window_remote_candidate(- result: &DevToolsCommandResult,+ result: &AutomationResult,) -> Option<DevToolsWindowRemoteCandidate> {let value = devtools_script_result_remote_value(result)?;Some(DevToolsWindowRemoteCandidate {@@ -377,7 +377,7 @@ pub(super) fn devtools_window_remote_candidate(pub(super) async fn devtools_probe_remote_value_async(conn: &mut CdpConnection,target: DevToolsRuntimeTarget,- command: DevToolsCommand,+ command: AutomationCommand,) -> Result<Option<DevToolsRemoteValue>, DevToolsError> {let result_ownership = devtools_runtime_result_ownership(&command);let internal_command_id = conn.next_internal_runtime_command_id();@@ -399,7 +399,7 @@ pub(super) async fn devtools_probe_remote_value_async(};let result =devtools_script_result_from_response(response, result_ownership, None)?;- let DevToolsCommandResult::Script(result) = result else {+ let AutomationResult::Script(result) = result else {return Ok(None);};let DevToolsScriptResult::Value(value) = *result else {@@ -417,7 +417,7 @@ pub(super) async fn devtools_probe_remote_value_async(pub(super) async fn materialize_devtools_script_deep_serialized_root_value_async(conn: &mut CdpConnection,- result: &mut DevToolsCommandResult,+ result: &mut AutomationResult,serialization_options: Option<&DevToolsSerializationOptions>,target: &DevToolsRuntimeTarget,) {@@ -441,9 +441,9 @@ pub(super) async fn materialize_devtools_script_deep_serialized_root_value_asyncreturn;};- let command = DevToolsCommand::CallFunction(DevToolsCallFunctionCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ let command = AutomationCommand::CallFunction(DevToolsCallFunctionCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: None,target_id: target.window_context_id.clone(),browser_context_id: None,@@ -485,9 +485,9 @@ pub(super) async fn materialize_devtools_script_deep_serialized_root_value_async}pub(super) fn devtools_script_result_remote_value(- result: &DevToolsCommandResult,+ result: &AutomationResult,) -> Option<&DevToolsRemoteValue> {- let DevToolsCommandResult::Script(result) = result else {+ let AutomationResult::Script(result) = result else {return None;};match result.as_ref() {@@ -497,9 +497,9 @@ pub(super) fn devtools_script_result_remote_value(}pub(super) fn devtools_script_result_remote_value_mut(- result: &mut DevToolsCommandResult,+ result: &mut AutomationResult,) -> Option<&mut DevToolsRemoteValue> {- let DevToolsCommandResult::Script(result) = result else {+ let AutomationResult::Script(result) = result else {return None;};match result.as_mut() {@@ -547,7 +547,7 @@ pub(super) fn bidi_script_message_serialization_options_from_value(pub(super) async fn devtools_probe_value_async(conn: &mut CdpConnection,target: DevToolsRuntimeTarget,- command: DevToolsCommand,+ command: AutomationCommand,) -> Result<Option<Value>, DevToolsError> {let Some(value) = devtools_probe_remote_value_async(conn, target, command).await? else {return Ok(None);diff --git a/moli-protocol/src/domains/runtime/dispatcher/runtime_command_flow.rs b/moli-protocol/src/domains/runtime/dispatcher/runtime_command_flow.rsindex e270cb9f3..bef41bca5 100644--- a/moli-protocol/src/domains/runtime/dispatcher/runtime_command_flow.rs+++ b/moli-protocol/src/domains/runtime/dispatcher/runtime_command_flow.rs@@ -54,7 +54,7 @@ pub(super) fn build_cdp_evaluate_script_command(await_promise: bool,) -> DevToolsEvaluateScriptCommand {DevToolsEvaluateScriptCommand {- context: cmd.devtools_command_context(target_id, browser_context_id),+ context: cmd.automation_context(target_id, browser_context_id),realm_id: None,world_name: None,expression: cdp_evaluate_expression_from_params(cmd.params).unwrap_or_default(),@@ -130,7 +130,7 @@ pub(super) fn build_cdp_call_function_command(browser_context_id: Option<&str>,) -> DevToolsCallFunctionCommand {DevToolsCallFunctionCommand {- context: cmd.devtools_command_context(target_id, browser_context_id),+ context: cmd.automation_context(target_id, browser_context_id),realm_id: cdp_call_function_realm_id_from_params(cmd.params),world_name: None,object_id: runtime_object_id_from_params(cmd.params).map(DevToolsRemoteHandleId::from),diff --git a/moli-protocol/src/domains/runtime/dispatcher/runtime_realms.rs b/moli-protocol/src/domains/runtime/dispatcher/runtime_realms.rsindex c8ffbaf9f..e35dba768 100644--- a/moli-protocol/src/domains/runtime/dispatcher/runtime_realms.rs+++ b/moli-protocol/src/domains/runtime/dispatcher/runtime_realms.rs@@ -3,15 +3,15 @@ use super::*;pub(super) async fn execute_devtools_release_objects_command_async(conn: &mut CdpConnection,command: DevToolsReleaseObjectsCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let target =- devtools_runtime_target_async(conn, &DevToolsCommand::ReleaseObjects(command.clone()))+ devtools_runtime_target_async(conn, &AutomationCommand::ReleaseObjects(command.clone())).await?;let target_realm = devtools_realm_id_for_runtime_target_async(conn, &target).await;let owner = CommandOwnerScope::for_route(target.route);release_devtools_objects_for_owner_async(conn, &owner, &command.handles, target_realm.as_ref()).await?;- Ok(DevToolsCommandResult::Empty)+ Ok(AutomationResult::Empty)}pub(super) async fn release_devtools_objects_for_owner_async(@@ -111,7 +111,7 @@ pub(super) async fn dispatch_runtime_inspector_command_response_for_owner_async(pub(super) async fn execute_devtools_get_realms_command_async(conn: &mut CdpConnection,command: DevToolsGetRealmsCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+) -> Result<AutomationResult, DevToolsError> {let requested_target_id = command.context.target_id@@ -150,9 +150,7 @@ pub(super) async fn execute_devtools_get_realms_command_async(realms.retain(|realm| devtools_realm_type(realm.context_type.as_deref()) == realm_type);}dedup_devtools_realms(&mut realms);- Ok(DevToolsCommandResult::Realms(DevToolsGetRealmsResult {- realms,- }))+ Ok(AutomationResult::Realms(DevToolsGetRealmsResult { realms }))}pub(super) fn dedup_devtools_realms(realms: &mut Vec<RuntimeExecutionContextEvent>) {@@ -189,7 +187,7 @@ pub(super) fn dedup_devtools_realms(realms: &mut Vec<RuntimeExecutionContextEvenpub(super) fn devtools_get_realms_routes(conn: &CdpConnection,- target_id: Option<&crate::devtools_runtime::DevToolsTargetId>,+ target_id: Option<&crate::automation::DevToolsTargetId>,) -> Result<Vec<CdpSessionRoute>, DevToolsError> {if let Some(target_id) = target_id {if let Some(route) = conn@@ -211,11 +209,11 @@ pub(super) fn devtools_get_realms_routes({if !matches!(target_info.kind,- crate::devtools_runtime::DevToolsTargetKind::Page- | crate::devtools_runtime::DevToolsTargetKind::Frame- | crate::devtools_runtime::DevToolsTargetKind::SharedWorker- | crate::devtools_runtime::DevToolsTargetKind::Worker- | crate::devtools_runtime::DevToolsTargetKind::ServiceWorker+ crate::automation::DevToolsTargetKind::Page+ | crate::automation::DevToolsTargetKind::Frame+ | crate::automation::DevToolsTargetKind::SharedWorker+ | crate::automation::DevToolsTargetKind::Worker+ | crate::automation::DevToolsTargetKind::ServiceWorker) {continue;}@@ -435,7 +433,7 @@ pub(super) fn devtools_script_exception_from_cdp(.and_then(Value::as_u64),stack_trace: exception_details.get("stackTrace")- .and_then(crate::devtools_runtime::DevToolsStackTrace::from_cdp_value),+ .and_then(crate::automation::DevToolsStackTrace::from_cdp_value),}}diff --git a/moli-protocol/src/domains/runtime/dispatcher/runtime_targets.rs b/moli-protocol/src/domains/runtime/dispatcher/runtime_targets.rsindex b3fcb1599..16b05ad7d 100644--- a/moli-protocol/src/domains/runtime/dispatcher/runtime_targets.rs+++ b/moli-protocol/src/domains/runtime/dispatcher/runtime_targets.rs@@ -31,42 +31,42 @@ pub(super) async fn devtools_runtime_realm_for_target_async(}pub(super) fn devtools_runtime_result_ownership(- command: &DevToolsCommand,+ command: &AutomationCommand,) -> DevToolsResultOwnership {match command {- DevToolsCommand::EvaluateScript(command) => command.result_ownership,- DevToolsCommand::CallFunction(command) => command.result_ownership,+ AutomationCommand::EvaluateScript(command) => command.result_ownership,+ AutomationCommand::CallFunction(command) => command.result_ownership,_ => DevToolsResultOwnership::None,}}pub(super) fn devtools_runtime_command_result_kind(- command: &DevToolsCommand,+ command: &AutomationCommand,) -> DevToolsRuntimeCommandResultKind {match command {- DevToolsCommand::TerminateExecution(_) => DevToolsRuntimeCommandResultKind::Empty,+ AutomationCommand::TerminateExecution(_) => DevToolsRuntimeCommandResultKind::Empty,_ => DevToolsRuntimeCommandResultKind::Script,}}pub(super) fn devtools_runtime_serialization_options(- command: &DevToolsCommand,+ command: &AutomationCommand,) -> Option<DevToolsSerializationOptions> {match command {- DevToolsCommand::EvaluateScript(command) => command.serialization_options.clone(),- DevToolsCommand::CallFunction(command) => command.serialization_options.clone(),+ AutomationCommand::EvaluateScript(command) => command.serialization_options.clone(),+ AutomationCommand::CallFunction(command) => command.serialization_options.clone(),_ => None,}}#[cfg(test)]-pub(super) fn devtools_command_has_bidi_script_channel_arguments(- command: &DevToolsCommand,+pub(super) fn automation_command_has_bidi_script_channel_arguments(+ command: &AutomationCommand,) -> bool {- let DevToolsCommand::CallFunction(command) = command else {+ let AutomationCommand::CallFunction(command) = command else {return false;};- matches!(command.context.protocol, DevToolsProtocol::WebDriverBidi)+ matches!(command.context.protocol, FrontendProtocol::WebDriverBidi)&& command.this_parameter.iter()@@ -103,9 +103,9 @@ pub(super) fn bidi_local_value_contains_channel(value: &Value) -> bool {pub(super) async fn devtools_runtime_target_async(conn: &mut CdpConnection,- command: &DevToolsCommand,+ command: &AutomationCommand,) -> Result<DevToolsRuntimeTarget, DevToolsError> {- if let DevToolsCommand::TerminateExecution(command) = command {+ if let AutomationCommand::TerminateExecution(command) = command {let target_id =command.context.target_id.as_ref().ok_or_else(|| {DevToolsError::new(DevToolsErrorKind::NoSuchTarget, "NoSuchTarget")@@ -113,18 +113,18 @@ pub(super) async fn devtools_runtime_target_async(return devtools_runtime_control_target(conn, target_id);}let (target_id, realm_id, world_name) = match command {- DevToolsCommand::EvaluateScript(command) => (+ AutomationCommand::EvaluateScript(command) => (command.context.target_id.as_ref(),command.realm_id.as_ref(),command.world_name.as_deref(),),- DevToolsCommand::CallFunction(command) => (+ AutomationCommand::CallFunction(command) => (command.context.target_id.as_ref(),command.realm_id.as_ref(),command.world_name.as_deref(),),- DevToolsCommand::LocateNodes(command) => (command.context.target_id.as_ref(), None, None),- DevToolsCommand::ReleaseObjects(command) => (+ AutomationCommand::LocateNodes(command) => (command.context.target_id.as_ref(), None, None),+ AutomationCommand::ReleaseObjects(command) => (command.context.target_id.as_ref(),command.realm_id.as_ref(),command.world_name.as_deref(),diff --git a/moli-protocol/src/domains/runtime/tests/service_worker.rs b/moli-protocol/src/domains/runtime/tests/service_worker.rsindex 9de2d2deb..a3367aa50 100644--- a/moli-protocol/src/domains/runtime/tests/service_worker.rs+++ b/moli-protocol/src/domains/runtime/tests/service_worker.rs@@ -1,11 +1,11 @@use super::*;-use crate::conn::ServiceWorkerTargetState;-use crate::devtools_runtime::{- DevToolsCommand, DevToolsCommandContext, DevToolsCommandResult, DevToolsErrorKind,- DevToolsGetRealmsCommand, DevToolsGetServiceWorkerLogsCommand, DevToolsProtocol,- DevToolsSessionId, DevToolsTargetId, RuntimeExecutionContextEvent,+use crate::automation::{+ AutomationCommand, AutomationContext, AutomationResult, DevToolsErrorKind,+ DevToolsGetRealmsCommand, DevToolsGetServiceWorkerLogsCommand, DevToolsSessionId,+ DevToolsTargetId, FrontendProtocol, RuntimeExecutionContextEvent,};+use crate::conn::ServiceWorkerTargetState;use moli_core::page::{RendererServiceWorkerExceptionMessage, RendererServiceWorkerFetchDiagnostic,RendererServiceWorkerFetchDiagnosticResult, RendererServiceWorkerVersionStatus,@@ -348,9 +348,9 @@ async fn get_realms_on_service_worker_target_waits_for_renderer_context() {let (result, _) = ctx.conn- .execute_devtools_command(DevToolsCommand::GetRealms(DevToolsGetRealmsCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ .execute_automation_command(AutomationCommand::GetRealms(DevToolsGetRealmsCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: Some(DevToolsTargetId::from("TID-service-worker")),browser_context_id: None,@@ -359,7 +359,7 @@ async fn get_realms_on_service_worker_target_waits_for_renderer_context() {})).await.into_parts();- let DevToolsCommandResult::Realms(result) = result.expect("getRealms should succeed") else {+ let AutomationResult::Realms(result) = result.expect("getRealms should succeed") else {panic!("expected Realms result");};@@ -378,9 +378,9 @@ async fn get_realms_on_service_worker_target_returns_real_renderer_realm() {let (result, _) = ctx.conn- .execute_devtools_command(DevToolsCommand::GetRealms(DevToolsGetRealmsCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ .execute_automation_command(AutomationCommand::GetRealms(DevToolsGetRealmsCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: Some(DevToolsTargetId::from("TID-service-worker")),browser_context_id: None,@@ -389,7 +389,7 @@ async fn get_realms_on_service_worker_target_returns_real_renderer_realm() {})).await.into_parts();- let DevToolsCommandResult::Realms(result) = result.expect("getRealms should succeed") else {+ let AutomationResult::Realms(result) = result.expect("getRealms should succeed") else {panic!("expected Realms result");};@@ -416,9 +416,9 @@ async fn get_realms_global_enumeration_waits_for_service_worker_renderer_contextlet (result, _) = ctx.conn- .execute_devtools_command(DevToolsCommand::GetRealms(DevToolsGetRealmsCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ .execute_automation_command(AutomationCommand::GetRealms(DevToolsGetRealmsCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,@@ -427,7 +427,7 @@ async fn get_realms_global_enumeration_waits_for_service_worker_renderer_context})).await.into_parts();- let DevToolsCommandResult::Realms(result) = result.expect("getRealms should succeed") else {+ let AutomationResult::Realms(result) = result.expect("getRealms should succeed") else {panic!("expected Realms result");};@@ -448,9 +448,9 @@ async fn get_realms_global_enumeration_includes_service_worker_real_renderer_realet (result, _) = ctx.conn- .execute_devtools_command(DevToolsCommand::GetRealms(DevToolsGetRealmsCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ .execute_automation_command(AutomationCommand::GetRealms(DevToolsGetRealmsCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,@@ -459,7 +459,7 @@ async fn get_realms_global_enumeration_includes_service_worker_real_renderer_rea})).await.into_parts();- let DevToolsCommandResult::Realms(result) = result.expect("getRealms should succeed") else {+ let AutomationResult::Realms(result) = result.expect("getRealms should succeed") else {panic!("expected Realms result");};@@ -484,10 +484,10 @@ async fn get_service_worker_logs_drains_classic_cursor_without_attaching_target(let (result, _) = ctx.conn- .execute_devtools_command(DevToolsCommand::GetServiceWorkerLogs(+ .execute_automation_command(AutomationCommand::GetServiceWorkerLogs(DevToolsGetServiceWorkerLogsCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from("classic-session-1")),target_id: None,browser_context_id: None,@@ -497,7 +497,7 @@ async fn get_service_worker_logs_drains_classic_cursor_without_attaching_target()).await.into_parts();- let DevToolsCommandResult::ServiceWorkerLogs(result) =+ let AutomationResult::ServiceWorkerLogs(result) =result.expect("getServiceWorkerLogs should succeed")else {panic!("expected ServiceWorkerLogs result");@@ -526,10 +526,10 @@ async fn get_service_worker_logs_drains_classic_cursor_without_attaching_target(let (second_result, _) = ctx.conn- .execute_devtools_command(DevToolsCommand::GetServiceWorkerLogs(+ .execute_automation_command(AutomationCommand::GetServiceWorkerLogs(DevToolsGetServiceWorkerLogsCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from("classic-session-1")),target_id: None,browser_context_id: None,@@ -539,7 +539,7 @@ async fn get_service_worker_logs_drains_classic_cursor_without_attaching_target()).await.into_parts();- let DevToolsCommandResult::ServiceWorkerLogs(second_result) =+ let AutomationResult::ServiceWorkerLogs(second_result) =second_result.expect("second getServiceWorkerLogs should succeed")else {panic!("expected second ServiceWorkerLogs result");@@ -548,10 +548,10 @@ async fn get_service_worker_logs_drains_classic_cursor_without_attaching_target(let missing = ctx.conn- .execute_devtools_command(DevToolsCommand::GetServiceWorkerLogs(+ .execute_automation_command(AutomationCommand::GetServiceWorkerLogs(DevToolsGetServiceWorkerLogsCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverClassic,+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverClassic,session_id: Some(DevToolsSessionId::from("classic-session-1")),target_id: None,browser_context_id: None,diff --git a/moli-protocol/src/domains/runtime/tests/shared_worker.rs b/moli-protocol/src/domains/runtime/tests/shared_worker.rsindex 6b0449652..1a72cfe34 100644--- a/moli-protocol/src/domains/runtime/tests/shared_worker.rs+++ b/moli-protocol/src/domains/runtime/tests/shared_worker.rs@@ -1,8 +1,8 @@use super::*;-use crate::devtools_runtime::{- DevToolsCommand, DevToolsCommandContext, DevToolsCommandResult, DevToolsGetRealmsCommand,- DevToolsProtocol, DevToolsSessionId, DevToolsTargetId, RuntimeExecutionContextEvent,+use crate::automation::{+ AutomationCommand, AutomationContext, AutomationResult, DevToolsGetRealmsCommand,+ DevToolsSessionId, DevToolsTargetId, FrontendProtocol, RuntimeExecutionContextEvent,};async fn wait_until_runtime_expression_true(@@ -165,9 +165,9 @@ async fn get_realms_on_shared_worker_target_waits_for_renderer_context() {let (result, _) = ctx.conn- .execute_devtools_command(DevToolsCommand::GetRealms(DevToolsGetRealmsCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ .execute_automation_command(AutomationCommand::GetRealms(DevToolsGetRealmsCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: Some(DevToolsTargetId::from("TID-shared-worker")),browser_context_id: None,@@ -176,7 +176,7 @@ async fn get_realms_on_shared_worker_target_waits_for_renderer_context() {})).await.into_parts();- let DevToolsCommandResult::Realms(result) = result.expect("getRealms should succeed") else {+ let AutomationResult::Realms(result) = result.expect("getRealms should succeed") else {panic!("expected Realms result");};@@ -195,9 +195,9 @@ async fn get_realms_on_shared_worker_target_returns_real_renderer_realm() {let (result, _) = ctx.conn- .execute_devtools_command(DevToolsCommand::GetRealms(DevToolsGetRealmsCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ .execute_automation_command(AutomationCommand::GetRealms(DevToolsGetRealmsCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: Some(DevToolsTargetId::from("TID-shared-worker")),browser_context_id: None,@@ -206,7 +206,7 @@ async fn get_realms_on_shared_worker_target_returns_real_renderer_realm() {})).await.into_parts();- let DevToolsCommandResult::Realms(result) = result.expect("getRealms should succeed") else {+ let AutomationResult::Realms(result) = result.expect("getRealms should succeed") else {panic!("expected Realms result");};@@ -234,9 +234,9 @@ async fn get_realms_global_enumeration_waits_for_shared_worker_renderer_context(let (result, _) = ctx.conn- .execute_devtools_command(DevToolsCommand::GetRealms(DevToolsGetRealmsCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ .execute_automation_command(AutomationCommand::GetRealms(DevToolsGetRealmsCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,@@ -245,7 +245,7 @@ async fn get_realms_global_enumeration_waits_for_shared_worker_renderer_context(})).await.into_parts();- let DevToolsCommandResult::Realms(result) = result.expect("getRealms should succeed") else {+ let AutomationResult::Realms(result) = result.expect("getRealms should succeed") else {panic!("expected Realms result");};@@ -266,9 +266,9 @@ async fn get_realms_global_enumeration_includes_shared_worker_real_renderer_reallet (result, _) = ctx.conn- .execute_devtools_command(DevToolsCommand::GetRealms(DevToolsGetRealmsCommand {- context: DevToolsCommandContext {- protocol: DevToolsProtocol::WebDriverBidi,+ .execute_automation_command(AutomationCommand::GetRealms(DevToolsGetRealmsCommand {+ context: AutomationContext {+ protocol: FrontendProtocol::WebDriverBidi,session_id: Some(DevToolsSessionId::from("bidi-session-1")),target_id: None,browser_context_id: None,@@ -277,7 +277,7 @@ async fn get_realms_global_enumeration_includes_shared_worker_real_renderer_real})).await.into_parts();- let DevToolsCommandResult::Realms(result) = result.expect("getRealms should succeed") else {+ let AutomationResult::Realms(result) = result.expect("getRealms should succeed") else {panic!("expected Realms result");};diff --git a/moli-protocol/src/domains/runtime_context_events.rs b/moli-protocol/src/domains/runtime_context_events.rsindex 7282b3f17..bf0feab93 100644--- a/moli-protocol/src/domains/runtime_context_events.rs+++ b/moli-protocol/src/domains/runtime_context_events.rs@@ -1,4 +1,4 @@-use crate::devtools_runtime::{+use crate::automation::{AutomationEvent, DevToolsFrameId, DevToolsRealmId, DevToolsTargetId,RuntimeExecutionContextEvent, RuntimeExecutionContextsClearedEvent,};@@ -496,9 +496,9 @@ fn mark_child_default_context_event_emitted(#[cfg(test)]mod tests {+ use crate::automation::AutomationEvent;use crate::conn::{BrowserContext, CdpConnection, CommandOwnerScope};use crate::conn::{ServiceWorkerTargetState, SharedWorkerTargetState};- use crate::devtools_runtime::AutomationEvent;use moli_core::{RendererOwnerLocalHostId, page::RendererServiceWorkerVersionStatus};use moli_shared_worker::SharedWorkerInstanceId;use serde_json::json;diff --git a/moli-protocol/src/domains/storage/ops.rs b/moli-protocol/src/domains/storage/ops.rsindex afeb2cabb..3b9bf0c08 100644--- a/moli-protocol/src/domains/storage/ops.rs+++ b/moli-protocol/src/domains/storage/ops.rs@@ -1,13 +1,13 @@+use crate::automation::{+ AutomationCommand, AutomationResult, DevToolsBrowserContextId, DevToolsCookieParam,+ DevToolsDeleteCookiesCommand, DevToolsDeleteCookiesResult, DevToolsError, DevToolsErrorKind,+ DevToolsGetCookiesCommand, DevToolsGetCookiesResult, DevToolsSetCookiesCommand,+ DevToolsSetCookiesResult, DevToolsTargetId, FrontendProtocol,+};use crate::conn::{BrowserContext, BrowserContextCookieManagerSurfaceSnapshot, CdpConnection, Cmd,CommandOwnerScope, SiteDataClearOptions,};-use crate::devtools_runtime::{- DevToolsBrowserContextId, DevToolsCommand, DevToolsCommandResult, DevToolsCookieParam,- DevToolsDeleteCookiesCommand, DevToolsDeleteCookiesResult, DevToolsError, DevToolsErrorKind,- DevToolsGetCookiesCommand, DevToolsGetCookiesResult, DevToolsProtocol,- DevToolsSetCookiesCommand, DevToolsSetCookiesResult, DevToolsTargetId,-};use crate::domains::actions::StorageAction;use crate::domains::command_output::CommandOutputPlan;use moli_cookie_jar::StoredCookieSetReport;@@ -130,18 +130,18 @@ pub(crate) fn try_start_storage_command_dispatch(pub(crate) fn start_devtools_storage_command(conn: &mut CdpConnection,command_id: Option<u64>,- command: DevToolsCommand,+ command: AutomationCommand,) -> StorageCommandTaskStep {match command {- DevToolsCommand::GetCookies(command) => StorageCommandTaskStep::Complete(+ AutomationCommand::GetCookies(command) => StorageCommandTaskStep::Complete(devtools_get_cookies_output_plan(complete_devtools_get_cookies_result(conn, command)),),- DevToolsCommand::DeleteCookies(command) => {+ AutomationCommand::DeleteCookies(command) => {StorageCommandTaskStep::Complete(devtools_delete_cookies_output_plan(complete_devtools_delete_cookies_result(conn, command),))}- DevToolsCommand::SetCookies(command) => {+ AutomationCommand::SetCookies(command) => {start_devtools_set_cookies_command(conn, command_id, command)}_ => StorageCommandTaskStep::Complete(CommandOutputPlan::error(@@ -153,21 +153,22 @@ pub(crate) fn start_devtools_storage_command(pub(crate) async fn execute_devtools_storage_command_async(conn: &mut CdpConnection,- command: DevToolsCommand,-) -> Result<DevToolsCommandResult, DevToolsError> {+ command: AutomationCommand,+) -> Result<AutomationResult, DevToolsError> {match command {- DevToolsCommand::GetCookies(command) => complete_devtools_get_cookies_result(conn, command)- .map(DevToolsCommandResult::GetCookies),- DevToolsCommand::DeleteCookies(command) => {+ AutomationCommand::GetCookies(command) => {+ complete_devtools_get_cookies_result(conn, command).map(AutomationResult::GetCookies)+ }+ AutomationCommand::DeleteCookies(command) => {complete_devtools_delete_cookies_result(conn, command)- .map(DevToolsCommandResult::DeleteCookies)+ .map(AutomationResult::DeleteCookies)}- DevToolsCommand::SetCookies(command) => {+ AutomationCommand::SetCookies(command) => {let mut step = start_devtools_set_cookies_result(conn, None, command);loop {match step {DevToolsSetCookiesTaskStep::Complete(result) => {- return result.map(DevToolsCommandResult::SetCookies);+ return result.map(AutomationResult::SetCookies);}DevToolsSetCookiesTaskStep::Pending(pending) => {step = DevToolsSetCookiesTaskStep::Complete(@@ -192,7 +193,7 @@ fn start_storage_get_cookies_command(Ok(command) => command,Err(plan) => return StorageCommandTaskStep::Complete(plan),};- start_devtools_storage_command(conn, cmd.id, DevToolsCommand::GetCookies(command))+ start_devtools_storage_command(conn, cmd.id, AutomationCommand::GetCookies(command))}fn start_storage_clear_cookies_command(@@ -203,7 +204,7 @@ fn start_storage_clear_cookies_command(Ok(command) => command,Err(plan) => return StorageCommandTaskStep::Complete(plan),};- start_devtools_storage_command(conn, cmd.id, DevToolsCommand::DeleteCookies(command))+ start_devtools_storage_command(conn, cmd.id, AutomationCommand::DeleteCookies(command))}pub(crate) fn build_cdp_storage_clear_cookies_command(@@ -214,7 +215,7 @@ pub(crate) fn build_cdp_storage_clear_cookies_command(.map(DevToolsBrowserContextId::from);Ok(DevToolsDeleteCookiesCommand {context: cmd- .devtools_command_context(Option::<DevToolsTargetId>::None, browser_context_id.clone()),+ .automation_context(Option::<DevToolsTargetId>::None, browser_context_id.clone()),browser_context_id,name: None,url: None,@@ -233,7 +234,7 @@ pub(crate) fn build_cdp_storage_get_cookies_command(.map(DevToolsBrowserContextId::from);Ok(DevToolsGetCookiesCommand {context: cmd- .devtools_command_context(Option::<DevToolsTargetId>::None, browser_context_id.clone()),+ .automation_context(Option::<DevToolsTargetId>::None, browser_context_id.clone()),browser_context_id,urls: None,filter: None,@@ -248,7 +249,7 @@ pub(crate) fn start_storage_delete_cookies_command(Ok(command) => command,Err(plan) => return StorageCommandTaskStep::Complete(plan),};- start_devtools_storage_command(conn, cmd.id, DevToolsCommand::DeleteCookies(command))+ start_devtools_storage_command(conn, cmd.id, AutomationCommand::DeleteCookies(command))}pub(crate) fn build_cdp_storage_delete_cookies_command(@@ -273,7 +274,7 @@ pub(crate) fn build_cdp_storage_delete_cookies_command(.map(DevToolsBrowserContextId::from);Ok(DevToolsDeleteCookiesCommand {context: cmd- .devtools_command_context(Option::<DevToolsTargetId>::None, browser_context_id.clone()),+ .automation_context(Option::<DevToolsTargetId>::None, browser_context_id.clone()),browser_context_id,name: params.name,url: params.url,@@ -549,7 +550,7 @@ fn start_storage_set_cookies_command(Ok(command) => command,Err(plan) => return StorageCommandTaskStep::Complete(plan),};- start_devtools_storage_command(conn, cmd.id, DevToolsCommand::SetCookies(command))+ start_devtools_storage_command(conn, cmd.id, AutomationCommand::SetCookies(command))}pub(crate) fn build_cdp_storage_set_cookies_command(@@ -566,7 +567,7 @@ pub(crate) fn build_cdp_storage_set_cookies_command(.map(DevToolsBrowserContextId::from);Ok(DevToolsSetCookiesCommand {context: cmd- .devtools_command_context(Option::<DevToolsTargetId>::None, browser_context_id.clone()),+ .automation_context(Option::<DevToolsTargetId>::None, browser_context_id.clone()),browser_context_id,cookies: params.cookies.into_iter().map(Into::into).collect(),})@@ -632,7 +633,7 @@ fn start_devtools_set_cookies_result(command_id: Option<u64>,command: DevToolsSetCookiesCommand,) -> DevToolsSetCookiesTaskStep {- let session_id = (command.context.protocol == DevToolsProtocol::Cdp)+ let session_id = (command.context.protocol == FrontendProtocol::Cdp).then(|| command.context.session_id.as_ref().map(|id| id.as_str())).flatten();let browser_context_id = command@@ -981,7 +982,7 @@ pub(crate) fn complete_devtools_get_cookies_result(.browser_context_id.or(command.context.browser_context_id).map(DevToolsBrowserContextId::into_string);- let session_id = (command.context.protocol == DevToolsProtocol::Cdp)+ let session_id = (command.context.protocol == FrontendProtocol::Cdp).then(|| command.context.session_id.as_ref().map(|id| id.as_str())).flatten();let target_id = command.context.target_id.as_ref().map(|id| id.as_str());@@ -1076,7 +1077,7 @@ pub(crate) fn complete_devtools_delete_cookies_result(.browser_context_id.or(command.context.browser_context_id).map(DevToolsBrowserContextId::into_string);- let session_id = (command.context.protocol == DevToolsProtocol::Cdp)+ let session_id = (command.context.protocol == FrontendProtocol::Cdp).then(|| command.context.session_id.as_ref().map(|id| id.as_str())).flatten();let target_id = command.context.target_id.as_ref().map(|id| id.as_str());@@ -1119,7 +1120,7 @@ pub(crate) fn complete_devtools_delete_cookies_result(fn filter_cookies_by_devtools_filter(cookies: Vec<Value>,- filter: Option<&crate::devtools_runtime::DevToolsCookieFilter>,+ filter: Option<&crate::automation::DevToolsCookieFilter>,) -> Vec<Value> {let Some(filter) = filter else {return cookies;@@ -1132,7 +1133,7 @@ fn filter_cookies_by_devtools_filter(fn cookie_matches_devtools_filter(cookie: &Value,- filter: &crate::devtools_runtime::DevToolsCookieFilter,+ filter: &crate::automation::DevToolsCookieFilter,) -> bool {if let Some(name) = filter.name.as_deref()&& cookie.get("name").and_then(Value::as_str) != Some(name)@@ -1208,7 +1209,7 @@ fn delete_cookies_for_browser_context_by_filter(name: Option<String>,domain: Option<String>,path: Option<String>,- filter: Option<&crate::devtools_runtime::DevToolsCookieFilter>,+ filter: Option<&crate::automation::DevToolsCookieFilter>,) -> Result<(), (i32, &'static str)> {let cookies = get_cookies_for_browser_context(conn, Ok(browser_context_id.clone()))?;let cookies = filter_cookies_by_devtools_filter(cookies, filter);@@ -1371,9 +1372,7 @@ fn devtools_get_cookies_output_plan(result: Result<DevToolsGetCookiesResult, DevToolsError>,) -> CommandOutputPlan {match result {- Ok(result) => {- CommandOutputPlan::from_devtools_result(DevToolsCommandResult::GetCookies(result))- }+ Ok(result) => CommandOutputPlan::from_devtools_result(AutomationResult::GetCookies(result)),Err(error) => CommandOutputPlan::from_devtools_error(error),}}@@ -1383,7 +1382,7 @@ fn devtools_delete_cookies_output_plan() -> CommandOutputPlan {match result {Ok(result) => {- CommandOutputPlan::from_devtools_result(DevToolsCommandResult::DeleteCookies(result))+ CommandOutputPlan::from_devtools_result(AutomationResult::DeleteCookies(result))}Err(error) => CommandOutputPlan::from_devtools_error(error),}@@ -1393,9 +1392,7 @@ fn devtools_set_cookies_output_plan(result: Result<DevToolsSetCookiesResult, DevToolsError>,) -> CommandOutputPlan {match result {- Ok(result) => {- CommandOutputPlan::from_devtools_result(DevToolsCommandResult::SetCookies(result))- }+ Ok(result) => CommandOutputPlan::from_devtools_result(AutomationResult::SetCookies(result)),Err(error) => CommandOutputPlan::from_devtools_error(error),}}@@ -1459,7 +1456,7 @@ fn delete_cookies_for_browser_context_with_normalized_partition_key(#[cfg(test)]mod protocol_neutral_tests {- use crate::devtools_runtime::{DevToolsCommand, DevToolsProtocol};+ use crate::automation::{AutomationCommand, FrontendProtocol};use serde_json::{Value, json};use crate::conn::{CdpConnection, Cmd};@@ -1486,7 +1483,7 @@ mod protocol_neutral_tests {panic!("valid Storage.getCookies command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-storage")@@ -1522,8 +1519,11 @@ mod protocol_neutral_tests {panic!("default Storage.getCookies command should build");};- let step =- start_devtools_storage_command(&mut conn, cmd.id, DevToolsCommand::GetCookies(command));+ let step = start_devtools_storage_command(+ &mut conn,+ cmd.id,+ AutomationCommand::GetCookies(command),+ );let StorageCommandTaskStep::Complete(plan) = step else {panic!("getCookies should complete through the shared storage entry");@@ -1561,7 +1561,7 @@ mod protocol_neutral_tests {panic!("valid Storage.deleteCookies command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-storage")@@ -1602,7 +1602,7 @@ mod protocol_neutral_tests {let step = start_devtools_storage_command(&mut conn,cmd.id,- DevToolsCommand::DeleteCookies(command),+ AutomationCommand::DeleteCookies(command),);let StorageCommandTaskStep::Complete(plan) = step else {@@ -1631,7 +1631,7 @@ mod protocol_neutral_tests {panic!("valid Storage.clearCookies command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-storage")@@ -1665,7 +1665,7 @@ mod protocol_neutral_tests {let step = start_devtools_storage_command(&mut conn,cmd.id,- DevToolsCommand::DeleteCookies(command),+ AutomationCommand::DeleteCookies(command),);let StorageCommandTaskStep::Complete(plan) = step else {@@ -1703,7 +1703,7 @@ mod protocol_neutral_tests {panic!("valid Storage.setCookies command");};- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.browser_context_id.as_ref().map(|id| id.as_str()),Some("BID-cookies")@@ -1739,8 +1739,11 @@ mod protocol_neutral_tests {panic!("valid Storage.setCookies command");};- let step =- start_devtools_storage_command(&mut conn, cmd.id, DevToolsCommand::SetCookies(command));+ let step = start_devtools_storage_command(+ &mut conn,+ cmd.id,+ AutomationCommand::SetCookies(command),+ );let StorageCommandTaskStep::Complete(plan) = step else {panic!("missing browser context should fail synchronously");diff --git a/moli-protocol/src/domains/target.rs b/moli-protocol/src/domains/target.rsindex 61cd16317..5ec15d766 100644--- a/moli-protocol/src/domains/target.rs+++ b/moli-protocol/src/domains/target.rs@@ -1,14 +1,14 @@use serde::Deserialize;+use crate::automation::{+ AutomationCommand, AutomationResult, DevToolsActivateTargetCommand, DevToolsCloseTargetCommand,+ DevToolsCreateTargetCommand, DevToolsError, DevToolsErrorKind, DevToolsTargetFilterEntry,+ DevToolsTargetInfo, DevToolsTargetKind,+};use crate::conn::{BackgroundProtocolEvent, BrowserContext, CdpConnection, Cmd, CommandOwnerScope,TargetAttachSessionCommit, TargetHandlerAccessMode,};-use crate::devtools_runtime::{- DevToolsActivateTargetCommand, DevToolsCloseTargetCommand, DevToolsCommand,- DevToolsCommandResult, DevToolsCreateTargetCommand, DevToolsError, DevToolsErrorKind,- DevToolsTargetFilterEntry, DevToolsTargetInfo, DevToolsTargetKind,-};use crate::domains::actions::TargetAction;use crate::domains::command_output::CommandOutputPlan;@@ -444,58 +444,58 @@ fn start_devtools_target_command(conn: &mut CdpConnection,command_id: Option<u64>,command_session_id: Option<&str>,- command: DevToolsCommand,+ command: AutomationCommand,) -> TargetCommandTaskStep {match command {- DevToolsCommand::CreateTarget(command) => creation::start_devtools_create_target_command(+ AutomationCommand::CreateTarget(command) => creation::start_devtools_create_target_command(conn,command_id,command_session_id,command,),- DevToolsCommand::CloseTarget(command) => {+ AutomationCommand::CloseTarget(command) => {closing::start_devtools_close_target_command(command_id, command_session_id, command)}- DevToolsCommand::ActivateTarget(command) => {+ AutomationCommand::ActivateTarget(command) => {pending_activate_target_command(command_id, command_session_id, command)}- DevToolsCommand::GetTargets(command) => TargetCommandTaskStep::Complete(+ AutomationCommand::GetTargets(command) => TargetCommandTaskStep::Complete(browser_context::start_devtools_get_targets_command(conn, command),),- DevToolsCommand::GetServiceWorkerLogs(command) => TargetCommandTaskStep::Complete(+ AutomationCommand::GetServiceWorkerLogs(command) => TargetCommandTaskStep::Complete(match browser_context::execute_devtools_get_service_worker_logs_command(conn, &command){Ok(result) => CommandOutputPlan::from_devtools_result(- DevToolsCommandResult::ServiceWorkerLogs(result),+ AutomationResult::ServiceWorkerLogs(result),),Err(error) => CommandOutputPlan::from_devtools_error(error),},),- DevToolsCommand::GetClientWindows(command) => TargetCommandTaskStep::Complete(+ AutomationCommand::GetClientWindows(command) => TargetCommandTaskStep::Complete(match browser_context::execute_devtools_get_client_windows_command(conn, &command) {- Ok(result) => CommandOutputPlan::from_devtools_result(- DevToolsCommandResult::ClientWindows(result),- ),+ Ok(result) => {+ CommandOutputPlan::from_devtools_result(AutomationResult::ClientWindows(result))+ }Err(error) => CommandOutputPlan::from_devtools_error(error),},),- DevToolsCommand::CreateBrowserContext(command) => {+ AutomationCommand::CreateBrowserContext(command) => {let plan = match browser_context::execute_devtools_create_browser_context_command(conn, command,) {Ok(result) => CommandOutputPlan::from_devtools_result(- DevToolsCommandResult::CreateBrowserContext(result),+ AutomationResult::CreateBrowserContext(result),),Err(error) => CommandOutputPlan::from_devtools_error(error),};TargetCommandTaskStep::Complete(plan)}- DevToolsCommand::GetBrowserContexts(command) => TargetCommandTaskStep::Complete(- CommandOutputPlan::from_devtools_result(DevToolsCommandResult::GetBrowserContexts(+ AutomationCommand::GetBrowserContexts(command) => TargetCommandTaskStep::Complete(+ CommandOutputPlan::from_devtools_result(AutomationResult::GetBrowserContexts(browser_context::devtools_get_browser_contexts_result(conn, &command),)),),- DevToolsCommand::GetTargetInfo(command) => TargetCommandTaskStep::Complete(+ AutomationCommand::GetTargetInfo(command) => TargetCommandTaskStep::Complete(info::start_devtools_get_target_info_command(conn, command),),_ => target_command_error(-32000, "UnsupportedDevToolsCommand"),@@ -504,46 +504,46 @@ fn start_devtools_target_command(pub(crate) fn execute_immediate_devtools_target_command_with_protocol_events(conn: &mut CdpConnection,- command: DevToolsCommand,+ command: AutomationCommand,) -> (- Result<DevToolsCommandResult, DevToolsError>,+ Result<AutomationResult, DevToolsError>,Vec<crate::conn::BackgroundProtocolEvent>,) {match command {- DevToolsCommand::CreateTarget(command) => {+ AutomationCommand::CreateTarget(command) => {let result = creation::execute_devtools_create_target_command(conn, command)- .map(|execution| DevToolsCommandResult::CreateTarget(execution.result));+ .map(|execution| AutomationResult::CreateTarget(execution.result));(result, Vec::new())}- DevToolsCommand::GetTargets(command) => (+ AutomationCommand::GetTargets(command) => (browser_context::execute_devtools_get_targets_command(conn, &command)- .map(DevToolsCommandResult::GetTargets),+ .map(AutomationResult::GetTargets),Vec::new(),),- DevToolsCommand::GetServiceWorkerLogs(command) => (+ AutomationCommand::GetServiceWorkerLogs(command) => (browser_context::execute_devtools_get_service_worker_logs_command(conn, &command)- .map(DevToolsCommandResult::ServiceWorkerLogs),+ .map(AutomationResult::ServiceWorkerLogs),Vec::new(),),- DevToolsCommand::GetClientWindows(command) => (+ AutomationCommand::GetClientWindows(command) => (browser_context::execute_devtools_get_client_windows_command(conn, &command)- .map(DevToolsCommandResult::ClientWindows),+ .map(AutomationResult::ClientWindows),Vec::new(),),- DevToolsCommand::CreateBrowserContext(command) => (+ AutomationCommand::CreateBrowserContext(command) => (browser_context::execute_devtools_create_browser_context_command(conn, command)- .map(DevToolsCommandResult::CreateBrowserContext),+ .map(AutomationResult::CreateBrowserContext),Vec::new(),),- DevToolsCommand::GetBrowserContexts(command) => (- Ok(DevToolsCommandResult::GetBrowserContexts(+ AutomationCommand::GetBrowserContexts(command) => (+ Ok(AutomationResult::GetBrowserContexts(browser_context::devtools_get_browser_contexts_result(conn, &command),)),Vec::new(),),- DevToolsCommand::GetTargetInfo(command) => (+ AutomationCommand::GetTargetInfo(command) => (info::execute_devtools_get_target_info_command(conn, command)- .map(DevToolsCommandResult::GetTargetInfo),+ .map(AutomationResult::GetTargetInfo),Vec::new(),),_ => (@@ -560,7 +560,7 @@ pub(crate) async fn execute_devtools_create_target_command_async_with_protocol_econn: &mut CdpConnection,command: DevToolsCreateTargetCommand,) -> (- Result<DevToolsCommandResult, DevToolsError>,+ Result<AutomationResult, DevToolsError>,Vec<crate::conn::BackgroundProtocolEvent>,Option<moli_core::RendererOutputFence>,) {@@ -588,7 +588,7 @@ pub(crate) async fn execute_devtools_create_target_command_async_with_protocol_ereturn (Err(error), Vec::new(), renderer_output_predecessor);}(- Ok(DevToolsCommandResult::CreateTarget(result)),+ Ok(AutomationResult::CreateTarget(result)),protocol_events,renderer_output_predecessor,)@@ -596,13 +596,13 @@ pub(crate) async fn execute_devtools_create_target_command_async_with_protocol_epub(crate) async fn execute_devtools_target_command_async_with_protocol_events(conn: &mut CdpConnection,- command: DevToolsCommand,+ command: AutomationCommand,) -> (- Result<DevToolsCommandResult, DevToolsError>,+ Result<AutomationResult, DevToolsError>,Vec<crate::conn::BackgroundProtocolEvent>,) {match command {- DevToolsCommand::CloseTarget(command) => {+ AutomationCommand::CloseTarget(command) => {let mut command_context = crate::conn::CommandDispatchContext::default();let mut side_effects = events::TargetProtocolSideEffects::default();let result = closing::execute_devtools_close_target_command_async(@@ -612,34 +612,34 @@ pub(crate) async fn execute_devtools_target_command_async_with_protocol_events(&mut command_context,).await- .map(DevToolsCommandResult::CloseTarget);+ .map(AutomationResult::CloseTarget);let mut protocol_events = side_effects.into_background_events();protocol_events.append(&mut command_context.take_protocol_events());(result, protocol_events)}- DevToolsCommand::ActivateTarget(command) => {+ AutomationCommand::ActivateTarget(command) => {match activation::execute_devtools_activate_target_command_async(conn, command).await {- Ok(events) => (Ok(DevToolsCommandResult::Empty), events),+ Ok(events) => (Ok(AutomationResult::Empty), events),Err(error) => (Err(error), Vec::new()),}}- DevToolsCommand::RemoveBrowserContext(_) => {- let DevToolsCommand::RemoveBrowserContext(command) = command else {+ AutomationCommand::RemoveBrowserContext(_) => {+ let AutomationCommand::RemoveBrowserContext(command) = command else {unreachable!("matched remove browser context command");};browser_context::execute_devtools_remove_browser_context_command_async(conn, command).await}- DevToolsCommand::CreateTarget(command) => {+ AutomationCommand::CreateTarget(command) => {let (result, events, _) =execute_devtools_create_target_command_async_with_protocol_events(conn, command).await;(result, events)}- DevToolsCommand::GetTargets(_)- | DevToolsCommand::GetClientWindows(_)- | DevToolsCommand::CreateBrowserContext(_)- | DevToolsCommand::GetBrowserContexts(_) => {+ AutomationCommand::GetTargets(_)+ | AutomationCommand::GetClientWindows(_)+ | AutomationCommand::CreateBrowserContext(_)+ | AutomationCommand::GetBrowserContexts(_) => {execute_immediate_devtools_target_command_with_protocol_events(conn, command)}_ => (@@ -1008,20 +1008,20 @@ fn select_browser_context_for_target(#[cfg(test)]mod devtools_runtime_entry_tests {- use crate::conn::RendererCommandDescriptor;- use crate::devtools_runtime::{- AutomationEvent, DevToolsActivateTargetCommand, DevToolsCloseTargetCommand,- DevToolsCommand, DevToolsCommandContext, DevToolsCreateTargetCommand,- DevToolsGetClientWindowsCommand, DevToolsGetTargetInfoCommand, DevToolsGetTargetsCommand,- DevToolsProtocol, DevToolsTargetId, DevToolsTargetKind,+ use crate::automation::{+ AutomationCommand, AutomationContext, AutomationEvent, DevToolsActivateTargetCommand,+ DevToolsCloseTargetCommand, DevToolsCreateTargetCommand, DevToolsGetClientWindowsCommand,+ DevToolsGetTargetInfoCommand, DevToolsGetTargetsCommand, DevToolsTargetId,+ DevToolsTargetKind, FrontendProtocol,};+ use crate::conn::RendererCommandDescriptor;use serde_json::{Value, json};use super::*;- fn cdp_context() -> DevToolsCommandContext {- DevToolsCommandContext {- protocol: DevToolsProtocol::Cdp,+ fn cdp_context() -> AutomationContext {+ AutomationContext {+ protocol: FrontendProtocol::Cdp,session_id: None,target_id: None,browser_context_id: None,@@ -1072,7 +1072,7 @@ mod devtools_runtime_entry_tests {&mut conn,Some(41),None,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: cdp_context(),url: "about:blank".to_owned(),browser_context_id: None,@@ -1230,14 +1230,14 @@ mod devtools_runtime_entry_tests {let (result, protocol_events) = execute_devtools_target_command_async_with_protocol_events(&mut conn,- DevToolsCommand::CloseTarget(DevToolsCloseTargetCommand {+ AutomationCommand::CloseTarget(DevToolsCloseTargetCommand {context: cdp_context(),target_id: DevToolsTargetId::from("TID-runtime-ready-close"),}),).await;- let DevToolsCommandResult::CloseTarget(close_result) =+ let AutomationResult::CloseTarget(close_result) =result.expect("close target should succeed")else {panic!("expected close target result");@@ -1284,7 +1284,7 @@ mod devtools_runtime_entry_tests {let (result, protocol_events) =execute_immediate_devtools_target_command_with_protocol_events(&mut conn,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: cdp_context(),url: "about:blank".to_owned(),browser_context_id: None,@@ -1292,7 +1292,7 @@ mod devtools_runtime_entry_tests {}),);- let DevToolsCommandResult::CreateTarget(result) =+ let AutomationResult::CreateTarget(result) =result.expect("create target staging should succeed")else {panic!("expected create target result");@@ -1319,7 +1319,7 @@ mod devtools_runtime_entry_tests {&mut conn,Some(42),Some("SID-1"),- DevToolsCommand::CloseTarget(DevToolsCloseTargetCommand {+ AutomationCommand::CloseTarget(DevToolsCloseTargetCommand {context: cdp_context(),target_id: DevToolsTargetId::from("TARGET-1"),}),@@ -1345,7 +1345,7 @@ mod devtools_runtime_entry_tests {&mut conn,Some(43),Some("SID-2"),- DevToolsCommand::ActivateTarget(DevToolsActivateTargetCommand {+ AutomationCommand::ActivateTarget(DevToolsActivateTargetCommand {context: cdp_context(),target_id: DevToolsTargetId::from("TARGET-2"),}),@@ -1371,7 +1371,7 @@ mod devtools_runtime_entry_tests {&mut conn,Some(40),None,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: cdp_context(),url: "about:blank".to_owned(),browser_context_id: None,@@ -1383,7 +1383,7 @@ mod devtools_runtime_entry_tests {&mut conn,Some(44),None,- DevToolsCommand::GetTargets(DevToolsGetTargetsCommand {+ AutomationCommand::GetTargets(DevToolsGetTargetsCommand {context: cdp_context(),root: None,max_depth: None,@@ -1409,7 +1409,7 @@ mod devtools_runtime_entry_tests {&mut conn,Some(46),None,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: cdp_context(),url: "about:blank".to_owned(),browser_context_id: None,@@ -1421,7 +1421,7 @@ mod devtools_runtime_entry_tests {&mut conn,Some(47),None,- DevToolsCommand::CreateTarget(DevToolsCreateTargetCommand {+ AutomationCommand::CreateTarget(DevToolsCreateTargetCommand {context: cdp_context(),url: "about:blank".to_owned(),browser_context_id: None,@@ -1434,7 +1434,7 @@ mod devtools_runtime_entry_tests {&mut conn,Some(45),None,- DevToolsCommand::GetClientWindows(DevToolsGetClientWindowsCommand {+ AutomationCommand::GetClientWindows(DevToolsGetClientWindowsCommand {context: cdp_context(),}),);@@ -1466,7 +1466,7 @@ mod devtools_runtime_entry_tests {&mut conn,Some(45),None,- DevToolsCommand::GetTargetInfo(DevToolsGetTargetInfoCommand {+ AutomationCommand::GetTargetInfo(DevToolsGetTargetInfoCommand {context: cdp_context(),target_id: None,}),diff --git a/moli-protocol/src/domains/target/activation.rs b/moli-protocol/src/domains/target/activation.rsindex ce44e265a..07082184e 100644--- a/moli-protocol/src/domains/target/activation.rs+++ b/moli-protocol/src/domains/target/activation.rs@@ -1,6 +1,6 @@use serde::Deserialize;-use crate::devtools_runtime::DevToolsTargetId;+use crate::automation::DevToolsTargetId;use super::*;@@ -25,7 +25,7 @@ pub(super) fn start_activate_target_command(conn,cmd.id,cmd.session_id,- DevToolsCommand::ActivateTarget(command),+ AutomationCommand::ActivateTarget(command),)}@@ -34,8 +34,7 @@ pub(super) fn build_cdp_activate_target_command(params: ActivateTargetParams,) -> DevToolsActivateTargetCommand {DevToolsActivateTargetCommand {- context: cmd- .devtools_command_context(Some(params.target_id.as_str()), Option::<&str>::None),+ context: cmd.automation_context(Some(params.target_id.as_str()), Option::<&str>::None),target_id: DevToolsTargetId::from(params.target_id),}}diff --git a/moli-protocol/src/domains/target/attachment.rs b/moli-protocol/src/domains/target/attachment.rsindex 40fdad5fd..6f46bb10c 100644--- a/moli-protocol/src/domains/target/attachment.rs+++ b/moli-protocol/src/domains/target/attachment.rs@@ -1,8 +1,8 @@use serde::Deserialize;use serde_json::json;+use crate::automation::DevToolsTargetInfo;use crate::conn::{BackgroundProtocolEvent, PreparedTargetAttach};-use crate::devtools_runtime::DevToolsTargetInfo;use super::*;diff --git a/moli-protocol/src/domains/target/browser_context.rs b/moli-protocol/src/domains/target/browser_context.rsindex ad25f102f..cf3560b1e 100644--- a/moli-protocol/src/domains/target/browser_context.rs+++ b/moli-protocol/src/domains/target/browser_context.rs@@ -3,19 +3,19 @@ use serde_json::json;use moli_browser_profile::{DEFAULT_PROFILE_PARTITION_ID, ProfilePartitionId};-use crate::conn::{- BackgroundProtocolEvent, TargetOwnerState, TargetWindowSurfaceState,- monotonic_timestamp_seconds,-};-use crate::devtools_runtime::{- DevToolsClientWindowInfo, DevToolsCommand, DevToolsCommandResult,+use crate::automation::{+ AutomationCommand, AutomationResult, DevToolsClientWindowInfo,DevToolsCreateBrowserContextCommand, DevToolsCreateBrowserContextResult, DevToolsError,DevToolsErrorKind, DevToolsGetBrowserContextsCommand, DevToolsGetBrowserContextsResult,DevToolsGetClientWindowsCommand, DevToolsGetClientWindowsResult,DevToolsGetServiceWorkerLogsCommand, DevToolsGetServiceWorkerLogsResult,- DevToolsGetTargetsCommand, DevToolsGetTargetsResult, DevToolsProtocol,- DevToolsRemoveBrowserContextCommand, DevToolsTargetFilterEntry, DevToolsTargetId,- DevToolsTargetInfo, DevToolsTargetKind, DevToolsWindowState, RuntimeConsoleEvent,+ DevToolsGetTargetsCommand, DevToolsGetTargetsResult, DevToolsRemoveBrowserContextCommand,+ DevToolsTargetFilterEntry, DevToolsTargetId, DevToolsTargetInfo, DevToolsTargetKind,+ DevToolsWindowState, FrontendProtocol, RuntimeConsoleEvent,+};+use crate::conn::{+ BackgroundProtocolEvent, TargetOwnerState, TargetWindowSurfaceState,+ monotonic_timestamp_seconds,};use crate::domains::observable_output::runtime_console_message_type_and_text;@@ -33,7 +33,7 @@ pub(super) fn start_get_targets_command(conn,cmd.id,cmd.session_id,- DevToolsCommand::GetTargets(command),+ AutomationCommand::GetTargets(command),)}@@ -54,7 +54,7 @@ struct GetTargetsFilterEntry {fn build_cdp_get_targets_command(cmd: &Cmd<'_>) -> Option<DevToolsGetTargetsCommand> {let params: Option<GetTargetsParams> = cmd.get_params().ok()?;Some(DevToolsGetTargetsCommand {- context: cmd.devtools_command_context(None::<&str>, None::<&str>),+ context: cmd.automation_context(None::<&str>, None::<&str>),root: None,max_depth: None,filter: params.and_then(|params| {@@ -76,9 +76,7 @@ pub(super) fn start_devtools_get_targets_command(command: DevToolsGetTargetsCommand,) -> CommandOutputPlan {match execute_devtools_get_targets_command(conn, &command) {- Ok(result) => {- CommandOutputPlan::from_devtools_result(DevToolsCommandResult::GetTargets(result))- }+ Ok(result) => CommandOutputPlan::from_devtools_result(AutomationResult::GetTargets(result)),Err(error) => CommandOutputPlan::from_devtools_error(error),}}@@ -284,7 +282,7 @@ pub(super) fn execute_devtools_create_browser_context_command(.as_ref().map(|id| id.as_str().to_owned()).unwrap_or_else(|| match command.context.protocol {- DevToolsProtocol::WebDriverBidi => conn.gen_user_browser_context_id(),+ FrontendProtocol::WebDriverBidi => conn.gen_user_browser_context_id(),_ => conn.gen_bc_id(),});if conn.has_browser_context_id(&id) {@@ -304,7 +302,7 @@ pub(super) fn execute_devtools_create_browser_context_command(browser_context.proxy_socks_version = command.proxy_socks_version;conn.insert_browser_context(browser_context);Ok(DevToolsCreateBrowserContextResult {- browser_context_id: crate::devtools_runtime::DevToolsBrowserContextId::from(id),+ browser_context_id: crate::automation::DevToolsBrowserContextId::from(id),})}@@ -315,9 +313,7 @@ pub(super) fn devtools_get_browser_contexts_result(DevToolsGetBrowserContextsResult {browser_context_ids: conn.browser_contexts()- .map(|context| {- crate::devtools_runtime::DevToolsBrowserContextId::from(context.id.as_str())- })+ .map(|context| crate::automation::DevToolsBrowserContextId::from(context.id.as_str())).collect(),}}@@ -326,11 +322,11 @@ pub(super) async fn execute_devtools_remove_browser_context_command_async(conn: &mut CdpConnection,command: DevToolsRemoveBrowserContextCommand,) -> (- Result<DevToolsCommandResult, DevToolsError>,+ Result<AutomationResult, DevToolsError>,Vec<BackgroundProtocolEvent>,) {let should_emit_internal_lifecycle =- command.context.protocol == DevToolsProtocol::WebDriverBidi;+ command.context.protocol == FrontendProtocol::WebDriverBidi;let browser_context_id = command.browser_context_id.into_string();if browser_context_id == conn.default_browser_context_id() {return (@@ -372,7 +368,7 @@ pub(super) async fn execute_devtools_remove_browser_context_command_async(}protocol_events.extend(side_effects.into_background_events());protocol_events.extend(command_context.take_protocol_events());- (Ok(DevToolsCommandResult::Empty), protocol_events)+ (Ok(AutomationResult::Empty), protocol_events)}pub(super) const DEVTOOLS_BROWSER_TARGET_ID: &str = "browser";diff --git a/moli-protocol/src/domains/target/browser_context_disposal.rs b/moli-protocol/src/domains/target/browser_context_disposal.rsindex de1366324..6613ab58d 100644--- a/moli-protocol/src/domains/target/browser_context_disposal.rs+++ b/moli-protocol/src/domains/target/browser_context_disposal.rs@@ -1,7 +1,7 @@use std::collections::HashSet;+use crate::automation::{DevToolsError, DevToolsErrorKind, DevToolsTargetKind};use crate::conn::{CdpConnection, CommandDispatchContext, PreparedTargetHostClosure};-use crate::devtools_runtime::{DevToolsError, DevToolsErrorKind, DevToolsTargetKind};use super::{events, worker_target};diff --git a/moli-protocol/src/domains/target/closing.rs b/moli-protocol/src/domains/target/closing.rsindex cdc911548..5073fe624 100644--- a/moli-protocol/src/domains/target/closing.rs+++ b/moli-protocol/src/domains/target/closing.rs@@ -1,6 +1,6 @@use serde::Deserialize;-use crate::devtools_runtime::{DevToolsCloseTargetResult, DevToolsTargetId};+use crate::automation::{DevToolsCloseTargetResult, DevToolsTargetId};use super::*;@@ -28,7 +28,7 @@ pub(super) fn start_close_target_command(conn,cmd.id,cmd.session_id,- DevToolsCommand::CloseTarget(command),+ AutomationCommand::CloseTarget(command),)}@@ -37,7 +37,7 @@ pub(super) fn build_cdp_close_target_command(params: CloseTargetParams,) -> DevToolsCloseTargetCommand {DevToolsCloseTargetCommand {- context: cmd.devtools_command_context(Some(params.target_id.as_str()), None::<&str>),+ context: cmd.automation_context(Some(params.target_id.as_str()), None::<&str>),target_id: DevToolsTargetId::from(params.target_id),}}@@ -66,7 +66,7 @@ pub(super) async fn complete_close_target_command_async({Ok(result) => {let mut plan =- CommandOutputPlan::from_devtools_result(DevToolsCommandResult::CloseTarget(result));+ CommandOutputPlan::from_devtools_result(AutomationResult::CloseTarget(result));plan.extend(side_effects.into_plan());plan}diff --git a/moli-protocol/src/domains/target/creation.rs b/moli-protocol/src/domains/target/creation.rsindex ffd329695..b96f71541 100644--- a/moli-protocol/src/domains/target/creation.rs+++ b/moli-protocol/src/domains/target/creation.rs@@ -1,11 +1,9 @@use serde::Deserialize;+use crate::automation::{DevToolsBrowserContextId, DevToolsCreateTargetResult, DevToolsTargetId};use crate::conn::{CdpSessionRoute, PreparedTargetAttach, TargetActivationTransition, TargetAttachSessionCommit,};-use crate::devtools_runtime::{- DevToolsBrowserContextId, DevToolsCreateTargetResult, DevToolsTargetId,-};use super::*;@@ -177,7 +175,7 @@ pub(super) fn build_cdp_create_target_command(return Err("Can't focus a target in the background. Use background=false instead.");}Ok(DevToolsCreateTargetCommand {- context: cmd.devtools_command_context(None::<&str>, params.browser_context_id.as_deref()),+ context: cmd.automation_context(None::<&str>, params.browser_context_id.as_deref()),// CDP defines the empty string as about:blank. Normalize before target// creation so URL metadata and the initial history entry agree.url: if params.url.is_empty() {@@ -226,7 +224,7 @@ fn start_devtools_create_target_command_with_result_host(}};plan.extend(CommandOutputPlan::from_devtools_result(- DevToolsCommandResult::CreateTarget(DevToolsCreateTargetResult {+ AutomationResult::CreateTarget(DevToolsCreateTargetResult {target_id: response_target_id,}),));diff --git a/moli-protocol/src/domains/target/events.rs b/moli-protocol/src/domains/target/events.rsindex 647ddbe84..81f959bc1 100644--- a/moli-protocol/src/domains/target/events.rs+++ b/moli-protocol/src/domains/target/events.rs@@ -1,9 +1,9 @@#[cfg(test)]use serde_json::Value;-use crate::devtools_runtime::{AutomationEvent, DevToolsTargetId, DevToolsTargetInfo};+use crate::automation::{AutomationEvent, DevToolsTargetId, DevToolsTargetInfo};#[cfg(test)]-use crate::devtools_runtime::{DevToolsSessionId, TargetAttachmentEvent, TargetDetachmentEvent};+use crate::automation::{DevToolsSessionId, TargetAttachmentEvent, TargetDetachmentEvent};use crate::domains::command_output::CommandOutputPlan;use super::*;@@ -136,7 +136,7 @@ pub(super) fn target_created_automation_event(target_info: DevToolsTargetInfo) -let kind = target_info.kind;let browser_context_id = target_info.browser_context_id.clone();let url = target_info.url.clone();- AutomationEvent::TargetCreated(crate::devtools_runtime::TargetLifecycleEvent {+ AutomationEvent::TargetCreated(crate::automation::TargetLifecycleEvent {target_id,browser_context_id,kind,@@ -168,7 +168,7 @@ fn devtools_target_info_from_cdp_value_lossy(value: Value) -> DevToolsTargetInfo.get("targetId").and_then(Value::as_str).map(DevToolsTargetId::from),- kind: crate::devtools_runtime::DevToolsTargetKind::from_cdp_type(+ kind: crate::automation::DevToolsTargetKind::from_cdp_type(value.get("type").and_then(Value::as_str),),title: value@@ -192,7 +192,7 @@ fn devtools_target_info_from_cdp_value_lossy(value: Value) -> DevToolsTargetInfoopener_frame_id: value.get("openerFrameId").and_then(Value::as_str)- .map(crate::devtools_runtime::DevToolsFrameId::from),+ .map(crate::automation::DevToolsFrameId::from),can_access_opener: value.get("canAccessOpener").and_then(Value::as_bool)@@ -200,7 +200,7 @@ fn devtools_target_info_from_cdp_value_lossy(value: Value) -> DevToolsTargetInfobrowser_context_id: value.get("browserContextId").and_then(Value::as_str)- .map(crate::devtools_runtime::DevToolsBrowserContextId::from),+ .map(crate::automation::DevToolsBrowserContextId::from),moli_popup_id: None,}}@@ -209,10 +209,10 @@ fn devtools_target_info_from_cdp_value_lossy(value: Value) -> DevToolsTargetInfopub(super) fn emit_target_destroyed(out: &mut impl CdpTargetAutomationEventSink, target_id: &str) {emit_cdp_target_automation_event(out,- AutomationEvent::TargetDestroyed(crate::devtools_runtime::TargetLifecycleEvent {+ AutomationEvent::TargetDestroyed(crate::automation::TargetLifecycleEvent {target_id: DevToolsTargetId::from(target_id),browser_context_id: None,- kind: crate::devtools_runtime::DevToolsTargetKind::Other,+ kind: crate::automation::DevToolsTargetKind::Other,url: String::new(),target_info: None,}),@@ -311,11 +311,11 @@ pub(super) async fn fail_pending_fetch_state_for_target_background_events_async(#[cfg(test)]mod tests {- use crate::conn::BackgroundProtocolEvent;- use crate::devtools_runtime::{+ use crate::automation::{AutomationEvent, DevToolsSessionId, DevToolsTargetId, DevToolsTargetKind,TargetDetachmentEvent, TargetLifecycleEvent,};+ use crate::conn::BackgroundProtocolEvent;use serde_json::json;fn pop_protocol_message(out: &mut Vec<BackgroundProtocolEvent>) -> serde_json::Value {diff --git a/moli-protocol/src/domains/target/info.rs b/moli-protocol/src/domains/target/info.rsindex 109b607e1..3a7eead12 100644--- a/moli-protocol/src/domains/target/info.rs+++ b/moli-protocol/src/domains/target/info.rs@@ -1,6 +1,6 @@use serde::Deserialize;-use crate::devtools_runtime::{+use crate::automation::{DevToolsGetTargetInfoCommand, DevToolsGetTargetInfoResult, DevToolsTargetId,};@@ -28,7 +28,7 @@ pub(super) fn get_target_info(conn: &mut CdpConnection, cmd: &Cmd<'_>) -> Commanconn,cmd.id,cmd.session_id,- DevToolsCommand::GetTargetInfo(command),+ AutomationCommand::GetTargetInfo(command),) {TargetCommandTaskStep::Complete(plan) => plan,TargetCommandTaskStep::Pending(_) => {@@ -42,7 +42,7 @@ fn build_cdp_get_target_info_command(params: GetTargetInfoParams,) -> DevToolsGetTargetInfoCommand {DevToolsGetTargetInfoCommand {- context: cmd.devtools_command_context(params.target_id.as_deref(), None::<&str>),+ context: cmd.automation_context(params.target_id.as_deref(), None::<&str>),target_id: params.target_id.map(DevToolsTargetId::from),}}@@ -53,7 +53,7 @@ pub(super) fn start_devtools_get_target_info_command() -> CommandOutputPlan {match execute_devtools_get_target_info_command(conn, command) {Ok(result) => {- CommandOutputPlan::from_devtools_result(DevToolsCommandResult::GetTargetInfo(result))+ CommandOutputPlan::from_devtools_result(AutomationResult::GetTargetInfo(result))}Err(error) => CommandOutputPlan::from_devtools_error(error),}diff --git a/moli-protocol/src/domains/target/protocol_neutral_tests.rs b/moli-protocol/src/domains/target/protocol_neutral_tests.rsindex a2d577d3e..c768a0b34 100644--- a/moli-protocol/src/domains/target/protocol_neutral_tests.rs+++ b/moli-protocol/src/domains/target/protocol_neutral_tests.rs@@ -1,4 +1,4 @@-use crate::devtools_runtime::DevToolsProtocol;+use crate::automation::FrontendProtocol;use serde_json::Value;use crate::conn::Cmd;@@ -30,7 +30,7 @@ fn cdp_create_target_builds_protocol_neutral_target_command() {).expect("valid target disposition");- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-create")@@ -70,7 +70,7 @@ fn cdp_close_target_builds_protocol_neutral_target_command() {},);- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-close")@@ -101,7 +101,7 @@ fn cdp_activate_target_builds_protocol_neutral_target_command() {},);- assert_eq!(command.context.protocol, DevToolsProtocol::Cdp);+ assert_eq!(command.context.protocol, FrontendProtocol::Cdp);assert_eq!(command.context.session_id.as_ref().map(|id| id.as_str()),Some("SID-activate")diff --git a/moli-protocol/src/domains/target/tests/tests_cdp_smoke_playwright.rs b/moli-protocol/src/domains/target/tests/tests_cdp_smoke_playwright.rsindex 52ff988a0..1a322d9ae 100644--- a/moli-protocol/src/domains/target/tests/tests_cdp_smoke_playwright.rs+++ b/moli-protocol/src/domains/target/tests/tests_cdp_smoke_playwright.rs@@ -140,7 +140,7 @@ async fn arm_popup_route(.expect("popup target Fetch configuration");let matching_sessions = fetch_snapshot.matching_request_stage_pause_sessions(Some(popup_session_id),- crate::devtools_runtime::DevToolsNetworkResourceType::Document,+ crate::automation::DevToolsNetworkResourceType::Document,&url::Url::parse(popup_url).expect("popup URL"),);assert_eq!(@@ -196,7 +196,7 @@ async fn fulfill_popup_document_and_evaluate(.expect("popup target Fetch configuration after debugger resume");let matching_sessions = fetch_snapshot.matching_request_stage_pause_sessions(Some(popup_session_id),- crate::devtools_runtime::DevToolsNetworkResourceType::Document,+ crate::automation::DevToolsNetworkResourceType::Document,&url::Url::parse(popup_url).expect("popup URL"),);assert_eq!(diff --git a/moli-protocol/src/domains/target/tests/tests_target_creation.rs b/moli-protocol/src/domains/target/tests/tests_target_creation.rsindex ede8d9c6b..a7cb631dc 100644--- a/moli-protocol/src/domains/target/tests/tests_target_creation.rs+++ b/moli-protocol/src/domains/target/tests/tests_target_creation.rs@@ -973,10 +973,10 @@ async fn window_open_emits_popup_target_created_from_runtime_work() {);let (targets_result, _) = ctx.conn- .execute_devtools_command(crate::devtools_runtime::DevToolsCommand::GetTargets(- crate::devtools_runtime::DevToolsGetTargetsCommand {- context: crate::devtools_runtime::DevToolsCommandContext {- protocol: crate::devtools_runtime::DevToolsProtocol::Cdp,+ .execute_automation_command(crate::automation::AutomationCommand::GetTargets(+ crate::automation::DevToolsGetTargetsCommand {+ context: crate::automation::AutomationContext {+ protocol: crate::automation::FrontendProtocol::Cdp,session_id: None,target_id: None,browser_context_id: None,@@ -988,7 +988,7 @@ async fn window_open_emits_popup_target_created_from_runtime_work() {)).await.into_parts();- let crate::devtools_runtime::DevToolsCommandResult::GetTargets(targets) =+ let crate::automation::AutomationResult::GetTargets(targets) =targets_result.expect("GetTargets should return typed targets")else {panic!("GetTargets returned unexpected result");diff --git a/moli-protocol/src/domains/target/worker_target.rs b/moli-protocol/src/domains/target/worker_target.rsindex 435552a2f..d4fd3fa73 100644--- a/moli-protocol/src/domains/target/worker_target.rs+++ b/moli-protocol/src/domains/target/worker_target.rs@@ -24,11 +24,9 @@ use moli_shared_worker::SharedWorkerInstanceId;use serde_json::json;use url::Url;-use crate::devtools_runtime::{DevToolsNetworkResourceType, RuntimeExecutionContextsClearedEvent};+use crate::automation::{DevToolsNetworkResourceType, RuntimeExecutionContextsClearedEvent};#[cfg(test)]-use crate::devtools_runtime::{- DevToolsTargetInfo, DevToolsTargetKind, RuntimeExecutionContextEvent,-};+use crate::automation::{DevToolsTargetInfo, DevToolsTargetKind, RuntimeExecutionContextEvent};use crate::{conn::{BackgroundProtocolEvent, CdpConnection, CdpSessionRoute, CommandOwnerScope,diff --git a/moli-protocol/src/domains/target/worker_target/tests.rs b/moli-protocol/src/domains/target/worker_target/tests.rsindex f05f09e9f..d852ff52c 100644--- a/moli-protocol/src/domains/target/worker_target/tests.rs+++ b/moli-protocol/src/domains/target/worker_target/tests.rs@@ -1370,11 +1370,11 @@ async fn service_worker_target_lifecycle_drain_preserves_typed_target_sidecars()for event in events {let (message, automation_event) = event.into_parts();match automation_event {- Some(crate::devtools_runtime::AutomationEvent::TargetCreated(event)) => {+ Some(crate::automation::AutomationEvent::TargetCreated(event)) => {assert_eq!(message["method"], json!("Target.targetCreated"));sidecars.push(("created", event.target_id.as_str().to_owned(), None));}- Some(crate::devtools_runtime::AutomationEvent::TargetAttached(event)) => {+ Some(crate::automation::AutomationEvent::TargetAttached(event)) => {assert_eq!(message["method"], json!("Target.attachedToTarget"));assert!(event.waiting_for_debugger);sidecars.push((@@ -1383,7 +1383,7 @@ async fn service_worker_target_lifecycle_drain_preserves_typed_target_sidecars()Some(event.session_id.as_str().to_owned()),));}- Some(crate::devtools_runtime::AutomationEvent::TargetDetached(event)) => {+ Some(crate::automation::AutomationEvent::TargetDetached(event)) => {assert_eq!(message["method"], json!("Target.detachedFromTarget"));sidecars.push(("detached",@@ -1391,7 +1391,7 @@ async fn service_worker_target_lifecycle_drain_preserves_typed_target_sidecars()Some(event.session_id.as_str().to_owned()),));}- Some(crate::devtools_runtime::AutomationEvent::TargetDestroyed(event)) => {+ Some(crate::automation::AutomationEvent::TargetDestroyed(event)) => {assert_eq!(message["method"], json!("Target.targetDestroyed"));sidecars.push(("destroyed", event.target_id.as_str().to_owned(), None));}@@ -1956,7 +1956,7 @@ fn service_worker_target_stopped_retains_target_and_clears_runtime_sessions() {assert_eq!(runtime_cleared["sessionId"], attached_session_id);assert!(matches!(runtime_cleared_sidecar,- Some(crate::devtools_runtime::AutomationEvent::RuntimeExecutionContextsCleared(_))+ Some(crate::automation::AutomationEvent::RuntimeExecutionContextsCleared(_))));let inspector_crashed = lifecycle_protocol_message(&outputs, "Inspector.targetCrashed").expect("service worker stop should emit Inspector.targetCrashed");@@ -2735,8 +2735,7 @@ fn service_worker_exception_messages_emit_runtime_exception_thrown_shape() {assert_eq!(details["executionContextId"], json!(90_024));assert_eq!(details["lineNumber"], json!(2));assert_eq!(details["columnNumber"], json!(8));- let Some(crate::devtools_runtime::AutomationEvent::ScriptException(event)) = automation_event- else {+ let Some(crate::automation::AutomationEvent::ScriptException(event)) = automation_event else {panic!("expected ScriptException sidecar");};assert_eq!(event.exception.text, "Uncaught Error: boom");@@ -2919,38 +2918,38 @@ fn service_worker_fetch_diagnostics_emit_network_event_shape() {);assert!(matches!(sidecars[0].as_ref(),- Some(crate::devtools_runtime::AutomationEvent::NetworkBeforeRequestSent(event))+ Some(crate::automation::AutomationEvent::NetworkBeforeRequestSent(event))if event.request_id.as_str() == "TID-service-worker.sw-fetch.101.4"&& event.method.as_deref() == Some("POST")&& event.resource_type- == Some(crate::devtools_runtime::DevToolsNetworkResourceType::Fetch)+ == Some(crate::automation::DevToolsNetworkResourceType::Fetch)));assert!(matches!(sidecars[1].as_ref(),- Some(crate::devtools_runtime::AutomationEvent::NetworkResponseStarted(event))+ Some(crate::automation::AutomationEvent::NetworkResponseStarted(event))if event.status == Some(201)&& event.url == "https://example.test/api"));assert!(matches!(sidecars[3].as_ref(),- Some(crate::devtools_runtime::AutomationEvent::NetworkResponseCompleted(event))+ Some(crate::automation::AutomationEvent::NetworkResponseCompleted(event))if event.encoded_data_length == Some(2)&& event.resource_type- == Some(crate::devtools_runtime::DevToolsNetworkResourceType::Fetch)+ == Some(crate::automation::DevToolsNetworkResourceType::Fetch)));assert!(matches!(sidecars[5].as_ref(),- Some(crate::devtools_runtime::AutomationEvent::NetworkFetchError(event))+ Some(crate::automation::AutomationEvent::NetworkFetchError(event))if event.error_text.as_deref() == Some("ServiceWorkerFallback")&& event.resource_type- == Some(crate::devtools_runtime::DevToolsNetworkResourceType::Script)+ == Some(crate::automation::DevToolsNetworkResourceType::Script)));assert!(matches!(sidecars[7].as_ref(),- Some(crate::devtools_runtime::AutomationEvent::NetworkFetchError(event))+ Some(crate::automation::AutomationEvent::NetworkFetchError(event))if event.error_text.as_deref() == Some("network down")&& event.resource_type- == Some(crate::devtools_runtime::DevToolsNetworkResourceType::Image)+ == Some(crate::automation::DevToolsNetworkResourceType::Image)));}@@ -2988,7 +2987,7 @@ fn service_worker_fetch_diagnostic_aborted_failure_sets_loading_failed_canceled();assert!(matches!(sidecars[1].as_ref(),- Some(crate::devtools_runtime::AutomationEvent::NetworkFetchError(event))+ Some(crate::automation::AutomationEvent::NetworkFetchError(event))if event.error_text.as_deref() == Some("net::ERR_ABORTED")));}@@ -3385,7 +3384,7 @@ async fn shared_worker_target_console_messages_emit_to_target_session_and_advanc);assert!(matches!(console_sidecar,- Some(crate::devtools_runtime::AutomationEvent::RuntimeConsoleApiCalled(event))+ Some(crate::automation::AutomationEvent::RuntimeConsoleApiCalled(event))if event.console_type == "warning"&& event.text == "from shared worker"&& event.execution_context_id.is_none()@@ -3410,7 +3409,7 @@ async fn shared_worker_target_console_messages_emit_to_target_session_and_advanc);assert!(matches!(runtime_sidecar,- Some(crate::devtools_runtime::AutomationEvent::RuntimeConsoleApiCalled(event))+ Some(crate::automation::AutomationEvent::RuntimeConsoleApiCalled(event))if event.console_type == "warning"&& event.text == "from shared worker"&& event.execution_context_id == Some(90_017)diff --git a/moli-protocol/src/domains/target/worker_target_attachment_tests.rs b/moli-protocol/src/domains/target/worker_target_attachment_tests.rsindex ab0146d4c..fa6f633c7 100644--- a/moli-protocol/src/domains/target/worker_target_attachment_tests.rs+++ b/moli-protocol/src/domains/target/worker_target_attachment_tests.rs@@ -12,8 +12,8 @@ use serde_json::{Value, json};use super::*;use crate::{+ automation::AutomationEvent,conn::{BrowserContext, CdpTargetFilter, CommandDispatchContext, CommandOwnerScope},- devtools_runtime::AutomationEvent,domains::activity::{ProtocolOutputPayloads, ProtocolOutputProjectionContext},};diff --git a/moli-protocol/src/lib.rs b/moli-protocol/src/lib.rsindex b8a6c57f8..932f1195a 100644--- a/moli-protocol/src/lib.rs+++ b/moli-protocol/src/lib.rs@@ -1,13 +1,13 @@-//! Protocol-neutral DevTools owner and dispatch layer for Moli.+//! Protocol-neutral automation owner and dispatch layer for Moli.//!//! This crate is being split away from the Chrome DevTools Protocol wire shape.//! It still contains transitional CDP-named owner types, but protocol-specific//! parsing and Chrome protocol metadata belong in//! `moli-protocol-cdp`.+pub mod automation;mod cdp_projection;pub mod conn;-pub mod devtools_runtime;pub mod domains;#[cfg(feature = "test-support")]pub mod test_support;@@ -15,23 +15,22 @@ pub mod test_support;pub mod testing;pub mod version;-pub use devtools_runtime::*;+pub use automation::*;pub use conn::{- BackgroundCommandResponsePayload, BackgroundProtocolEvent, CdpCommandTaskStep, CdpConnection,- CdpInitialStoragePartition, CdpRendererCommandAccess, CdpRendererCommandReplacement,- CdpRendererCommandReplayDispatch, CdpRendererOwnerTurnOutcome, CdpSchedulerEvent,- CdpTargetHostLifecycleDelta, CdpTargetHostLifecycleObserver, CdpTurnOutcome,+ AutomationCommandDispatchOutcome, BackgroundCommandResponsePayload, BackgroundProtocolEvent,+ CdpCommandTaskStep, CdpConnection, CdpInitialStoragePartition, CdpRendererCommandAccess,+ CdpRendererCommandReplacement, CdpRendererCommandReplayDispatch, CdpRendererOwnerTurnOutcome,+ CdpSchedulerEvent, CdpTargetHostLifecycleDelta, CdpTargetHostLifecycleObserver, CdpTurnOutcome,CommandDispatchContext, CommandResponseFlushContext, CommandResponseFlushPermit,CompletedCdpCommandDispatch, CompletedDeferredMainDocumentLoadCompletion,CompletedRuntimeProtocolMessageDispatch, DEFAULT_CDP_PAGE_TARGET_ID, DEFAULT_CDP_TAB_TARGET_ID,DeferredMainDocumentLoadCompletionOutputAction,DeferredMainDocumentLoadCompletionOutputInterest, DeferredMainDocumentLoadObservationId,- DeferredMainDocumentLoadPredecessorCandidate, DevToolsCommandDispatchOutcome,- DevToolsDocumentLifecycleWaitKey, DevToolsDocumentLifecycleWaitState,- DevToolsDocumentNavigationState, DevToolsPageResidenceIdentity, ParsedCdpCommand,- PendingCdpCommandDispatch, PendingDeferredMainDocumentLoadCompletion,- PendingRuntimeProtocolMessageDispatch,+ DeferredMainDocumentLoadPredecessorCandidate, DevToolsDocumentLifecycleWaitKey,+ DevToolsDocumentLifecycleWaitState, DevToolsDocumentNavigationState,+ DevToolsPageResidenceIdentity, ParsedCdpCommand, PendingCdpCommandDispatch,+ PendingDeferredMainDocumentLoadCompletion, PendingRuntimeProtocolMessageDispatch,};pub use domains::activity::{ProtocolNavigationDependency, ProtocolSchedulerWork, ProtocolSchedulerWorkKind,diff --git a/moli-protocol/src/testing.rs b/moli-protocol/src/testing.rsindex 55bb3652b..de1c2471f 100644--- a/moli-protocol/src/testing.rs+++ b/moli-protocol/src/testing.rs@@ -13,7 +13,7 @@ use super::conn::{LoadedNavigationRendererAttachmentCommit, ParsedCdpCommand, PendingCdpCommandDispatch,RuntimeInspectorResponseReady,};-use crate::devtools_runtime::{DevToolsCommand, DevToolsCommandResult, DevToolsError};+use crate::automation::{AutomationCommand, AutomationResult, DevToolsError};use crate::domains::activity::{ProtocolSchedulerWork, ProtocolSchedulerWorkKind, RuntimeCommandOutputBarrierCompletion,RuntimeCommandOutputBarrierPermit, RuntimeCommandOutputBarriers,@@ -681,7 +681,7 @@ impl TestContext {/// Routes the output of one direct protocol-neutral command through the/// stateful test scheduler.///- /// Direct `DevToolsCommand` fixtures bypass parsed CDP dispatch but can+ /// Direct `AutomationCommand` fixtures bypass parsed CDP dispatch but can/// still publish protocol work whose exact owner action is not ready yet./// Keeping that work resident here mirrors the production scheduler;/// callers must use the scheduler wait helpers for later renderer input.@@ -983,13 +983,13 @@ impl TestContext {/// Completes one protocol-neutral command across the same concrete/// renderer-output boundary as the production actor.- pub(crate) async fn execute_devtools_command_through_renderer_fence_for_test(+ pub(crate) async fn execute_automation_command_through_renderer_fence_for_test(&mut self,- command: DevToolsCommand,- ) -> Result<DevToolsCommandResult, DevToolsError> {+ command: AutomationCommand,+ ) -> Result<AutomationResult, DevToolsError> {let (result, scheduler_events, protocol_events, renderer_output_predecessor) = self.conn- .execute_devtools_command(command)+ .execute_automation_command(command).await.into_complete_parts();if let Some(predecessor) = renderer_output_predecessor {diff --git a/moli-renderer-v8/src/lib.rs b/moli-renderer-v8/src/lib.rsindex 0b7794780..bba2c0320 100644--- a/moli-renderer-v8/src/lib.rs+++ b/moli-renderer-v8/src/lib.rs@@ -233,7 +233,7 @@ pub use runtime::{RendererBrowserContextRuntimeOwnerAccess, RendererCaptureScreencastFrameReply,RendererCaptureScreencastFrameRequest, RendererCaptureScreenshotReply,RendererCaptureScreenshotRequest, RendererCapturedScreencastFrame, RendererCapturedScreenshot,- RendererCommandTurnCompletion, RendererCommandTurnOutput, RendererCountEntry,+ RendererCdpCall, RendererCommandTurnCompletion, RendererCommandTurnOutput, RendererCountEntry,RendererDedicatedWorkerTargetEvent, RendererDedicatedWorkerTargetInfo,RendererDevToolsAgentToken, RendererDevToolsMainCommandEnvelope, RendererDocumentBoxModel,RendererDocumentChildNodeSnapshotEvent, RendererDocumentChildNodeSnapshotEvents,@@ -271,7 +271,7 @@ pub use runtime::{RendererLifecycleStartReason, RendererLifecycleTerminationStamp, RendererMainDocumentCommit,RendererMoliDomMemoryDiagnostics, RendererMoliMemoryDiagnostics,RendererMoliMemoryScopeDiagnostics, RendererMoliRuntimeMemoryDiagnostics,- RendererNativeCommand, RendererNativeCommandReadyResponse, RendererNativeCommandResponseGuard,+ RendererNativeCommandReadyResponse, RendererNativeCommandResponseGuard,RendererNativeCommandTerminal, RendererNativeOperation, RendererNativeOperationStep,RendererNativeProtocolError, RendererNativeProtocolNotification,RendererNativeProtocolResponse, RendererNativeProtocolStateUpdate, RendererOutputCursor,diff --git a/moli-renderer-v8/src/runtime/mod.rs b/moli-renderer-v8/src/runtime/mod.rsindex 2687583cf..7f5af739e 100644--- a/moli-renderer-v8/src/runtime/mod.rs+++ b/moli-renderer-v8/src/runtime/mod.rs@@ -411,7 +411,7 @@ pub(in crate::runtime) use self::phase_one::{};pub(crate) use self::protocol_output::{PendingRendererOutputRecord, RendererTurnOutputJournal};pub use self::protocol_output::{- RendererDocumentTitleChanged, RendererNativeCommand, RendererNativeCommandReadyResponse,+ RendererCdpCall, RendererDocumentTitleChanged, RendererNativeCommandReadyResponse,RendererNativeCommandResponseGuard, RendererNativeCommandTerminal, RendererNativeOperation,RendererNativeOperationStep, RendererNativeProtocolError, RendererNativeProtocolNotification,RendererNativeProtocolResponse, RendererNativeProtocolStateUpdate, RendererOutputCursor,diff --git a/moli-renderer-v8/src/runtime/page_surface.rs b/moli-renderer-v8/src/runtime/page_surface.rsindex 8ee7ca72f..c85fba9ce 100644--- a/moli-renderer-v8/src/runtime/page_surface.rs+++ b/moli-renderer-v8/src/runtime/page_surface.rs@@ -4644,7 +4644,7 @@ pub(crate) enum RendererInspectorPageCommand {#[non_exhaustive]pub enum RendererPageCommand {- Native(Box<RendererNativeCommand>),+ Native(Box<RendererCdpCall>),Inspector(RendererInspectorCommandEnvelope),EvaluateExpression {expression: String,diff --git a/moli-renderer-v8/src/runtime/protocol_output/mod.rs b/moli-renderer-v8/src/runtime/protocol_output/mod.rsindex 2e1f02550..76586a888 100644--- a/moli-renderer-v8/src/runtime/protocol_output/mod.rs+++ b/moli-renderer-v8/src/runtime/protocol_output/mod.rs@@ -23,7 +23,7 @@ pub use item::{RendererProtocolObservation,};pub use native_response::{- RendererNativeCommand, RendererNativeCommandReadyResponse, RendererNativeCommandResponseGuard,+ RendererCdpCall, RendererNativeCommandReadyResponse, RendererNativeCommandResponseGuard,RendererNativeCommandTerminal, RendererNativeOperation, RendererNativeOperationStep,RendererNativeProtocolError, RendererNativeProtocolNotification,RendererNativeProtocolResponse, RendererNativeProtocolStateUpdate,diff --git a/moli-renderer-v8/src/runtime/protocol_output/native_response.rs b/moli-renderer-v8/src/runtime/protocol_output/native_response.rsindex ca03a62c7..4c715d90d 100644--- a/moli-renderer-v8/src/runtime/protocol_output/native_response.rs+++ b/moli-renderer-v8/src/runtime/protocol_output/native_response.rs@@ -136,7 +136,7 @@ impl Drop for RendererNativeCommandResponseGuard {/// Native frontend operations use their ordinary backend dispatch. The/// synchronous projection freezes the complete response before it enters/// the common journal, without involving an adapter waiter.-pub struct RendererNativeCommand {+pub struct RendererCdpCall {pub(crate) operation: RendererNativeOperation,response: RendererNativeCommandResponse,}@@ -148,7 +148,7 @@ struct RendererNativeCommandResponse {lease: Lease,}-impl RendererNativeCommand {+impl RendererCdpCall {pub fn new(command_id: FrontendCommandId,session: DevToolsSessionKey,@@ -332,7 +332,7 @@ enum NativeReadyReply {},}-impl RendererNativeCommand {+impl RendererCdpCall {pub(crate) fn dispatch(self,vm: &mut crate::runtime::PageVm,diff --git a/moli-renderer-v8/src/runtime/tests/extracted/runtime_scripts.rs b/moli-renderer-v8/src/runtime/tests/extracted/runtime_scripts.rsindex 7804beea7..f14fee628 100644--- a/moli-renderer-v8/src/runtime/tests/extracted/runtime_scripts.rs+++ b/moli-renderer-v8/src/runtime/tests/extracted/runtime_scripts.rs@@ -2587,7 +2587,7 @@ __lm_snapshot_revocable_array.revoke();}#[tokio::test(flavor = "multi_thread")]async fn native_terminals_publish_before_waiters_are_polled() {- use super::{RendererNativeCommand, RendererNativeOperation, RendererNativeProtocolResponse};+ use super::{RendererCdpCall, RendererNativeOperation, RendererNativeProtocolResponse};use moli_page_types::{DevToolsSessionKey, RendererAgentAttachmentId};let runtime = JsRuntime::initialize();let (output_tx, mut output_rx) = renderer_external_activity_test_channel();@@ -2605,7 +2605,7 @@ async fn native_terminals_publish_before_waiters_are_polled() {let mut pending = Vec::new();let mut guards = Vec::new();for command_id in [100, 101, 102] {- let (command, guard) = RendererNativeCommand::new(+ let (command, guard) = RendererCdpCall::new(moli_page_types::FrontendCommandId::new(command_id),DevToolsSessionKey::Attached("session-a".to_owned()),attachment,@@ -2733,7 +2733,7 @@ async fn native_terminals_publish_before_waiters_are_polled() {#[tokio::test(flavor = "multi_thread")]async fn projected_native_success_and_error_publish_without_adapter_receipt() {- use super::{RendererNativeCommand, RendererNativeOperation, RendererNativeProtocolResponse};+ use super::{RendererCdpCall, RendererNativeOperation, RendererNativeProtocolResponse};use moli_page_types::{DevToolsSessionKey, FrontendCommandId, RendererAgentAttachmentId};let runtime = JsRuntime::initialize();let (output_tx, mut output_rx) = renderer_external_activity_test_channel();@@ -2751,7 +2751,7 @@ async fn projected_native_success_and_error_publish_without_adapter_receipt() {let mut waiters = Vec::new();let mut guards = Vec::new();for id in [1, 2] {- let (command, guard) = RendererNativeCommand::new(+ let (command, guard) = RendererCdpCall::new(FrontendCommandId::new(id),DevToolsSessionKey::Attached("native".to_owned()),attachment,