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

Side by Side Diff: pkg/dev_compiler/tool/run.js

Issue 2768233002: Add better support for async tests in run.js (Closed)
Patch Set: Created 3 years, 9 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
« 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 /// This is a utility to run and debug an individual DDC compiled test. 5 /// This is a utility to run and debug an individual DDC compiled test.
6 /// Tests can be run with either node or devtool (a Chrome-based utility with 6 /// Tests can be run with either node or devtool (a Chrome-based utility with
7 /// DOM APIs and developer tools support). 7 /// DOM APIs and developer tools support).
8 /// 8 ///
9 /// Install devtool via: 9 /// Install devtool via:
10 /// > npm install -g devtool 10 /// > npm install -g devtool
(...skipping 25 matching lines...) Expand all
36 path: ddcdir + 'gen/codegen_output/pkg/path', 36 path: ddcdir + 'gen/codegen_output/pkg/path',
37 stack_trace: ddcdir + 'gen/codegen_output/pkg/stack_trace', 37 stack_trace: ddcdir + 'gen/codegen_output/pkg/stack_trace',
38 unittest: ddcdir + 'gen/codegen_output/pkg/unittest', 38 unittest: ddcdir + 'gen/codegen_output/pkg/unittest',
39 } 39 }
40 }); 40 });
41 41
42 // TODO(vsm): Factor out test framework code in test/browser/language_tests.js 42 // TODO(vsm): Factor out test framework code in test/browser/language_tests.js
43 // and use here. Async tests and unittests won't work without it. 43 // and use here. Async tests and unittests won't work without it.
44 var sdk = requirejs('dart_sdk'); 44 var sdk = requirejs('dart_sdk');
45 sdk.dart.ignoreWhitelistedErrors(false); 45 sdk.dart.ignoreWhitelistedErrors(false);
46
47 function finish(e) {
48 if (e) {
49 console.log('Test ' + test + ' failed:\n' + e.toString());
50 sdk.dart.stackPrint(e);
51 } else {
52 console.log('Test ' + test + ' passed.');
53 }
54 }
55
56 var async_helper = requirejs('async_helper').async_helper;
57 async_helper.asyncTestInitialize(finish);
58
46 var module = requirejs(test); 59 var module = requirejs(test);
47 var lib = test.split('/').slice(-1)[0]; 60 var lib = test.split('/').slice(-1)[0];
48 try { 61 try {
49 sdk._isolate_helper.startRootIsolate(module[lib].main, []); 62 var result = sdk._isolate_helper.startRootIsolate(module[lib].main, []);
50 console.log('Test ' + test + ' passed.'); 63 // async_helper tests call finish directly - call here for all other
64 // tests.
65 if (!async_helper.asyncTestStarted) {
66 if (!result || !(result instanceof dart_sdk.async.Future)) {
67 finish();
68 } else {
69 // Wait iff result is a future
70 result.then(dart_sdk.dart.dynamic)(() => finish());
71 }
72 }
51 } catch (e) { 73 } catch (e) {
52 console.log('Test ' + test + ' failed:\n' + e.toString()); 74 finish(e);
53 sdk.dart.stackPrint(e);
54 } 75 }
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