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

Side by Side Diff: tools/testing/dart/browser_controller.dart

Issue 16848019: More debug info on the browser controller. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 752
753 Function testDoneCallBack; 753 Function testDoneCallBack;
754 Function nextTestCallBack; 754 Function nextTestCallBack;
755 755
756 BrowserTestingServer(this.local_ip, this.useIframe); 756 BrowserTestingServer(this.local_ip, this.useIframe);
757 757
758 Future start() { 758 Future start() {
759 return HttpServer.bind(local_ip, 0).then((createdServer) { 759 return HttpServer.bind(local_ip, 0).then((createdServer) {
760 httpServer = createdServer; 760 httpServer = createdServer;
761 void handler(HttpRequest request) { 761 void handler(HttpRequest request) {
762 DebugLogger.info("Handling request to: ${request.uri.path}");
762 if (request.uri.path.startsWith(reportPath)) { 763 if (request.uri.path.startsWith(reportPath)) {
763 var browserId = request.uri.path.substring(reportPath.length + 1); 764 var browserId = request.uri.path.substring(reportPath.length + 1);
764 var testId = int.parse(request.queryParameters["id"].split("=")[1]); 765 var testId = int.parse(request.queryParameters["id"].split("=")[1]);
765 766
766 handleReport(request, browserId, testId); 767 handleReport(request, browserId, testId);
767 // handleReport will asynchroniously fetch the data and will handle 768 // handleReport will asynchroniously fetch the data and will handle
768 // the closing of the streams. 769 // the closing of the streams.
769 return; 770 return;
770 } 771 }
771 var textResponse = ""; 772 var textResponse = "";
772 if (request.uri.path.startsWith(driverPath)) { 773 if (request.uri.path.startsWith(driverPath)) {
773 var browserId = request.uri.path.substring(driverPath.length + 1); 774 var browserId = request.uri.path.substring(driverPath.length + 1);
774 textResponse = getDriverPage(browserId); 775 textResponse = getDriverPage(browserId);
775 } else if (request.uri.path.startsWith(nextTestPath)) { 776 } else if (request.uri.path.startsWith(nextTestPath)) {
776 var browserId = request.uri.path.substring(nextTestPath.length + 1); 777 var browserId = request.uri.path.substring(nextTestPath.length + 1);
777 textResponse = getNextTest(browserId); 778 textResponse = getNextTest(browserId);
778 } else { 779 } else {
779 // We silently ignore other requests. 780 DebugLogger.info("Handling non standard request to: "
781 "${request.uri.path}");
780 } 782 }
781 request.response.write(textResponse); 783 request.response.write(textResponse);
782 request.listen((_) {}, onDone: request.response.close); 784 request.listen((_) {}, onDone: request.response.close);
783 request.response.done.catchError((error) { 785 request.response.done.then((_) {
786 DebugLogger.info("Done handling request to: ${request.uri.path}");
787 }).catchError((error) {
784 if (!underTermination) { 788 if (!underTermination) {
785 print("URI ${request.uri}"); 789 print("URI ${request.uri}");
786 print("Textresponse $textResponse"); 790 print("Textresponse $textResponse");
787 throw "Error returning content to browser: $error"; 791 throw "Error returning content to browser: $error";
788 } 792 }
789 }); 793 });
790 } 794 }
791 void errorHandler(e) { 795 void errorHandler(e) {
792 if (!underTermination) print("Error occured in httpserver: $e"); 796 if (!underTermination) print("Error occured in httpserver: $e");
793 }; 797 };
(...skipping 29 matching lines...) Expand all
823 } 827 }
824 828
825 void handleReport(HttpRequest request, String browserId, var testId) { 829 void handleReport(HttpRequest request, String browserId, var testId) {
826 StringBuffer buffer = new StringBuffer(); 830 StringBuffer buffer = new StringBuffer();
827 request.transform(new StringDecoder()).listen((data) { 831 request.transform(new StringDecoder()).listen((data) {
828 buffer.write(data); 832 buffer.write(data);
829 }, onDone: () { 833 }, onDone: () {
830 String back = buffer.toString(); 834 String back = buffer.toString();
831 request.response.close(); 835 request.response.close();
832 testDoneCallBack(browserId, back, testId); 836 testDoneCallBack(browserId, back, testId);
837 DebugLogger.info("Done handling request to: ${request.uri.path}");
833 }, onError: (error) { print(error); }); 838 }, onError: (error) { print(error); });
834 } 839 }
835 840
836 String getNextTest(String browserId) { 841 String getNextTest(String browserId) {
837 var nextTest = nextTestCallBack(browserId); 842 var nextTest = nextTestCallBack(browserId);
838 if (underTermination) { 843 if (underTermination) {
839 // Browsers will be killed shortly, send them a terminate signal so 844 // Browsers will be killed shortly, send them a terminate signal so
840 // that they stop pulling. 845 // that they stop pulling.
841 return terminateSignal; 846 return terminateSignal;
842 } else if (nextTest == null) { 847 } else if (nextTest == null) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 </head> 1007 </head>
1003 <body onload="startTesting()"> 1008 <body onload="startTesting()">
1004 Dart test driver, number of tests: <div id="number"></div> 1009 Dart test driver, number of tests: <div id="number"></div>
1005 <iframe id="embedded_iframe"></iframe> 1010 <iframe id="embedded_iframe"></iframe>
1006 </body> 1011 </body>
1007 </html> 1012 </html>
1008 """; 1013 """;
1009 return driverContent; 1014 return driverContent;
1010 } 1015 }
1011 } 1016 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698