Bug 1444068 - Log the seconds geckodriver will wait to connect to the browser draft
authorGreg Fraley <gsfraley@gmail.com>
Sat, 10 Mar 2018 16:50:46 -0500
changeset 765902 3d691d5d1ed3ff3f05f4c17544067c9cad4b58d7
parent 765901 310045d2fdae1edc54c1891cd4b70cfb868285d8
push id102178
push userbmo:gsfraley@gmail.com
push dateSat, 10 Mar 2018 21:51:46 +0000
bugs1444068
milestone60.0a1
Bug 1444068 - Log the seconds geckodriver will wait to connect to the browser MozReview-Commit-ID: CQeqYgnHq0s
testing/geckodriver/src/marionette.rs
--- 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()));
                     }
                 }
             }
         };