Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: tools/testing/architecture.py

Issue 8430005: Tell the testing-framework that we started the tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rename and other fixes. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/testing/unittest/unittest.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/architecture.py
diff --git a/tools/testing/architecture.py b/tools/testing/architecture.py
index 0ea525f82447765f807a364fceb5c5ef9e758d6a..07f96ab89e784092e891f625a604ea727b975685 100755
--- a/tools/testing/architecture.py
+++ b/tools/testing/architecture.py
@@ -41,15 +41,22 @@ HTML_CONTENTS = """
<script type="text/javascript" src="%(controller_script)s"></script>
<script type="%(script_type)s" src="%(source_script)s"></script>
<script type="text/javascript">
+ window.onerror = function() { window.layoutTestController.notifyDone() };
+
// If 'startedDartTest' is not set, that means that the test did not have
// a chance to load. This will happen when a load error occurs in the VM.
// Give the machine time to start up.
setTimeout(function() {
- if (window.layoutTestController
- && !window.layoutTestController.startedDartTest) {
- window.layoutTestController.notifyDone();
- }
- }, 3000);
+ // A window.postMessage might have been enqueued after this timeout.
+ // Just sleep another time to give the browser the time to process the
+ // posted message.
+ setTimeout(function() {
+ if (window.layoutTestController
+ && !window.layoutTestController.startedDartTest) {
+ window.layoutTestController.notifyDone();
+ }
+ }, 0);
+ }, 0);
</script>
</body>
</html>
@@ -68,6 +75,10 @@ DART_CONTENTS = """
#import('%(library)s', prefix: "Test");
+wait() {
ngeoffray 2011/10/31 16:55:54 waitForDone?
floitsch 2011/10/31 16:59:48 Done.
+ window.postMessage('unittest-suite-wait-for-done', '*');
+}
+
pass() {
document.body.innerHTML = 'PASS';
window.postMessage('unittest-suite-done', '*');
@@ -78,11 +89,6 @@ fail(e, trace) {
window.postMessage('unittest-suite-done', '*');
}
-// All tests are registered as async tests on the UnitTestSuite.
-// If the test uses the [:TestRunner:] we will a callback to wait for the
-// done callback.
-// Otherwise we will call [:testSuite.done():] immediately after the test
-// finished.
main() {
bool needsToWait = false;
bool mainIsFinished = false;
@@ -96,7 +102,11 @@ main() {
};
try {
Test.main();
- if (!needsToWait) pass();
+ if (needsToWait) {
+ wait();
+ } else {
+ pass();
+ }
mainIsFinished = true;
} catch(var e, var trace) {
fail(e, trace);
« no previous file with comments | « client/testing/unittest/unittest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698