From f3d651272c70d4210d614d28082ca6af8189414e Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Tue, 14 Apr 2020 23:54:22 -0400 Subject: [PATCH] skipping test in firefox --- Tone/source/buffer/ToneBufferSource.test.ts | 26 +++++++++++---------- test/helper/Supports.ts | 3 ++- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Tone/source/buffer/ToneBufferSource.test.ts b/Tone/source/buffer/ToneBufferSource.test.ts index 1c517cfa..6fc73518 100644 --- a/Tone/source/buffer/ToneBufferSource.test.ts +++ b/Tone/source/buffer/ToneBufferSource.test.ts @@ -2,7 +2,7 @@ import { expect } from "chai"; import { BasicTests } from "test/helper/Basic"; import { CompareToFile } from "test/helper/CompareToFile"; import { Offline } from "test/helper/Offline"; -import { ONLINE_TESTING } from "test/helper/Supports"; +import { OFFLINE_BUFFERSOURCE_ONENDED, ONLINE_TESTING } from "test/helper/Supports"; import { ToneAudioBuffer } from "Tone/core/context/ToneAudioBuffer"; import { getContext } from "Tone/core/Global"; import { ToneBufferSource } from "./ToneBufferSource"; @@ -270,19 +270,21 @@ describe("ToneBufferSource", () => { }); }); - it("schedules the onended callback when the buffer is done without scheduling stop", () => { + if (OFFLINE_BUFFERSOURCE_ONENDED) { + it("schedules the onended callback when the buffer is done without scheduling stop", () => { - let wasInvoked = false; - return Offline(() => { - const player = new ToneBufferSource(buffer).toDestination(); - player.start(0); - player.onended = () => { - wasInvoked = true; - }; - }, buffer.duration * 2).then(() => { - expect(wasInvoked).to.equal(true); + let wasInvoked = false; + return Offline(() => { + const player = new ToneBufferSource(buffer).toDestination(); + player.start(0); + player.onended = () => { + wasInvoked = true; + }; + }, buffer.duration * 1.1).then(() => { + expect(wasInvoked).to.equal(true); + }); }); - }); + } }); diff --git a/test/helper/Supports.ts b/test/helper/Supports.ts index 5e1ec13f..88bd4aa8 100644 --- a/test/helper/Supports.ts +++ b/test/helper/Supports.ts @@ -1,4 +1,3 @@ - import { UAParser } from "ua-parser-js"; const parsed = new UAParser().getBrowser(); @@ -39,3 +38,5 @@ export const ONLINE_TESTING = isntVersion("Chrome", 71); export const AUDIO_CONTEXT_CLOSE_RESOLVES = isnt("Firefox") && isnt("Safari", 10); // if it supports gUM testing export const GET_USER_MEDIA = isnt("Safari"); +// firefox does not invoke AudioBufferSourceNode.onended in the offline context +export const OFFLINE_BUFFERSOURCE_ONENDED = isnt("Firefox");