Chromium Code Reviews| Index: tools/testing/dart/browser_controller.dart |
| =================================================================== |
| --- tools/testing/dart/browser_controller.dart (revision 22979) |
| +++ tools/testing/dart/browser_controller.dart (working copy) |
| @@ -103,7 +103,7 @@ |
| _logEvent("calling kill function"); |
| - if (killFunction()) { |
| + if (process != null && killFunction()) { |
| // We successfully sent the signal. |
| _logEvent("killing signal sent"); |
| } else { |
| @@ -140,8 +140,7 @@ |
| }, onError: (error) { |
| // This should _never_ happen, but we really want this in the log |
| // if it actually does due to dart:io or vm bug. |
| - _usageLog.add( |
| - "An error occured in the process stdout handling: $error"); |
| + _logEvent("An error occured in the process stdout handling: $error"); |
| }); |
| process.stderr.transform(new StringDecoder()).listen((data) { |
| @@ -149,8 +148,7 @@ |
| }, onError: (error) { |
| // This should _never_ happen, but we really want this in the log |
| // if it actually does due to dart:io or vm bug. |
| - _usageLog.add( |
| - "An error occured in the process stderr handling: $error"); |
| + _logEvent("An error occured in the process stderr handling: $error"); |
| }); |
| process.exitCode.then((exitCode) { |
| @@ -493,8 +491,9 @@ |
| return new Chrome(); |
| } else if (browserName == "ff") { |
| return new Firefox(); |
| + } else { |
| + throw "Non supported browser for browser controller"; |
| } |
| - throw "Non supported browser for browser controller"; |
| } |
| } |
| @@ -614,6 +613,9 @@ |
| var current_id; |
| var testing_window; |
| var last_reported_id; |
| + // We use this to determine if we did actually get back a start event |
| + // from the test we just loaded. |
| + var did_start = false; |
|
kustermann
2013/05/22 17:08:50
I think you're on an old revision. Could you rebas
ricow1
2013/05/22 17:36:12
did not know that landed, done
|
| function newTaskHandler() { |
| if (this.readyState == this.DONE) { |
| @@ -630,6 +632,7 @@ |
| var split = this.responseText.split('#'); |
| var nextTask = split[0]; |
| current_id = split[1]; |
| + did_start = false; |
| run(nextTask); |
| } |
| } else { |
| @@ -656,17 +659,26 @@ |
| } |
| function reportMessage(msg) { |
| + if (msg == 'STARTING') { |
| + did_start = true; |
| + return; |
| + } |
| var client = new XMLHttpRequest(); |
| function handleReady() { |
| if (this.readyState == this.DONE) { |
| - if (current_id != last_reported_id) { |
| + if (last_reported_id != current_id && did_start) { |
| getNextTask(); |
| last_reported_id = current_id; |
| } |
| } |
| } |
| client.onreadystatechange = handleReady; |
| - client.open('POST', '$reportPath/${browserId}?id=' + current_id); |
| + // If did_start is false it means that we did actually set the url on |
| + // the testing_window, but this is a report left in the event loop or |
| + // a callback because the page did not load yet. |
| + // In both cases this is a double report from the last test. |
| + var posting_id = did_start ? current_id : last_reported_id; |
| + client.open('POST', '$reportPath/${browserId}?id=' + posting_id); |
| client.setRequestHeader('Content-type', |
| 'application/x-www-form-urlencoded'); |
| client.send(msg); |