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

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

Issue 8889016: Enable Dartium tests in tools/test.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 String GetHtmlContents(String title,
6 String controllerScript,
7 String scriptType,
8 String sourceScript) => """
Mads Ager (google) 2011/12/09 09:21:12 Nit: I think I would put the """ on a new line by
9 <html>
10 <head>
11 <title> Test $title </title>
12 <style>
13 .unittest-table { font-family:monospace; border:1px; }
14 .unittest-pass { background: #6b3;}
15 .unittest-fail { background: #d55;}
16 .unittest-error { background: #a11;}
17 </style>
18 </head>
19 <body>
20 <h1> Running $title </h1>
21 <script type="text/javascript" src="../../../$controllerScript"></script>
22 <script type="$scriptType" src="../../../$sourceScript"></script>
23 <script type="text/javascript">
24 // If nobody intercepts the error, finish the test.
25 onerror = function() { window.layoutTestController.notifyDone() };
26
27 document.onreadystatechange = function() {
28 if (document.readyState != "loaded") return;
29 // If 'startedDartTest' is not set, that means that the test did not have
30 // a chance to load. This will happen when a load error occurs in the VM.
31 // Give the machine time to start up.
32 setTimeout(function() {
33 // A window.postMessage might have been enqueued after this timeout.
34 // Just sleep another time to give the browser the time to process the
35 // posted message.
36 setTimeout(function() {
37 if (layoutTestController && !layoutTestController.startedDartTest) {
38 layoutTestController.notifyDone();
39 }
40 }, 0);
41 }, 50);
42 };
43 </script>
44 </body>
45 </html>
46 """;
47
48 String WrapDartTestInLibrary(String test) => """
Mads Ager (google) 2011/12/09 09:21:12 Ditto.
49 #library('libraryWrapper');
50 #source('$test');
51 """;
52
53 String DartTestWrapper(String unittest_ignored,
54 String test_ignored,
55 String domLibrary,
56 String testFramework,
57 String library) => """
Mads Ager (google) 2011/12/09 09:21:12 And here. I'll shut up now. ;-)
Bill Hesse 2011/12/09 12:33:29 Done.
58 #library('test');
59
60 #import('${domLibrary}');
61 #import('${testFramework}');
62
63 #import('${library}', prefix: "Test");
64
65 waitForDone() {
66 window.postMessage('unittest-suite-wait-for-done', '*');
67 }
68
69 pass() {
70 document.body.innerHTML = 'PASS';
71 window.postMessage('unittest-suite-done', '*');
72 }
73
74 fail(e, trace) {
75 document.body.innerHTML = 'FAIL: \$e, \$trace';
76 window.postMessage('unittest-suite-done', '*');
77 }
78
79 main() {
80 bool needsToWait = false;
81 bool mainIsFinished = false;
82 TestRunner.waitForDoneCallback = () { needsToWait = true; };
83 TestRunner.doneCallback = () {
84 if (mainIsFinished) {
85 pass();
86 } else {
87 needsToWait = false;
88 }
89 };
90 try {
91 Test.main();
92 if (needsToWait) {
93 waitForDone();
94 } else {
95 pass();
96 }
97 mainIsFinished = true;
98 } catch(var e, var trace) {
99 fail(e, trace);
100 }
101 }
102 """;
OLDNEW
« no previous file with comments | « no previous file | tools/testing/dart/test_options.dart » ('j') | tools/testing/dart/test_runner.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698