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

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

Issue 10226008: Revert "unittest step 3 and 4: remove TestFramework.dart, make test.dart use" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 | « tests/isolate/src/TestFramework.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 4
5 String GetHtmlContents(String title, 5 String GetHtmlContents(String title,
6 String controllerScript, 6 String controllerScript,
7 String scriptType, 7 String scriptType,
8 String sourceScript) => 8 String sourceScript) =>
9 """ 9 """
10 <!DOCTYPE html> 10 <!DOCTYPE html>
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 </body> 50 </body>
51 </html> 51 </html>
52 """; 52 """;
53 53
54 String WrapDartTestInLibrary(String test) => 54 String WrapDartTestInLibrary(String test) =>
55 """ 55 """
56 #library('libraryWrapper'); 56 #library('libraryWrapper');
57 #source('$test'); 57 #source('$test');
58 """; 58 """;
59 59
60 String DartTestWrapper(String dartHome, String library) => 60 String DartTestWrapper(String domLibrary,
61 String testFramework,
62 String library) =>
61 """ 63 """
62 #library('test'); 64 #library('test');
63 65
64 #import('${dartHome}/lib/unittest/unittest.dart', prefix: 'unittest'); 66 #import('${domLibrary}');
65 #import('${dartHome}/lib/unittest/html_config.dart', prefix: 'config'); 67 #import('${testFramework}');
66 68
67 #import('${library}', prefix: "Test"); 69 #import('${library}', prefix: "Test");
68 70
71 waitForDone() {
72 window.postMessage('unittest-suite-wait-for-done', '*');
73 }
74
75 pass() {
76 document.body.innerHTML = 'PASS';
77 window.postMessage('unittest-suite-done', '*');
78 }
79
80 fail(e, trace) {
81 document.body.innerHTML = 'FAIL: \$e, \$trace';
82 window.postMessage('unittest-suite-done', '*');
83 }
84
69 main() { 85 main() {
70 config.useHtmlConfiguration(); 86 bool needsToWait = false;
87 bool mainIsFinished = false;
88 TestRunner.waitForDoneCallback = () { needsToWait = true; };
89 TestRunner.doneCallback = () {
90 if (mainIsFinished) {
91 pass();
92 } else {
93 needsToWait = false;
94 }
95 };
71 try { 96 try {
72 unittest.ensureInitialized();
73 Test.main(); 97 Test.main();
98 if (needsToWait) {
99 waitForDone();
100 } else {
101 pass();
102 }
103 mainIsFinished = true;
74 } catch(var e, var trace) { 104 } catch(var e, var trace) {
75 unittest.reportTestError(e.message, trace); 105 fail(e, trace);
76 } 106 }
77 } 107 }
78 """; 108 """;
OLDNEW
« no previous file with comments | « tests/isolate/src/TestFramework.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698