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

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

Issue 10153005: 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, 7 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 domLibrary, 60 String DartTestWrapper(String dartHome, String library) =>
61 String testFramework,
62 String library) =>
63 """ 61 """
64 #library('test'); 62 #library('test');
65 63
66 #import('${domLibrary}'); 64 #import('${dartHome}/lib/unittest/unittest.dart', prefix: 'unittest');
67 #import('${testFramework}'); 65 #import('${dartHome}/lib/unittest/html_config.dart', prefix: 'config');
68 66
69 #import('${library}', prefix: "Test"); 67 #import('${library}', prefix: "Test");
70 68
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
85 main() { 69 main() {
86 bool needsToWait = false; 70 config.useHtmlConfiguration();
87 bool mainIsFinished = false;
88 TestRunner.waitForDoneCallback = () { needsToWait = true; };
89 TestRunner.doneCallback = () {
90 if (mainIsFinished) {
91 pass();
92 } else {
93 needsToWait = false;
94 }
95 };
96 try { 71 try {
72 unittest.ensureInitialized();
97 Test.main(); 73 Test.main();
98 if (needsToWait) {
99 waitForDone();
100 } else {
101 pass();
102 }
103 mainIsFinished = true;
104 } catch(var e, var trace) { 74 } catch(var e, var trace) {
105 fail(e, trace); 75 unittest.reportTestError(e.message, trace);
106 } 76 }
107 } 77 }
108 """; 78 """;
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