From 417fe29dc09a17682c3387387e1950aeddef7f0c Mon Sep 17 00:00:00 2001 From: Aleksei Kuzmin Date: Wed, 30 May 2018 13:50:08 +0200 Subject: [PATCH] Fix the media events test Playing a media now requires a user gesture. See https://goo.gl/xX8pDD. --- spec/fixtures/pages/audio.html | 2 +- spec/webview-spec.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/spec/fixtures/pages/audio.html b/spec/fixtures/pages/audio.html index 0fda8e7075bc..575c8da885b7 100644 --- a/spec/fixtures/pages/audio.html +++ b/spec/fixtures/pages/audio.html @@ -1 +1 @@ - + diff --git a/spec/webview-spec.js b/spec/webview-spec.js index c82be9bb7097..a090a3a48de8 100644 --- a/spec/webview-spec.js +++ b/spec/webview-spec.js @@ -963,11 +963,17 @@ describe(' tag', function () { }) }) - // TODO(alexeykuzmin): Enable the tests. - xdescribe('media-started-playing media-paused events', () => { + describe('media-started-playing media-paused events', () => { it('emits when audio starts and stops playing', async () => { - loadWebView(webview, {src: `file://${fixtures}/pages/audio.html`}) + await loadWebView(webview, {src: `file://${fixtures}/pages/audio.html`}) + + // XXX(alexeykuzmin): Starting from Ch66 playing an audio requires + // a user interaction. See https://goo.gl/xX8pDD. + + webview.executeJavaScript('document.querySelector("audio").play()', true) await waitForEvent(webview, 'media-started-playing') + + webview.executeJavaScript('document.querySelector("audio").pause()', true) await waitForEvent(webview, 'media-paused') }) })