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

Side by Side Diff: test/codegen/expect/async_helper/async_helper.js

Issue 2128353002: Check in codegen test expectations. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 5 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 | « test/codegen/expect/async_helper.js ('k') | test/codegen/expect/closure.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 dart_library.library('async_helper', null, /* Imports */[
2 'dart_sdk'
3 ], function load__async_helper(exports, dart_sdk) {
4 'use strict';
5 const core = dart_sdk.core;
6 const dart = dart_sdk.dart;
7 const dartx = dart_sdk.dartx;
8 const async_helper = Object.create(null);
9 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.functionType(dart .dynamic, [])))();
10 let StringToException = () => (StringToException = dart.constFn(dart.definiteF unctionType(core.Exception, [core.String])))();
11 let _Action0Tovoid = () => (_Action0Tovoid = dart.constFn(dart.definiteFunctio nType(dart.void, [async_helper._Action0])))();
12 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(da rt.void, [])))();
13 let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.definiteFunctionT ype(dart.void, [dart.dynamic])))();
14 let FnTovoid = () => (FnTovoid = dart.constFn(dart.definiteFunctionType(dart.v oid, [VoidTodynamic()])))();
15 async_helper._initialized = false;
16 async_helper._Action0 = dart.typedef('_Action0', () => dart.functionType(dart. void, []));
17 async_helper._onAsyncEnd = null;
18 async_helper._asyncLevel = 0;
19 async_helper._buildException = function(msg) {
20 return core.Exception.new(dart.str`Fatal: ${msg}. This is most likely a bug in your test.`);
21 };
22 dart.fn(async_helper._buildException, StringToException());
23 async_helper.asyncTestInitialize = function(callback) {
24 async_helper._asyncLevel = 0;
25 async_helper._initialized = false;
26 async_helper._onAsyncEnd = callback;
27 };
28 dart.fn(async_helper.asyncTestInitialize, _Action0Tovoid());
29 dart.copyProperties(async_helper, {
30 get asyncTestStarted() {
31 return async_helper._initialized;
32 }
33 });
34 async_helper.asyncStart = function() {
35 if (dart.test(async_helper._initialized) && async_helper._asyncLevel == 0) {
36 dart.throw(async_helper._buildException('asyncStart() was called even thou gh we are done ' + 'with testing.'));
37 }
38 if (!dart.test(async_helper._initialized)) {
39 if (async_helper._onAsyncEnd == null) {
40 dart.throw(async_helper._buildException('asyncStart() was called before asyncTestInitialize()'));
41 }
42 core.print('unittest-suite-wait-for-done');
43 async_helper._initialized = true;
44 }
45 async_helper._asyncLevel = dart.notNull(async_helper._asyncLevel) + 1;
46 };
47 dart.fn(async_helper.asyncStart, VoidTovoid());
48 async_helper.asyncEnd = function() {
49 if (dart.notNull(async_helper._asyncLevel) <= 0) {
50 if (!dart.test(async_helper._initialized)) {
51 dart.throw(async_helper._buildException('asyncEnd() was called before as yncStart().'));
52 } else {
53 dart.throw(async_helper._buildException('asyncEnd() was called more ofte n than ' + 'asyncStart().'));
54 }
55 }
56 async_helper._asyncLevel = dart.notNull(async_helper._asyncLevel) - 1;
57 if (async_helper._asyncLevel == 0) {
58 let callback = async_helper._onAsyncEnd;
59 async_helper._onAsyncEnd = null;
60 callback();
61 core.print('unittest-suite-success');
62 }
63 };
64 dart.fn(async_helper.asyncEnd, VoidTovoid());
65 async_helper.asyncSuccess = function(_) {
66 return async_helper.asyncEnd();
67 };
68 dart.fn(async_helper.asyncSuccess, dynamicTovoid());
69 async_helper.asyncTest = function(f) {
70 async_helper.asyncStart();
71 dart.dsend(f(), 'then', async_helper.asyncSuccess);
72 };
73 dart.fn(async_helper.asyncTest, FnTovoid());
74 // Exports:
75 exports.async_helper = async_helper;
76 });
OLDNEW
« no previous file with comments | « test/codegen/expect/async_helper.js ('k') | test/codegen/expect/closure.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698