Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 library browser; | 4 library browser; |
| 5 | 5 |
| 6 import "dart:async"; | 6 import "dart:async"; |
| 7 import "dart:core"; | 7 import "dart:core"; |
| 8 import "dart:io"; | 8 import "dart:io"; |
| 9 | 9 |
| 10 import 'android.dart'; | 10 import 'android.dart'; |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 } | 559 } |
| 560 browsersCompleter.complete(browsers); | 560 browsersCompleter.complete(browsers); |
| 561 } | 561 } |
| 562 return browsersCompleter.future; | 562 return browsersCompleter.future; |
| 563 } | 563 } |
| 564 | 564 |
| 565 var timedOut = []; | 565 var timedOut = []; |
| 566 | 566 |
| 567 void handleResults(String browserId, String output, int testId) { | 567 void handleResults(String browserId, String output, int testId) { |
| 568 var status = browserStatus[browserId]; | 568 var status = browserStatus[browserId]; |
| 569 DebugLogger.info("Handling result for browser ${browserId}"); | 569 DebugLogger.info("${new DateTime.now()}: Handling result for " |
|
kustermann
2013/06/13 07:42:36
You should've put this 'new DateTime.now()' into o
| |
| 570 "browser ${browserId}"); | |
| 570 if (testCache.containsKey(testId)) { | 571 if (testCache.containsKey(testId)) { |
| 571 doubleReportingTests.add(testId); | 572 doubleReportingTests.add(testId); |
| 572 return; | 573 return; |
| 573 } | 574 } |
| 574 | 575 |
| 575 if (status.timeout) { | 576 if (status.timeout) { |
| 576 // We don't do anything, this browser is currently being killed and | 577 // We don't do anything, this browser is currently being killed and |
| 577 // replaced. | 578 // replaced. |
| 578 } else if (status.currentTest != null) { | 579 } else if (status.currentTest != null) { |
| 579 status.currentTest.timeoutTimer.cancel(); | 580 status.currentTest.timeoutTimer.cancel(); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 595 print(output); | 596 print(output); |
| 596 terminate().then((_) { | 597 terminate().then((_) { |
| 597 exit(1); | 598 exit(1); |
| 598 }); | 599 }); |
| 599 } | 600 } |
| 600 } | 601 } |
| 601 | 602 |
| 602 void handleTimeout(BrowserTestingStatus status) { | 603 void handleTimeout(BrowserTestingStatus status) { |
| 603 // We simply kill the browser and starts up a new one! | 604 // We simply kill the browser and starts up a new one! |
| 604 // We could be smarter here, but it does not seems like it is worth it. | 605 // We could be smarter here, but it does not seems like it is worth it. |
| 605 DebugLogger.info("Handling timeout for browser ${status.browser.id}"); | 606 DebugLogger.info("${new DateTime.now()}: Handling timeout for " |
| 607 "browser ${status.browser.id}"); | |
| 606 status.timeout = true; | 608 status.timeout = true; |
| 607 timedOut.add(status.currentTest.url); | 609 timedOut.add(status.currentTest.url); |
| 608 var id = status.browser.id; | 610 var id = status.browser.id; |
| 609 status.browser.close().then((closed) { | 611 status.browser.close().then((closed) { |
| 610 if (!closed) { | 612 if (!closed) { |
| 611 // Very bad, we could not kill the browser. | 613 // Very bad, we could not kill the browser. |
| 612 print("could not kill browser $id"); | 614 print("could not kill browser $id"); |
| 613 return; | 615 return; |
| 614 } | 616 } |
| 615 // We don't want to start a new browser if we are terminating. | 617 // We don't want to start a new browser if we are terminating. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 648 }); | 650 }); |
| 649 | 651 |
| 650 status.currentTest.doneCallback("TIMEOUT"); | 652 status.currentTest.doneCallback("TIMEOUT"); |
| 651 status.currentTest = null; | 653 status.currentTest = null; |
| 652 } | 654 } |
| 653 | 655 |
| 654 BrowserTest getNextTest(String browserId) { | 656 BrowserTest getNextTest(String browserId) { |
| 655 if (testQueue.isEmpty) return null; | 657 if (testQueue.isEmpty) return null; |
| 656 var status = browserStatus[browserId]; | 658 var status = browserStatus[browserId]; |
| 657 if (status == null) return null; | 659 if (status == null) return null; |
| 658 DebugLogger.info("Handling getNext for browser ${browserId}" | 660 DebugLogger.info("${new DateTime.now()}: Handling getNext for browser " |
| 659 " timeout status: ${status.timeout}"); | 661 "${browserId} timeout status: ${status.timeout}"); |
| 660 | 662 |
| 661 // We are currently terminating this browser, don't start a new test. | 663 // We are currently terminating this browser, don't start a new test. |
| 662 if (status.timeout) return null; | 664 if (status.timeout) return null; |
| 663 BrowserTest test = testQueue.removeLast(); | 665 BrowserTest test = testQueue.removeLast(); |
| 664 if (status.currentTest == null) { | 666 if (status.currentTest == null) { |
| 665 status.currentTest = test; | 667 status.currentTest = test; |
| 666 } else { | 668 } else { |
| 667 // TODO(ricow): Handle this better. | 669 // TODO(ricow): Handle this better. |
| 668 print("This is bad, should never happen, getNextTest all full"); | 670 print("This is bad, should never happen, getNextTest all full"); |
| 669 print("This happened for browser $browserId"); | 671 print("This happened for browser $browserId"); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 933 </head> | 935 </head> |
| 934 <body onload="startTesting()"> | 936 <body onload="startTesting()"> |
| 935 Dart test driver, number of tests: <div id="number"></div> | 937 Dart test driver, number of tests: <div id="number"></div> |
| 936 <iframe id="embedded_iframe"></iframe> | 938 <iframe id="embedded_iframe"></iframe> |
| 937 </body> | 939 </body> |
| 938 </html> | 940 </html> |
| 939 """; | 941 """; |
| 940 return driverContent; | 942 return driverContent; |
| 941 } | 943 } |
| 942 } | 944 } |
| OLD | NEW |