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

Unified Diff: test/codegen/expect/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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/codegen/expect/BenchmarkBase.js ('k') | test/codegen/expect/async_helper/async_helper.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/codegen/expect/async_helper.js
diff --git a/test/codegen/expect/async_helper.js b/test/codegen/expect/async_helper.js
new file mode 100644
index 0000000000000000000000000000000000000000..cb018a89fa0d76fc03d647207ce8c059b0d80458
--- /dev/null
+++ b/test/codegen/expect/async_helper.js
@@ -0,0 +1,76 @@
+dart_library.library('async_helper', null, /* Imports */[
+ 'dart_sdk'
+], function load__async_helper(exports, dart_sdk) {
+ 'use strict';
+ const core = dart_sdk.core;
+ const dart = dart_sdk.dart;
+ const dartx = dart_sdk.dartx;
+ const async_helper = Object.create(null);
+ let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.functionType(dart.dynamic, [])))();
+ let StringToException = () => (StringToException = dart.constFn(dart.definiteFunctionType(core.Exception, [core.String])))();
+ let _Action0Tovoid = () => (_Action0Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async_helper._Action0])))();
+ let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [])))();
+ let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic])))();
+ let FnTovoid = () => (FnTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [VoidTodynamic()])))();
+ async_helper._initialized = false;
+ async_helper._Action0 = dart.typedef('_Action0', () => dart.functionType(dart.void, []));
+ async_helper._onAsyncEnd = null;
+ async_helper._asyncLevel = 0;
+ async_helper._buildException = function(msg) {
+ return core.Exception.new(dart.str`Fatal: ${msg}. This is most likely a bug in your test.`);
+ };
+ dart.fn(async_helper._buildException, StringToException());
+ async_helper.asyncTestInitialize = function(callback) {
+ async_helper._asyncLevel = 0;
+ async_helper._initialized = false;
+ async_helper._onAsyncEnd = callback;
+ };
+ dart.fn(async_helper.asyncTestInitialize, _Action0Tovoid());
+ dart.copyProperties(async_helper, {
+ get asyncTestStarted() {
+ return async_helper._initialized;
+ }
+ });
+ async_helper.asyncStart = function() {
+ if (dart.test(async_helper._initialized) && async_helper._asyncLevel == 0) {
+ dart.throw(async_helper._buildException('asyncStart() was called even though we are done ' + 'with testing.'));
+ }
+ if (!dart.test(async_helper._initialized)) {
+ if (async_helper._onAsyncEnd == null) {
+ dart.throw(async_helper._buildException('asyncStart() was called before asyncTestInitialize()'));
+ }
+ core.print('unittest-suite-wait-for-done');
+ async_helper._initialized = true;
+ }
+ async_helper._asyncLevel = dart.notNull(async_helper._asyncLevel) + 1;
+ };
+ dart.fn(async_helper.asyncStart, VoidTovoid());
+ async_helper.asyncEnd = function() {
+ if (dart.notNull(async_helper._asyncLevel) <= 0) {
+ if (!dart.test(async_helper._initialized)) {
+ dart.throw(async_helper._buildException('asyncEnd() was called before asyncStart().'));
+ } else {
+ dart.throw(async_helper._buildException('asyncEnd() was called more often than ' + 'asyncStart().'));
+ }
+ }
+ async_helper._asyncLevel = dart.notNull(async_helper._asyncLevel) - 1;
+ if (async_helper._asyncLevel == 0) {
+ let callback = async_helper._onAsyncEnd;
+ async_helper._onAsyncEnd = null;
+ callback();
+ core.print('unittest-suite-success');
+ }
+ };
+ dart.fn(async_helper.asyncEnd, VoidTovoid());
+ async_helper.asyncSuccess = function(_) {
+ return async_helper.asyncEnd();
+ };
+ dart.fn(async_helper.asyncSuccess, dynamicTovoid());
+ async_helper.asyncTest = function(f) {
+ async_helper.asyncStart();
+ dart.dsend(f(), 'then', async_helper.asyncSuccess);
+ };
+ dart.fn(async_helper.asyncTest, FnTovoid());
+ // Exports:
+ exports.async_helper = async_helper;
+});
« no previous file with comments | « test/codegen/expect/BenchmarkBase.js ('k') | test/codegen/expect/async_helper/async_helper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698