зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #5415 - Get the barest bones of webdriver integration ready for keeners (from jdm:webdriver); r=jdm
Requires https://github.com/jgraham/webdriver-rust/pull/6. Source-Repo: https://github.com/servo/servo Source-Revision: 1f57c6d74acd50077eb015bdebffd2adac1e552e
This commit is contained in:
Родитель
a38989653a
Коммит
46eb131dd4
|
@ -18,6 +18,7 @@ dependencies = [
|
|||
"time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webdriver_server 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -966,6 +967,34 @@ dependencies = [
|
|||
"rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webdriver"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/jgraham/webdriver-rust.git#906806d51783b5caad89432bf8ce008f2f4968fc"
|
||||
dependencies = [
|
||||
"hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"uuid 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webdriver_server"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"webdriver 0.0.1 (git+https://github.com/jgraham/webdriver-rust.git)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.0.5"
|
||||
|
|
|
@ -72,6 +72,9 @@ path = "../gfx"
|
|||
[dependencies.devtools]
|
||||
path = "../devtools"
|
||||
|
||||
[dependencies.webdriver_server]
|
||||
path = "../webdriver_server"
|
||||
|
||||
[dependencies.glutin_app]
|
||||
path = "../../ports/glutin"
|
||||
optional = true
|
||||
|
|
|
@ -21,6 +21,7 @@ extern crate layout;
|
|||
extern crate gfx;
|
||||
extern crate libc;
|
||||
extern crate url;
|
||||
extern crate webdriver_server;
|
||||
|
||||
use compositing::CompositorEventListener;
|
||||
use compositing::windowing::WindowEvent;
|
||||
|
@ -84,6 +85,10 @@ impl Browser {
|
|||
devtools::start_server(port)
|
||||
});
|
||||
|
||||
if let Some(port) = opts.webdriver_port {
|
||||
webdriver_server::start_server(port);
|
||||
}
|
||||
|
||||
// Create a Servo instance.
|
||||
let resource_task = new_resource_task(opts.user_agent.clone());
|
||||
|
||||
|
|
|
@ -108,6 +108,10 @@ pub struct Opts {
|
|||
/// remote Firefox devtools connections.
|
||||
pub devtools_port: Option<u16>,
|
||||
|
||||
/// `None` to disable WebDriver or `Some` with a port number to start a server to listen to
|
||||
/// remote WebDriver commands.
|
||||
pub webdriver_port: Option<u16>,
|
||||
|
||||
/// The initial requested size of the window.
|
||||
pub initial_window_size: TypedSize2D<ScreenPx, u32>,
|
||||
|
||||
|
@ -199,6 +203,7 @@ pub fn default_opts() -> Opts {
|
|||
enable_text_antialiasing: false,
|
||||
trace_layout: false,
|
||||
devtools_port: None,
|
||||
webdriver_port: None,
|
||||
initial_window_size: TypedSize2D(800, 600),
|
||||
user_agent: None,
|
||||
dump_flow_tree: false,
|
||||
|
@ -232,6 +237,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
|
|||
getopts::optflag("z", "headless", "Headless mode"),
|
||||
getopts::optflag("f", "hard-fail", "Exit on task failure instead of displaying about:failure"),
|
||||
getopts::optflagopt("", "devtools", "Start remote devtools server on port", "6000"),
|
||||
getopts::optflagopt("", "webdriver", "Start remote WebDriver server on port", "7000"),
|
||||
getopts::optopt("", "resolution", "Set window resolution.", "800x600"),
|
||||
getopts::optopt("u", "user-agent", "Set custom user agent string", "NCSA Mosaic/1.0 (X11;SunOS 4.1.4 sun4m)"),
|
||||
getopts::optopt("Z", "debug", "A comma-separated string of debug options. Pass help to show available options.", ""),
|
||||
|
@ -318,6 +324,10 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
|
|||
port.parse().unwrap()
|
||||
});
|
||||
|
||||
let webdriver_port = opt_match.opt_default("webdriver", "7000").map(|port| {
|
||||
port.parse().unwrap()
|
||||
});
|
||||
|
||||
let initial_window_size = match opt_match.opt_str("resolution") {
|
||||
Some(res_string) => {
|
||||
let res: Vec<u32> = res_string.split('x').map(|r| r.parse().unwrap()).collect();
|
||||
|
@ -348,6 +358,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
|
|||
profile_tasks: debug_options.contains(&"profile-tasks"),
|
||||
trace_layout: trace_layout,
|
||||
devtools_port: devtools_port,
|
||||
webdriver_port: webdriver_port,
|
||||
initial_window_size: initial_window_size,
|
||||
user_agent: opt_match.opt_str("u"),
|
||||
show_debug_borders: debug_options.contains(&"show-compositor-borders"),
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "webdriver_server"
|
||||
version = "0.0.1"
|
||||
authors = ["The Servo Project Developers"]
|
||||
|
||||
[lib]
|
||||
name = "webdriver_server"
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies.webdriver]
|
||||
git = "https://github.com/jgraham/webdriver-rust.git"
|
|
@ -0,0 +1,32 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![crate_name = "webdriver_server"]
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
#![feature(net)]
|
||||
|
||||
extern crate webdriver;
|
||||
|
||||
use webdriver::command::WebDriverMessage;
|
||||
use webdriver::error::WebDriverResult;
|
||||
use webdriver::response::WebDriverResponse;
|
||||
use webdriver::server::{self, WebDriverHandler, Session};
|
||||
|
||||
use std::net::IpAddr;
|
||||
|
||||
pub fn start_server(port: u16) {
|
||||
server::start(IpAddr::new_v4(0, 0, 0, 0), port, Handler);
|
||||
}
|
||||
|
||||
struct Handler;
|
||||
|
||||
impl WebDriverHandler for Handler {
|
||||
fn handle_command(&mut self, _session: &Option<Session>, _msg: &WebDriverMessage) -> WebDriverResult<WebDriverResponse> {
|
||||
Ok(WebDriverResponse::Void)
|
||||
}
|
||||
|
||||
fn delete_session(&mut self, _session: &Option<Session>) {
|
||||
}
|
||||
}
|
|
@ -864,6 +864,7 @@ dependencies = [
|
|||
"time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webdriver_server 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -992,6 +993,34 @@ dependencies = [
|
|||
"rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webdriver"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/jgraham/webdriver-rust.git#906806d51783b5caad89432bf8ce008f2f4968fc"
|
||||
dependencies = [
|
||||
"hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"uuid 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webdriver_server"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"webdriver 0.0.1 (git+https://github.com/jgraham/webdriver-rust.git)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.0.5"
|
||||
|
|
|
@ -788,6 +788,7 @@ dependencies = [
|
|||
"time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webdriver_server 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -908,6 +909,34 @@ dependencies = [
|
|||
"rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webdriver"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/jgraham/webdriver-rust.git#906806d51783b5caad89432bf8ce008f2f4968fc"
|
||||
dependencies = [
|
||||
"hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"uuid 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webdriver_server"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"webdriver 0.0.1 (git+https://github.com/jgraham/webdriver-rust.git)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xlib"
|
||||
version = "0.1.0"
|
||||
|
|
Загрузка…
Ссылка в новой задаче