Auto merge of #23588 - georgeroman:implement_status_wd_command, r=ferjm

Implement Status WebDriver command

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [X] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23588)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-06-23 19:44:59 -04:00 committed by GitHub
commit a2b195aff8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View file

@ -542,6 +542,17 @@ impl Handler {
Ok(WebDriverResponse::DeleteSession)
}
// https://w3c.github.io/webdriver/#status
fn handle_status(&self) -> WebDriverResult<WebDriverResponse> {
Ok(WebDriverResponse::Generic(ValueResponse(
if self.session.is_none() {
json!({ "ready": true, "message": "Ready for a new session" })
} else {
json!({ "ready": false, "message": "Not ready for a new session" })
},
)))
}
fn browsing_context_script_command(
&self,
cmd_msg: WebDriverScriptCommand,
@ -1426,7 +1437,7 @@ impl WebDriverHandler<ServoExtensionRoute> for Handler {
// Unless we are trying to create a new session, we need to ensure that a
// session has previously been created
match msg.command {
WebDriverCommand::NewSession(_) => {},
WebDriverCommand::NewSession(_) | WebDriverCommand::Status => {},
_ => {
self.session()?;
},
@ -1435,6 +1446,7 @@ impl WebDriverHandler<ServoExtensionRoute> for Handler {
match msg.command {
WebDriverCommand::NewSession(ref parameters) => self.handle_new_session(parameters),
WebDriverCommand::DeleteSession => self.handle_delete_session(),
WebDriverCommand::Status => self.handle_status(),
WebDriverCommand::AddCookie(ref parameters) => self.handle_add_cookie(parameters),
WebDriverCommand::Get(ref parameters) => self.handle_get(parameters),
WebDriverCommand::GetCurrentUrl => self.handle_current_url(),

View file

@ -1,2 +0,0 @@
[status.py]
disabled: Unimplemented WebDriver command