mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
Fix the media events test
Playing a media now requires a user gesture. See https://goo.gl/xX8pDD.
This commit is contained in:
committed by
Samuel Attard
parent
a7d2f7531c
commit
417fe29dc0
2
spec/fixtures/pages/audio.html
vendored
2
spec/fixtures/pages/audio.html
vendored
@@ -1 +1 @@
|
||||
<audio autoplay muted src="../assets/tone.wav"></audio>
|
||||
<audio muted src="../assets/tone.wav"></audio>
|
||||
|
||||
@@ -963,11 +963,17 @@ describe('<webview> 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')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user