Bug 1444068 - Log the seconds geckodriver will wait to connect to the browser
MozReview-Commit-ID: CQeqYgnHq0s
--- a/testing/geckodriver/src/marionette.rs
+++ b/testing/geckodriver/src/marionette.rs
@@ -1341,21 +1341,23 @@ impl MarionetteConnection {
MarionetteConnection {
port: port,
stream: None,
session: MarionetteSession::new(session_id)
}
}
pub fn connect(&mut self, browser: &mut Option<FirefoxProcess>) -> WebDriverResult<()> {
- let timeout = 60 * 1000; // ms
- let poll_interval = 100; // ms
- let poll_attempts = timeout / poll_interval;
+ let timeout_sec = 60;
+ let timeout_ms = timeout_sec * 1000;
+ let poll_interval_ms = 100;
+ let poll_attempts = timeout_ms / poll_interval_ms;
let mut poll_attempt = 0;
+ debug!("Waiting {}s to connect to browser", timeout_sec);
loop {
// If the process is gone, immediately abort the connection attempts
if let &mut Some(ref mut runner) = browser {
let status = runner.status();
if status.is_err() || status.as_ref().map(|x| *x).unwrap_or(None) != None {
return Err(WebDriverError::new(
ErrorStatus::UnknownError,
format!("Process unexpectedly closed with status: {}", status
@@ -1371,17 +1373,17 @@ impl MarionetteConnection {
Ok(stream) => {
self.stream = Some(stream);
break
},
Err(e) => {
trace!(" connection attempt {}/{}", poll_attempt, poll_attempts);
if poll_attempt <= poll_attempts {
poll_attempt += 1;
- sleep(Duration::from_millis(poll_interval));
+ sleep(Duration::from_millis(poll_interval_ms));
} else {
return Err(WebDriverError::new(
ErrorStatus::UnknownError, e.description().to_owned()));
}
}
}
};