From 9c818c4a4702eb96455107ed2d0354c0d4c2368c Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Thu, 13 Jan 2022 14:07:47 -0800 Subject: [PATCH] test: Update image filtering tests This better reflects the code landed in PR #3856 Issue #3845 Change-Id: I301f1d70c7c52454c22c6d0ee7c9d1461d7e7691 --- test/util/stream_utils_unit.js | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/test/util/stream_utils_unit.js b/test/util/stream_utils_unit.js index 542d4dd82d..1cbde7b1b4 100644 --- a/test/util/stream_utils_unit.js +++ b/test/util/stream_utils_unit.js @@ -624,11 +624,20 @@ describe('StreamUtils', () => { stream.mimeType = 'image/png'; }); manifest.addImageStream(3, (stream) => { - stream.mimeType = 'image/jpeg'; + stream.mimeType = 'image/jpg'; }); manifest.addImageStream(4, (stream) => { + stream.mimeType = 'image/jpeg'; + }); + manifest.addImageStream(5, (stream) => { stream.mimeType = 'image/bogus'; }); + manifest.addImageStream(6, (stream) => { + stream.mimeType = 'image/avif'; + }); + manifest.addImageStream(7, (stream) => { + stream.mimeType = 'image/webp'; + }); }); const noVariant = null; @@ -636,12 +645,19 @@ describe('StreamUtils', () => { fakeDrmEngine, noVariant, manifest); // Covers a regression in which we would remove streams with codecs. - // The last two streams should be removed because their full MIME types - // are bogus. - expect(manifest.imageStreams.length).toBe(3); - expect(manifest.imageStreams[0].id).toBe(1); - expect(manifest.imageStreams[1].id).toBe(2); - expect(manifest.imageStreams[2].id).toBe(3); + // The first 4 streams should be there because they are always supported. + // The 5th stream should be removed because the MIME type is bogus. + // The 6th and 7th streams may be there, based on platform support. + expect(manifest.imageStreams).toContain( + jasmine.objectContaining({id: 1})); + expect(manifest.imageStreams).toContain( + jasmine.objectContaining({id: 2})); + expect(manifest.imageStreams).toContain( + jasmine.objectContaining({id: 3})); + expect(manifest.imageStreams).toContain( + jasmine.objectContaining({id: 4})); + expect(manifest.imageStreams).not.toContain( + jasmine.objectContaining({id: 5})); }); it('filters transport streams', async () => {