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

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

Issue 2792703002: Fix ddc async test code (Closed)
Patch Set: Created 3 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
« no previous file with comments | « pkg/dev_compiler/test/browser/language_tests.js ('k') | 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 function finish(e) { 47 function finish(e) {
48 if (e) { 48 if (e) {
49 console.log('Test ' + test + ' failed:\n' + e.toString()); 49 console.log('Test ' + test + ' failed:\n' + e.toString());
50 sdk.dart.stackPrint(e); 50 sdk.dart.stackPrint(e);
51 } else { 51 } else {
52 console.log('Test ' + test + ' passed.'); 52 console.log('Test ' + test + ' passed.');
53 } 53 }
54 } 54 }
55 55
56 var async_helper = requirejs('async_helper').async_helper; 56 var async_helper = requirejs('async_helper').async_helper;
57 sdk._isolate_helper.startRootIsolate(() => {}, []);
57 async_helper.asyncTestInitialize(finish); 58 async_helper.asyncTestInitialize(finish);
58 59
59 var module = requirejs(test); 60 var module = requirejs(test);
60 var lib = test.split('/').slice(-1)[0]; 61 var lib = test.split('/').slice(-1)[0];
61 try { 62 try {
62 var result = sdk._isolate_helper.startRootIsolate(module[lib].main, []); 63 var result = module[lib].main();
63 // async_helper tests call finish directly - call here for all other 64 // async_helper tests call finish directly - call here for all other
64 // tests. 65 // tests.
65 if (!async_helper.asyncTestStarted) { 66 if (!async_helper.asyncTestStarted) {
66 if (!result || !(result instanceof dart_sdk.async.Future)) { 67 if (!result || !(sdk.async.Future.is(result))) {
67 finish(); 68 finish();
68 } else { 69 } else {
69 // Wait iff result is a future 70 // Wait iff result is a future
70 result.then(dart_sdk.dart.dynamic)(() => finish()); 71 result.then(sdk.dart.dynamic)(() => finish(), { onError: (e) => finish(e) });
71 } 72 }
72 } 73 }
73 } catch (e) { 74 } catch (e) {
74 finish(e); 75 finish(e);
75 } 76 }
OLDNEW
« no previous file with comments | « pkg/dev_compiler/test/browser/language_tests.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698