Move WebDriverCommandMsg to script_traits.

This commit is contained in:
Ms2ger 2016-07-04 14:03:16 +02:00
parent 61491447e2
commit 54bb138ddc
4 changed files with 29 additions and 22 deletions

View file

@ -24,7 +24,6 @@ use gfx_traits::Epoch;
use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER;
use layout_traits::LayoutThreadFactory;
use msg::constellation_msg::WebDriverCommandMsg;
use msg::constellation_msg::{FrameId, FrameType, PipelineId};
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId, NavigationDirection};
@ -46,7 +45,7 @@ use script_traits::{ConstellationControlMsg, ConstellationMsg as FromCompositorM
use script_traits::{DocumentState, LayoutControlMsg};
use script_traits::{IFrameLoadInfo, IFrameSandboxState, TimerEventRequest};
use script_traits::{LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, ScriptThreadFactory};
use script_traits::{MozBrowserEvent, MozBrowserErrorType};
use script_traits::{MozBrowserEvent, MozBrowserErrorType, WebDriverCommandMsg};
use std::borrow::ToOwned;
use std::collections::HashMap;
use std::io::Error as IOError;

View file

@ -6,16 +6,15 @@
//! reduce coupling between these two components.
use euclid::scale_factor::ScaleFactor;
use euclid::size::{Size2D, TypedSize2D};
use euclid::size::TypedSize2D;
use hyper::header::Headers;
use hyper::method::Method;
use ipc_channel::ipc::{IpcSender, IpcSharedMemory};
use ipc_channel::ipc::IpcSharedMemory;
use layers::geometry::DevicePixel;
use std::cell::Cell;
use std::fmt;
use url::Url;
use util::geometry::{PagePx, ViewportPx};
use webdriver_msg::{LoadStatus, WebDriverScriptCommand};
use webrender_traits;
pub type PanicMsg = (Option<PipelineId>, String, String);
@ -186,17 +185,6 @@ bitflags! {
}
}
#[derive(Deserialize, Serialize)]
pub enum WebDriverCommandMsg {
GetWindowSize(PipelineId, IpcSender<WindowSizeData>),
LoadUrl(PipelineId, LoadData, IpcSender<LoadStatus>),
Refresh(PipelineId, IpcSender<LoadStatus>),
ScriptCommand(PipelineId, WebDriverScriptCommand),
SendKeys(PipelineId, Vec<(Key, KeyModifiers, KeyState)>),
SetWindowSize(PipelineId, Size2D<u32>, IpcSender<WindowSizeData>),
TakeScreenshot(PipelineId, IpcSender<Option<Image>>),
}
#[derive(Clone, Copy, Deserialize, Eq, PartialEq, Serialize, HeapSizeOf)]
pub enum PixelFormat {
K8, // Luminance channel only

View file

@ -43,11 +43,10 @@ use gfx_traits::StackingContextId;
use heapsize::HeapSizeOf;
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use libc::c_void;
use msg::constellation_msg::{FrameId, FrameType, Key, KeyModifiers, KeyState, LoadData};
use msg::constellation_msg::{FrameId, FrameType, Image, Key, KeyModifiers, KeyState, LoadData};
use msg::constellation_msg::{NavigationDirection, PanicMsg, PipelineId};
use msg::constellation_msg::{PipelineNamespaceId, SubpageId, WindowSizeData};
use msg::constellation_msg::{WebDriverCommandMsg, WindowSizeType};
use msg::webdriver_msg::WebDriverScriptCommand;
use msg::constellation_msg::{PipelineNamespaceId, SubpageId, WindowSizeData, WindowSizeType};
use msg::webdriver_msg::{LoadStatus, WebDriverScriptCommand};
use net_traits::ResourceThreads;
use net_traits::bluetooth_thread::BluetoothMethodMsg;
use net_traits::image_cache_thread::ImageCacheThread;
@ -522,6 +521,27 @@ pub struct StackingContextScrollState {
pub scroll_offset: Point2D<f32>,
}
/// Messages to the constellation originating from the WebDriver server.
#[derive(Deserialize, Serialize)]
pub enum WebDriverCommandMsg {
/// Get the window size.
GetWindowSize(PipelineId, IpcSender<WindowSizeData>),
/// Load a URL in the pipeline with the given ID.
LoadUrl(PipelineId, LoadData, IpcSender<LoadStatus>),
/// Refresh the pipeline with the given ID.
Refresh(PipelineId, IpcSender<LoadStatus>),
/// Pass a webdriver command to the script thread of the pipeline with the
/// given ID for execution.
ScriptCommand(PipelineId, WebDriverScriptCommand),
/// Act as if keys were pressed in the pipeline with the given ID.
SendKeys(PipelineId, Vec<(Key, KeyModifiers, KeyState)>),
/// Set the window size.
SetWindowSize(PipelineId, Size2D<u32>, IpcSender<WindowSizeData>),
/// Take a screenshot of the window, if the pipeline with the given ID is
/// the root pipeline.
TakeScreenshot(PipelineId, IpcSender<Option<Image>>),
}
/// Messages to the constellation.
#[derive(Deserialize, Serialize)]
pub enum ConstellationMsg {

View file

@ -32,13 +32,13 @@ use image::{DynamicImage, ImageFormat, RgbImage};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use keys::keycodes_to_keys;
use msg::constellation_msg::{FrameId, LoadData, PipelineId};
use msg::constellation_msg::{NavigationDirection, PixelFormat, WebDriverCommandMsg};
use msg::constellation_msg::{NavigationDirection, PixelFormat};
use msg::webdriver_msg::{LoadStatus, WebDriverCookieError, WebDriverFrameId};
use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult, WebDriverScriptCommand};
use regex::Captures;
use rustc_serialize::base64::{CharacterSet, Config, Newline, ToBase64};
use rustc_serialize::json::{Json, ToJson};
use script_traits::ConstellationMsg;
use script_traits::{ConstellationMsg, WebDriverCommandMsg};
use std::borrow::ToOwned;
use std::collections::BTreeMap;
use std::net::{SocketAddr, SocketAddrV4};