@@ -101,23 +101,6 @@ describe('SchedulerBrowser', () => {
101
101
this . port2 = port2 ;
102
102
} ;
103
103
104
- const scheduling = {
105
- isInputPending ( options ) {
106
- if ( this !== scheduling ) {
107
- throw new Error (
108
- 'isInputPending called with incorrect `this` context' ,
109
- ) ;
110
- }
111
-
112
- return (
113
- hasPendingDiscreteEvent ||
114
- ( options && options . includeContinuous && hasPendingContinuousEvent )
115
- ) ;
116
- } ,
117
- } ;
118
-
119
- global . navigator = { scheduling} ;
120
-
121
104
function ensureLogIsEmpty ( ) {
122
105
if ( eventLog . length !== 0 ) {
123
106
throw Error ( 'Log is not empty. Call assertLog before continuing.' ) ;
@@ -218,7 +201,7 @@ describe('SchedulerBrowser', () => {
218
201
runtime . assertLog ( [
219
202
'Message Event' ,
220
203
'Task' ,
221
- 'Yield at 5ms' ,
204
+ gate ( flags => ( flags . www ? 'Yield at 10ms' : 'Yield at 5ms') ) ,
222
205
'Post Message' ,
223
206
] ) ;
224
207
@@ -320,132 +303,6 @@ describe('SchedulerBrowser', () => {
320
303
runtime . assertLog ( [ 'Message Event' , 'B' ] ) ;
321
304
} ) ;
322
305
323
- it ( 'when isInputPending is available, we can wait longer before yielding' , ( ) => {
324
- function blockUntilSchedulerAsksToYield ( ) {
325
- while ( ! Scheduler . unstable_shouldYield ( ) ) {
326
- runtime . advanceTime ( 1 ) ;
327
- }
328
- runtime . log ( `Yield at ${ performance . now ( ) } ms` ) ;
329
- }
330
-
331
- // First show what happens when we don't request a paint
332
- scheduleCallback ( NormalPriority , ( ) => {
333
- runtime . log ( 'Task with no pending input' ) ;
334
- blockUntilSchedulerAsksToYield ( ) ;
335
- } ) ;
336
- runtime . assertLog ( [ 'Post Message' ] ) ;
337
-
338
- runtime . fireMessageEvent ( ) ;
339
- runtime . assertLog ( [
340
- 'Message Event' ,
341
- 'Task with no pending input' ,
342
- 'Yield at 5ms' ,
343
- ] ) ;
344
-
345
- runtime . resetTime ( ) ;
346
-
347
- // Now do the same thing, but while the task is running, simulate an
348
- // input event.
349
- scheduleCallback ( NormalPriority , ( ) => {
350
- runtime . log ( 'Task with pending input' ) ;
351
- runtime . scheduleDiscreteEvent ( ) ;
352
- blockUntilSchedulerAsksToYield ( ) ;
353
- } ) ;
354
- runtime . assertLog ( [ 'Post Message' ] ) ;
355
-
356
- runtime . fireMessageEvent ( ) ;
357
- runtime . assertLog ( [
358
- 'Message Event' ,
359
- 'Task with pending input' ,
360
- // This time we yielded quickly to unblock the discrete event.
361
- 'Yield at 5ms' ,
362
- 'Discrete Event' ,
363
- ] ) ;
364
- } ) ;
365
-
366
- it (
367
- 'isInputPending will also check for continuous inputs, but after a ' +
368
- 'slightly larger threshold' ,
369
- ( ) => {
370
- function blockUntilSchedulerAsksToYield ( ) {
371
- while ( ! Scheduler . unstable_shouldYield ( ) ) {
372
- runtime . advanceTime ( 1 ) ;
373
- }
374
- runtime . log ( `Yield at ${ performance . now ( ) } ms` ) ;
375
- }
376
-
377
- // First show what happens when we don't request a paint
378
- scheduleCallback ( NormalPriority , ( ) => {
379
- runtime . log ( 'Task with no pending input' ) ;
380
- blockUntilSchedulerAsksToYield ( ) ;
381
- } ) ;
382
- runtime . assertLog ( [ 'Post Message' ] ) ;
383
-
384
- runtime . fireMessageEvent ( ) ;
385
- runtime . assertLog ( [
386
- 'Message Event' ,
387
- 'Task with no pending input' ,
388
- 'Yield at 5ms' ,
389
- ] ) ;
390
-
391
- runtime . resetTime ( ) ;
392
-
393
- // Now do the same thing, but while the task is running, simulate a
394
- // continuous input event.
395
- scheduleCallback ( NormalPriority , ( ) => {
396
- runtime . log ( 'Task with continuous input' ) ;
397
- runtime . scheduleContinuousEvent ( ) ;
398
- blockUntilSchedulerAsksToYield ( ) ;
399
- } ) ;
400
- runtime . assertLog ( [ 'Post Message' ] ) ;
401
-
402
- runtime . fireMessageEvent ( ) ;
403
- runtime . assertLog ( [
404
- 'Message Event' ,
405
- 'Task with continuous input' ,
406
- 'Yield at 5ms' ,
407
- 'Continuous Event' ,
408
- ] ) ;
409
- } ,
410
- ) ;
411
-
412
- it ( 'requestPaint forces a yield at the end of the next frame interval' , ( ) => {
413
- function blockUntilSchedulerAsksToYield ( ) {
414
- while ( ! Scheduler . unstable_shouldYield ( ) ) {
415
- runtime . advanceTime ( 1 ) ;
416
- }
417
- runtime . log ( `Yield at ${ performance . now ( ) } ms` ) ;
418
- }
419
-
420
- // First show what happens when we don't request a paint
421
- scheduleCallback ( NormalPriority , ( ) => {
422
- runtime . log ( 'Task with no paint' ) ;
423
- blockUntilSchedulerAsksToYield ( ) ;
424
- } ) ;
425
- runtime . assertLog ( [ 'Post Message' ] ) ;
426
-
427
- runtime . fireMessageEvent ( ) ;
428
- runtime . assertLog ( [ 'Message Event' , 'Task with no paint' , 'Yield at 5ms' ] ) ;
429
-
430
- runtime . resetTime ( ) ;
431
-
432
- // Now do the same thing, but call requestPaint inside the task
433
- scheduleCallback ( NormalPriority , ( ) => {
434
- runtime . log ( 'Task with paint' ) ;
435
- requestPaint ( ) ;
436
- blockUntilSchedulerAsksToYield ( ) ;
437
- } ) ;
438
- runtime . assertLog ( [ 'Post Message' ] ) ;
439
-
440
- runtime . fireMessageEvent ( ) ;
441
- runtime . assertLog ( [
442
- 'Message Event' ,
443
- 'Task with paint' ,
444
- // This time we yielded quickly (5ms) because we requested a paint.
445
- 'Yield at 5ms' ,
446
- ] ) ;
447
- } ) ;
448
-
449
306
it ( 'yielding continues in a new task regardless of how much time is remaining' , ( ) => {
450
307
scheduleCallback ( NormalPriority , ( ) => {
451
308
runtime . log ( 'Original Task' ) ;
0 commit comments