Fix the media events test

Playing a media now requires a user gesture.
See https://goo.gl/xX8pDD.
This commit is contained in:
Aleksei Kuzmin 2018-05-30 13:50:08 +02:00 committed by Samuel Attard
parent a7d2f7531c
commit 417fe29dc0
2 changed files with 10 additions and 4 deletions

View file

@ -1 +1 @@
<audio autoplay muted src="../assets/tone.wav"></audio> <audio muted src="../assets/tone.wav"></audio>

View file

@ -963,11 +963,17 @@ describe('<webview> tag', function () {
}) })
}) })
// TODO(alexeykuzmin): Enable the tests. describe('media-started-playing media-paused events', () => {
xdescribe('media-started-playing media-paused events', () => {
it('emits when audio starts and stops playing', async () => { 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') await waitForEvent(webview, 'media-started-playing')
webview.executeJavaScript('document.querySelector("audio").pause()', true)
await waitForEvent(webview, 'media-paused') await waitForEvent(webview, 'media-paused')
}) })
}) })