From f670bd7a5c060ea05f025ef5573769228fd141e0 Mon Sep 17 00:00:00 2001 From: Eugen Sawin Date: Tue, 8 Sep 2020 15:59:28 +0000 Subject: [PATCH] Bug 1662508 - [2.0] Add media session artwork smoke tests. r=geckoview-reviewers,agi Differential Revision: https://phabricator.services.mozilla.com/D89015 --- .../assets/www/media_session_dom1.html | 18 +++++++++++++++--- .../mozilla/geckoview/test/MediaSessionTest.kt | 10 +++++++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/mobile/android/geckoview/src/androidTest/assets/www/media_session_dom1.html b/mobile/android/geckoview/src/androidTest/assets/www/media_session_dom1.html index 75ea046e5022..e8aed90752a5 100644 --- a/mobile/android/geckoview/src/androidTest/assets/www/media_session_dom1.html +++ b/mobile/android/geckoview/src/androidTest/assets/www/media_session_dom1.html @@ -50,7 +50,11 @@ title: "hoot", artist: "owl", album: "hoots", - artwork: [{src: "owl.png", type: "image/png", sizes: "16x16 32x32"}] + artwork: [{ + src: "images/test.gif", + type: "image/gif", + sizes: "265x199" + }] }); audio1.id = 0; @@ -61,7 +65,11 @@ title: "hoot2", artist: "stillowl", album: "dahoots", - artwork: [{src: "owl.png", type: "image/png", sizes: "16x16 32x32"}] + artwork: [{ + src: "images/test.gif", + type: "image/gif", + sizes: "265x199" + }] }); audio2.id = 1; @@ -72,7 +80,11 @@ title: "hoot3", artist: "immaowl", album: "mahoots", - artwork: [{src: "owl.png", type: "image/png", sizes: "16x16 32x32"}] + artwork: [{ + src: "images/test.gif", + type: "image/gif", + sizes: "265x199" + }] }); audio3.id = 2; diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/MediaSessionTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/MediaSessionTest.kt index deb57a03bf7f..8bd140385b9c 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/MediaSessionTest.kt +++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/MediaSessionTest.kt @@ -29,7 +29,7 @@ class Metadata( title: String?, artist: String?, album: String?) - : MediaSession.Metadata(title, artist, album) {} + : MediaSession.Metadata(title, artist, album, null) {} @RunWith(AndroidJUnit4::class) @MediumTest @@ -227,6 +227,10 @@ class MediaSessionTest : BaseSessionTest() { DOM_META[1].album, DOM_META[2].album, DOM_META[1].album))) + assertThat( + "Artwork image should be non-null", + meta.artwork!!.getBitmap(200), + notNullValue()) onMetadataCalled[sessionRule.currentCall.counter - 1] .complete(null) @@ -599,6 +603,10 @@ class MediaSessionTest : BaseSessionTest() { equalTo(forEachCall( DOM_META[0].album, DOM_META[1].album))) + assertThat( + "Artwork image should be non-null", + meta.artwork!!.getBitmap(200), + notNullValue()) } @AssertCalled(count = 2)