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

Side by Side Diff: test/codegen/expect/lib/html/async_test.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
OLDNEW
(Empty)
1 dart_library.library('lib/html/async_test', null, /* Imports */[
2 'dart_sdk',
3 'unittest'
4 ], function load__async_test(exports, dart_sdk, unittest) {
5 'use strict';
6 const core = dart_sdk.core;
7 const isolate = dart_sdk.isolate;
8 const _interceptors = dart_sdk._interceptors;
9 const async = dart_sdk.async;
10 const dart = dart_sdk.dart;
11 const dartx = dart_sdk.dartx;
12 const html_config = unittest.html_config;
13 const unittest$ = unittest.unittest;
14 const src__matcher__expect = unittest.src__matcher__expect;
15 const src__matcher__future_matchers = unittest.src__matcher__future_matchers;
16 const src__matcher__core_matchers = unittest.src__matcher__core_matchers;
17 const async_test = Object.create(null);
18 const async_oneshot = Object.create(null);
19 const async_periodictimer = Object.create(null);
20 const async_cancellingisolate = Object.create(null);
21 let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSAr ray$(core.String)))();
22 let JSArrayOfObject = () => (JSArrayOfObject = dart.constFn(_interceptors.JSAr ray$(core.Object)))();
23 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun ctionType(dart.dynamic, [dart.dynamic])))();
24 let IsolateToFuture = () => (IsolateToFuture = dart.constFn(dart.definiteFunct ionType(async.Future, [isolate.Isolate])))();
25 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT ype(dart.dynamic, [])))();
26 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(da rt.void, [])))();
27 let dynamicAnddynamicTodynamic = () => (dynamicAnddynamicTodynamic = dart.cons tFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))();
28 let TimerTovoid = () => (TimerTovoid = dart.constFn(dart.definiteFunctionType( dart.void, [async.Timer])))();
29 async_test.oneshot = function(message) {
30 return async_oneshot.main(dart.dload(message, 'first'), dart.dload(message, 'last'));
31 };
32 dart.fn(async_test.oneshot, dynamicTodynamic());
33 async_test.periodicTimerIsolate = function(message) {
34 return async_periodictimer.main(dart.dload(message, 'first'), dart.dload(mes sage, 'last'));
35 };
36 dart.fn(async_test.periodicTimerIsolate, dynamicTodynamic());
37 async_test.cancellingIsolate = function(message) {
38 return async_cancellingisolate.main(dart.dload(message, 'first'), dart.dload (message, 'last'));
39 };
40 dart.fn(async_test.cancellingIsolate, dynamicTodynamic());
41 async_test.main = function() {
42 html_config.useHtmlConfiguration();
43 unittest$.test('one shot timer in pure isolate', dart.fn(() => {
44 let response = isolate.ReceivePort.new();
45 let remote = isolate.Isolate.spawn(async_test.oneshot, JSArrayOfObject().o f([JSArrayOfString().of(['START']), response.sendPort]));
46 src__matcher__expect.expect(remote.then(async.Future)(dart.fn(_ => respons e.first, IsolateToFuture())), src__matcher__future_matchers.completion('DONE'));
47 }, VoidTodynamic()));
48 unittest$.test('periodic timer in pure isolate', dart.fn(() => {
49 let response = isolate.ReceivePort.new();
50 let remote = isolate.Isolate.spawn(async_test.periodicTimerIsolate, JSArra yOfObject().of([JSArrayOfString().of(['START']), response.sendPort]));
51 src__matcher__expect.expect(remote.then(async.Future)(dart.fn(_ => respons e.first, IsolateToFuture())), src__matcher__future_matchers.completion('DONE'));
52 }, VoidTodynamic()));
53 unittest$.test('cancellation in pure isolate', dart.fn(() => {
54 let response = isolate.ReceivePort.new();
55 let remote = isolate.Isolate.spawn(async_test.cancellingIsolate, JSArrayOf Object().of([JSArrayOfString().of(['START']), response.sendPort]));
56 src__matcher__expect.expect(remote.then(async.Future)(dart.fn(_ => respons e.first, IsolateToFuture())), src__matcher__future_matchers.completion('DONE'));
57 }, VoidTodynamic()));
58 };
59 dart.fn(async_test.main, VoidTodynamic());
60 let const$;
61 async_oneshot.main = function(message, replyTo) {
62 let command = dart.dload(message, 'first');
63 src__matcher__expect.expect(command, 'START');
64 async.Timer.new(const$ || (const$ = dart.const(new core.Duration({millisecon ds: 10}))), dart.fn(() => {
65 dart.dsend(replyTo, 'send', 'DONE');
66 }, VoidTovoid()));
67 };
68 dart.fn(async_oneshot.main, dynamicAnddynamicTodynamic());
69 let const$0;
70 let const$1;
71 async_periodictimer.main = function(message, replyTo) {
72 let command = dart.dload(message, 'first');
73 src__matcher__expect.expect(command, 'START');
74 let counter = 0;
75 async.Timer.periodic(const$0 || (const$0 = dart.const(new core.Duration({mil liseconds: 10}))), dart.fn(timer => {
76 if (counter == 3) {
77 counter = 1024;
78 timer.cancel();
79 async.Timer.new(const$1 || (const$1 = dart.const(new core.Duration({mill iseconds: 30}))), dart.fn(() => {
80 dart.dsend(replyTo, 'send', 'DONE');
81 }, VoidTovoid()));
82 return;
83 }
84 dart.assert(counter < 3);
85 counter++;
86 }, TimerTovoid()));
87 };
88 dart.fn(async_periodictimer.main, dynamicAnddynamicTodynamic());
89 let const$2;
90 let const$3;
91 let const$4;
92 async_cancellingisolate.main = function(message, replyTo) {
93 let command = dart.dload(message, 'first');
94 src__matcher__expect.expect(command, 'START');
95 let shot = false;
96 let oneshot = null;
97 let periodic = null;
98 periodic = async.Timer.periodic(const$2 || (const$2 = dart.const(new core.Du ration({milliseconds: 10}))), dart.fn(timer => {
99 src__matcher__expect.expect(shot, src__matcher__core_matchers.isFalse);
100 shot = true;
101 src__matcher__expect.expect(timer, src__matcher__core_matchers.same(period ic));
102 dart.dsend(periodic, 'cancel');
103 dart.dsend(oneshot, 'cancel');
104 async.Timer.new(const$3 || (const$3 = dart.const(new core.Duration({millis econds: 50}))), dart.fn(() => {
105 dart.dsend(replyTo, 'send', 'DONE');
106 }, VoidTovoid()));
107 }, TimerTovoid()));
108 oneshot = async.Timer.new(const$4 || (const$4 = dart.const(new core.Duration ({milliseconds: 30}))), dart.fn(() => {
109 src__matcher__expect.fail('Should never be invoked');
110 }, VoidTovoid()));
111 };
112 dart.fn(async_cancellingisolate.main, dynamicAnddynamicTodynamic());
113 // Exports:
114 exports.async_test = async_test;
115 exports.async_oneshot = async_oneshot;
116 exports.async_periodictimer = async_periodictimer;
117 exports.async_cancellingisolate = async_cancellingisolate;
118 });
OLDNEW
« no previous file with comments | « test/codegen/expect/lib/html/async_spawnuri_test.js ('k') | test/codegen/expect/lib/html/audiobuffersourcenode_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698