Index: pkg/unittest/test_controller.js |
diff --git a/pkg/unittest/test_controller.js b/pkg/unittest/test_controller.js |
index 85e2b94338576ee93c8be22cd5d55da3606f1955..ce7a8f0d469ee10bf7536939d94ac0f251a8dd78 100644 |
--- a/pkg/unittest/test_controller.js |
+++ b/pkg/unittest/test_controller.js |
@@ -11,12 +11,14 @@ if (navigator.webkitStartDart) { |
navigator.webkitStartDart(); |
} |
+var testRunner = window.testRunner || window.layoutTestController; |
+ |
function processMessage(msg) { |
- if (window.layoutTestController) { |
+ if (testRunner) { |
if (msg == 'unittest-suite-done') { |
- window.layoutTestController.notifyDone(); |
+ testRunner.notifyDone(); |
} else if (msg == 'unittest-suite-wait-for-done') { |
- window.layoutTestController.startedDartTest = true; |
+ testRunner.startedDartTest = true; |
} |
} |
} |
@@ -25,9 +27,9 @@ function onReceive(e) { |
processMessage(e.data); |
} |
-if (window.layoutTestController) { |
- window.layoutTestController.dumpAsText(); |
- window.layoutTestController.waitUntilDone(); |
+if (testRunner) { |
+ testRunner.dumpAsText(); |
+ testRunner.waitUntilDone(); |
} |
window.addEventListener("message", onReceive, false); |
@@ -37,8 +39,8 @@ function showErrorAndExit(message) { |
element.innerHTML = message; |
document.body.appendChild(element); |
} |
- if (window.layoutTestController) { |
- window.layoutTestController.notifyDone(); |
+ if (testRunner) { |
+ testRunner.notifyDone(); |
} |
} |
@@ -67,8 +69,8 @@ document.onreadystatechange = function() { |
// Just sleep another time to give the browser the time to process the |
// posted message. |
setTimeout(function() { |
- if (layoutTestController && !layoutTestController.startedDartTest) { |
- layoutTestController.notifyDone(); |
+ if (testRunner && !testRunner.startedDartTest) { |
+ testRunner.notifyDone(); |
} |
}, 0); |
}, 50); |