Chromium Code Reviews| Index: tools/testing/dart/test_controller.js |
| diff --git a/tools/testing/dart/test_controller.js b/tools/testing/dart/test_controller.js |
| index dace747fe7fbb57812b55fdb1b55d969c15ab6e9..e952aaffa08f70b636f317474627ab34fe45a4ee 100644 |
| --- a/tools/testing/dart/test_controller.js |
| +++ b/tools/testing/dart/test_controller.js |
| @@ -109,16 +109,39 @@ var isContentShell = testRunner; |
| var waitForDone = false; |
| +var driverWindowCached = false; |
| +var driverWindow; |
| +var reportingDriverWindowError = false; |
| + |
| // Returns the driving window object if available |
| +// This function occasionally returns null instead of the |
| +// parent on Android content shell, so we cache the value |
| +// to get a consistent answer. |
| function getDriverWindow() { |
| if (window != window.parent) { |
| // We're running in an iframe. |
| - return window.parent; |
| + result = window.parent; |
| } else if (window.opener) { |
| // We were opened by another window. |
| - return window.opener; |
| + result = window.opener; |
| + } else { |
| + result = null; |
| + } |
| + if (driverWindowCached) { |
| + if (result != driverWindow) { |
| + recordEvent('debug', 'Driver windows changed: was null == ' + |
| + (driverWindow == null) + ', is null == ' + (result == null)); |
| + // notifyDone calls back into this function multiple times. Avoid loop. |
| + if (!reportingDriverWindowError) { |
|
ricow1
2014/08/14 15:24:10
I assume this is to get us to fail explicitly to d
|
| + reportingDriverWindowError = true; |
| + notifyDone('FAIL'); |
| + } |
| + } |
| + } else { |
| + driverWindowCached = true; |
| + driverWindow = result; |
| } |
| - return null; |
| + return driverWindow; |
| } |
| function usingBrowserController() { |