WebKit Bugzilla
Attachment 356523 Details for
Bug 192371
: Fix MediaRecorder flaky tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192371-20181204114523.patch (text/plain), 21.13 KB, created by
youenn fablet
on 2018-12-04 11:45:23 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2018-12-04 11:45:23 PST
Size:
21.13 KB
patch
obsolete
>Subversion Revision: 238855 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 3dceb4ae797c15e87d6a4f54b1cc295fcf9efae0..3cd666e0f13e601fcab82faa435acc96155f9027 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,16 @@ >+2018-12-04 Youenn Fablet <youenn@apple.com> >+ >+ Fix MediaRecorder flaky tests >+ https://bugs.webkit.org/show_bug.cgi?id=192371 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ No change of behavior. >+ >+ * testing/Internals.cpp: >+ (WebCore::Internals::resetToConsistentState): >+ Reset to use real MediaRecorder by default. >+ > 2018-12-04 Ryan Haddad <ryanhaddad@apple.com> > > Unreviewed, rolling out r238840. >diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp >index 38161b90ba195011440cfe0450caa140f3ce256a..3a6df636bf69bec77d78d924a269b6170d8e9a87 100644 >--- a/Source/WebCore/testing/Internals.cpp >+++ b/Source/WebCore/testing/Internals.cpp >@@ -519,6 +519,10 @@ void Internals::resetToConsistentState(Page& page) > page.setFullscreenControlsHidden(false); > > MediaEngineConfigurationFactory::disableMock(); >+ >+#if ENABLE(MEDIA_STREAM) >+ WebCore::MediaRecorder::setCustomPrivateRecorderCreator(nullptr); >+#endif > } > > Internals::Internals(Document& document) >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 5bcb7567a0d912274fae81d6f5c3b9032a3e5485..f54a35a5ff67d8c9976a24578cf7c2685dc7b576 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,18 @@ >+2018-12-04 Youenn Fablet <youenn@apple.com> >+ >+ Fix MediaRecorder flaky tests >+ https://bugs.webkit.org/show_bug.cgi?id=192371 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Updated tests to make them less flaky and more debuggable. >+ >+ * http/wpt/mediarecorder/MediaRecorder-AV-audio-only-dataavailable.html: >+ * http/wpt/mediarecorder/MediaRecorder-AV-audio-video-dataavailable.html: >+ * http/wpt/mediarecorder/MediaRecorder-AV-video-only-dataavailable.html: >+ * platform/gtk/TestExpectations: >+ * platform/wpe/TestExpectations: >+ > 2018-12-04 Ryan Haddad <ryanhaddad@apple.com> > > Unreviewed, rolling out r238840. >diff --git a/LayoutTests/http/wpt/mediarecorder/MediaRecorder-AV-audio-only-dataavailable.html b/LayoutTests/http/wpt/mediarecorder/MediaRecorder-AV-audio-only-dataavailable.html >index a43c4f8c7b0418c0ade3b1bad2a44558309753be..5b175daf35feadede9c658824ef4cbd40461e9af 100644 >--- a/LayoutTests/http/wpt/mediarecorder/MediaRecorder-AV-audio-only-dataavailable.html >+++ b/LayoutTests/http/wpt/mediarecorder/MediaRecorder-AV-audio-only-dataavailable.html >@@ -1,7 +1,7 @@ > <!doctype html> > <html> > <head> >- <title>MediaRecorder Dataavailable</title> >+ <title>MediaRecorder can successfully record the audio for a audio-only stream</title> > <link rel="help" href="https://w3c.github.io/mediacapture-record/MediaRecorder.html#mediarecorder"> > <script src="/resources/testharness.js"></script> > <script src="/resources/testharnessreport.js"></script> >@@ -11,37 +11,35 @@ > </audio> > <script> > >- async_test(t => { >- const ac = new AudioContext(); >- const osc = ac.createOscillator(); >- const dest = ac.createMediaStreamDestination(); >- const audio = dest.stream; >- osc.connect(dest); >- const recorder = new MediaRecorder(audio); >- recorder.ondataavailable = t.step_func(blobEvent => { >- assert_true(blobEvent instanceof BlobEvent, 'the type of event should be BlobEvent'); >- assert_equals(blobEvent.type, 'dataavailable', 'the event type should be dataavailable'); >- assert_true(blobEvent.isTrusted, 'isTrusted should be true when the event is created by C++'); >- assert_true(blobEvent.data instanceof Blob, 'the type of data should be Blob'); >- assert_true(blobEvent.data.size > 0, 'the blob should contain some buffers'); >- const player = document.getElementById("player"); >- player.src = window.URL.createObjectURL(blobEvent.data); >- player.oncanplay = () => { >- assert_greater_than(player.duration, 0, 'the duration should be greater than 0'); >- t.done(); >- }; >- player.load(); >- }); >+ const ac = new webkitAudioContext(); >+ const osc = ac.createOscillator(); >+ const dest = ac.createMediaStreamDestination(); >+ const audio = dest.stream; >+ osc.connect(dest); >+ const recorder = new MediaRecorder(audio); >+ recorder.ondataavailable = (blobEvent) => { >+ assert_true(blobEvent instanceof BlobEvent, 'the type of event should be BlobEvent'); >+ assert_equals(blobEvent.type, 'dataavailable', 'the event type should be dataavailable'); >+ assert_true(blobEvent.isTrusted, 'isTrusted should be true when the event is created by C++'); >+ assert_true(blobEvent.data instanceof Blob, 'the type of data should be Blob'); >+ assert_true(blobEvent.data.size > 0, 'the blob should contain some buffers'); >+ const player = document.getElementById("player"); >+ player.src = window.URL.createObjectURL(blobEvent.data); >+ player.oncanplay = () => { >+ assert_greater_than(player.duration, 0, 'the duration should be greater than 0'); >+ done(); >+ }; >+ player.load(); >+ }; > >- recorder.start(); >- osc.start(); >- assert_equals(recorder.state, 'recording', 'MediaRecorder has been started successfully'); >- setTimeout(() => { >- recorder.stop(); >- osc.stop(); >- }, 500); >- }, 'MediaRecorder can successfully record the audio for a audio-only stream'); >+ recorder.start(); >+ osc.start(); >+ assert_equals(recorder.state, 'recording', 'MediaRecorder has been started successfully'); >+ setTimeout(() => { >+ recorder.stop(); >+ osc.stop(); >+ }, 500); > > </script> > </body> >-</html> >\ No newline at end of file >+</html> >diff --git a/LayoutTests/http/wpt/mediarecorder/MediaRecorder-AV-audio-video-dataavailable.html b/LayoutTests/http/wpt/mediarecorder/MediaRecorder-AV-audio-video-dataavailable.html >index df0436c9088398938984149e5835416745385c31..60b97a0afcd4115559824d6d5365416215eac1d5 100644 >--- a/LayoutTests/http/wpt/mediarecorder/MediaRecorder-AV-audio-video-dataavailable.html >+++ b/LayoutTests/http/wpt/mediarecorder/MediaRecorder-AV-audio-video-dataavailable.html >@@ -1,7 +1,7 @@ > <!doctype html> > <html> > <head> >- <title>MediaRecorder Dataavailable</title> >+ <title>MediaRecorder can successfully record the video for a audio-video stream</title> > <link rel="help" href="https://w3c.github.io/mediacapture-record/MediaRecorder.html#mediarecorder"> > <script src="/resources/testharness.js"></script> > <script src="/resources/testharnessreport.js"></script> >@@ -10,13 +10,13 @@ > </head> > <body> > <div> >- <video id="player"> >+ <video id="player" controls="true"> > </video> > </div> > <div> > <canvas id="canvas" width="200" height="200"> > </canvas> >- <canvas id="frame" width="200" height="200"> >+ <canvas id="frame" width="200" height="200" style="visibility:visible; display:block"> > </canvas> > </div> > <script> >@@ -33,7 +33,7 @@ > if (context) { > context.fillStyle = "#ff0000"; > context.fillRect(0, 0, 200, 200); >- if (Date.now() - drawStartTime < 500) { >+ if (Date.now() - drawStartTime < 1000) { > window.requestAnimationFrame(doRedImageDraw); > } else { > drawStartTime = Date.now(); >@@ -46,68 +46,70 @@ > if (context) { > context.fillStyle = "#00ff00"; > context.fillRect(0, 0, 200, 200); >- if (Date.now() - drawStartTime < 500) { >+ if (Date.now() - drawStartTime < 20000) { > window.requestAnimationFrame(doGreenImageDraw); > } > } > } > >- async_test(t => { >- const ac = new AudioContext(); >- const osc = ac.createOscillator(); >- const dest = ac.createMediaStreamDestination(); >- const audio = dest.stream; >- osc.connect(dest); >+ const ac = new webkitAudioContext(); >+ const osc = ac.createOscillator(); >+ const dest = ac.createMediaStreamDestination(); >+ const audio = dest.stream; >+ osc.connect(dest); > >- const video = createVideoStream(); >- assert_equals(video.getAudioTracks().length, 0, "video mediastream starts with no audio track"); >- assert_equals(audio.getAudioTracks().length, 1, "audio mediastream starts with one audio track"); >- video.addTrack(audio.getAudioTracks()[0]); >- assert_equals(video.getAudioTracks().length, 1, "video mediastream starts with one audio track"); >- const recorder = new MediaRecorder(video); >- let mode = 0; >+ const video = createVideoStream(); >+ assert_equals(video.getAudioTracks().length, 0, "video mediastream starts with no audio track"); >+ assert_equals(audio.getAudioTracks().length, 1, "audio mediastream starts with one audio track"); >+ video.addTrack(audio.getAudioTracks()[0]); >+ assert_equals(video.getAudioTracks().length, 1, "video mediastream starts with one audio track"); >+ const recorder = new MediaRecorder(video); >+ let mode = 0; > >- recorder.ondataavailable = t.step_func(blobEvent => { >- assert_true(blobEvent instanceof BlobEvent, 'the type of event should be BlobEvent'); >- assert_equals(blobEvent.type, 'dataavailable', 'the event type should be dataavailable'); >- assert_true(blobEvent.isTrusted, 'isTrusted should be true when the event is created by C++'); >- assert_true(blobEvent.data instanceof Blob, 'the type of data should be Blob'); >- assert_true(blobEvent.data.size > 0, 'the blob should contain some buffers'); >- player.src = window.URL.createObjectURL(blobEvent.data); >- const resFrame = document.getElementById("frame"); >- const resContext = resFrame.getContext('2d'); >- player.oncanplay = () => { >- assert_greater_than(player.duration, 0.1, 'the duration should be greater than 100ms'); >- player.play(); >- }; >- player.onplay = () => { >- player.pause(); >- player.currentTime = 0.1; >- }; >- player.onseeked = () => { >- resContext.drawImage(player, 0, 0); >- if (!mode) { >- _assertPixelApprox(resFrame, 0, 0, 255, 0, 0, 255, "0, 0", "255, 0, 0, 255", 5); >- _assertPixelApprox(resFrame, 50, 50, 255, 0, 0, 255, "50, 50", "255, 0, 0, 255", 5); >- mode = 1; >- player.currentTime = player.duration; >- } else { >- _assertPixelApprox(resFrame, 199, 0, 0, 255, 0, 255, "199, 0", "0, 255, 0, 255", 5); >- _assertPixelApprox(resFrame, 199, 199, 0, 255, 0, 255, "199, 199", "0, 255, 0, 255", 5); >- t.done(); >- } >- }; >- player.load(); >- }); >- drawStartTime = Date.now(); >- doRedImageDraw(); >- recorder.start(); >- assert_equals(recorder.state, 'recording', 'MediaRecorder has been started successfully'); >- setTimeout(() => { >- recorder.stop(); >- }, 1000); >- }, 'MediaRecorder can successfully record the video for a audio-video stream'); >+ recorder.ondataavailable = (blobEvent) => { >+ assert_true(blobEvent instanceof BlobEvent, 'the type of event should be BlobEvent'); >+ assert_equals(blobEvent.type, 'dataavailable', 'the event type should be dataavailable'); >+ assert_true(blobEvent.isTrusted, 'isTrusted should be true when the event is created by C++'); >+ assert_true(blobEvent.data instanceof Blob, 'the type of data should be Blob'); >+ assert_true(blobEvent.data.size > 0, 'the blob should contain some buffers'); >+ player.src = window.URL.createObjectURL(blobEvent.data); >+ const resFrame = document.getElementById("frame"); >+ const resContext = resFrame.getContext('2d'); >+ player.oncanplay = () => { >+ assert_greater_than(player.duration, 0.1, 'the duration should be greater than 100ms'); >+ player.play(); >+ }; >+ player.onplay = () => { >+ if (mode === 2) >+ return; >+ player.pause(); >+ player.currentTime = 0.2; >+ }; >+ player.onseeked = () => { >+ resContext.drawImage(player, 0, 0); >+ if (!mode) { >+ _assertPixelApprox(resFrame, 20, 20, 255, 0, 0, 255, "20, 20", "255, 0, 0, 255", 50); >+ _assertPixelApprox(resFrame, 50, 50, 255, 0, 0, 255, "50, 50", "255, 0, 0, 255", 50); >+ mode = 1; >+ player.currentTime = 1.8; >+ } else if (mode === 1) { >+ _assertPixelApprox(resFrame, 21, 21, 0, 255, 0, 255, "21, 21", "0, 255, 0, 255", 50); >+ _assertPixelApprox(resFrame, 51, 51, 0, 255, 0, 255, "51, 51", "0, 255, 0, 255", 50); >+ //player.currentTime = 0; >+ mode =2; >+ done(); >+ } >+ }; >+ player.load(); >+ }; >+ recorder.start(); >+ assert_equals(recorder.state, 'recording', 'MediaRecorder has been started successfully'); >+ drawStartTime = Date.now(); >+ doRedImageDraw(); >+ setTimeout(() => { >+ recorder.stop(); >+ }, 2000); > > </script> > </body> >-</html> >\ No newline at end of file >+</html> >diff --git a/LayoutTests/http/wpt/mediarecorder/MediaRecorder-AV-video-only-dataavailable.html b/LayoutTests/http/wpt/mediarecorder/MediaRecorder-AV-video-only-dataavailable.html >index 2e644dc3c7f3c2b4bf7f97e6e907fb238349b374..f4e53ca49b8e859fdd1189a5c46edd38fbf28cd7 100644 >--- a/LayoutTests/http/wpt/mediarecorder/MediaRecorder-AV-video-only-dataavailable.html >+++ b/LayoutTests/http/wpt/mediarecorder/MediaRecorder-AV-video-only-dataavailable.html >@@ -1,7 +1,7 @@ > <!doctype html> > <html> > <head> >- <title>MediaRecorder Dataavailable</title> >+ <title>MediaRecorder can successfully record the video for a video-only stream</title> > <link rel="help" href="https://w3c.github.io/mediacapture-record/MediaRecorder.html#mediarecorder"> > <script src="/resources/testharness.js"></script> > <script src="/resources/testharnessreport.js"></script> >@@ -10,13 +10,13 @@ > </head> > <body> > <div> >- <video id="player"> >+ <video id="player" controls=true> > </video> > </div> > <div> > <canvas id="canvas" width="200" height="200"> > </canvas> >- <canvas id="frame" width="200" height="200"> >+ <canvas id="frame" width="200" height="200" style="visibility:visible; display:block"> > </canvas> > </div> > <script> >@@ -33,7 +33,7 @@ > if (context) { > context.fillStyle = "#ff0000"; > context.fillRect(0, 0, 200, 200); >- if (Date.now() - drawStartTime < 500) { >+ if (Date.now() - drawStartTime < 1000) { > window.requestAnimationFrame(doRedImageDraw); > } else { > drawStartTime = Date.now(); >@@ -46,57 +46,59 @@ > if (context) { > context.fillStyle = "#00ff00"; > context.fillRect(0, 0, 200, 200); >- if (Date.now() - drawStartTime < 500) { >+ if (Date.now() - drawStartTime < 2000) { > window.requestAnimationFrame(doGreenImageDraw); > } > } > } > >- async_test(t => { >- const video = createVideoStream(); >- const recorder = new MediaRecorder(video); >- let mode = 0; >- recorder.ondataavailable = t.step_func(blobEvent => { >- assert_true(blobEvent instanceof BlobEvent, 'the type of event should be BlobEvent'); >- assert_equals(blobEvent.type, 'dataavailable', 'the event type should be dataavailable'); >- assert_true(blobEvent.isTrusted, 'isTrusted should be true when the event is created by C++'); >- assert_true(blobEvent.data instanceof Blob, 'the type of data should be Blob'); >- assert_true(blobEvent.data.size > 0, 'the blob should contain some buffers'); >- player.src = window.URL.createObjectURL(blobEvent.data); >- const resFrame = document.getElementById("frame"); >- const resContext = resFrame.getContext('2d'); >- player.oncanplay = () => { >- assert_greater_than(player.duration, 0.1, 'the duration should be greater than 100ms'); >- player.play(); >- }; >- player.onplay = () => { >- player.pause(); >- player.currentTime = 0.1; >- }; >- player.onseeked = () => { >- resContext.drawImage(player, 0, 0); >- if (!mode) { >- _assertPixelApprox(resFrame, 0, 0, 255, 0, 0, 255, "0, 0", "255, 0, 0, 255", 5); >- _assertPixelApprox(resFrame, 50, 50, 255, 0, 0, 255, "50, 50", "255, 0, 0, 255", 5); >- mode = 1; >- player.currentTime = player.duration; >- } else { >- _assertPixelApprox(resFrame, 199, 0, 0, 255, 0, 255, "199, 0", "0, 255, 0, 255", 5); >- _assertPixelApprox(resFrame, 199, 199, 0, 255, 0, 255, "199, 199", "0, 255, 0, 255", 5); >- t.done(); >- } >- }; >- player.load(); >- }); >- drawStartTime = Date.now(); >- doRedImageDraw(); >- recorder.start(); >- assert_equals(recorder.state, 'recording', 'MediaRecorder has been started successfully'); >- setTimeout(() => { >- recorder.stop(); >- }, 1000); >- }, 'MediaRecorder can successfully record the video for a video-only stream'); >+ const video = createVideoStream(); >+ const recorder = new MediaRecorder(video); >+ let mode = 0; >+ recorder.ondataavailable = (blobEvent) => { >+ assert_true(blobEvent instanceof BlobEvent, 'the type of event should be BlobEvent'); >+ assert_equals(blobEvent.type, 'dataavailable', 'the event type should be dataavailable'); >+ assert_true(blobEvent.isTrusted, 'isTrusted should be true when the event is created by C++'); >+ assert_true(blobEvent.data instanceof Blob, 'the type of data should be Blob'); >+ assert_true(blobEvent.data.size > 0, 'the blob should contain some buffers'); >+ player.src = window.URL.createObjectURL(blobEvent.data); >+ const resFrame = document.getElementById("frame"); >+ const resContext = resFrame.getContext('2d'); >+ player.oncanplay = () => { >+ assert_greater_than(player.duration, 0.1, 'the duration should be greater than 100ms'); >+ player.play(); >+ }; >+ player.onplay = () => { >+ if (mode === 2) >+ return; >+ player.pause(); >+ player.currentTime = 0.1; >+ }; >+ player.onseeked = () => { >+ resContext.drawImage(player, 0, 0); >+ if (!mode) { >+ _assertPixelApprox(resFrame, 20, 20, 255, 0, 0, 255, "20,2 0", "255, 0, 0, 255", 50); >+ _assertPixelApprox(resFrame, 50, 50, 255, 0, 0, 255, "50, 50", "255, 0, 0, 255", 50); >+ mode = 1; >+ player.currentTime = player.duration - 0.1; >+ } else if (mode === 1){ >+ _assertPixelApprox(resFrame, 21, 21, 0, 255, 0, 255, "21, 21", "0, 255, 0, 255", 50); >+ _assertPixelApprox(resFrame, 51, 51, 0, 255, 0, 255, "51, 51", "0, 255, 0, 255", 50); >+ //player.currentTime = 0; >+ mode = 2; >+ done(); >+ } >+ }; >+ player.load(); >+ }; >+ recorder.start(); >+ assert_equals(recorder.state, 'recording', 'MediaRecorder has been started successfully'); >+ drawStartTime = Date.now(); >+ doRedImageDraw(); >+ setTimeout(() => { >+ recorder.stop(); >+ }, 2000); > > </script> > </body> >-</html> >\ No newline at end of file >+</html> >diff --git a/LayoutTests/platform/gtk/TestExpectations b/LayoutTests/platform/gtk/TestExpectations >index 502384c7da7ad8098bbf9b2c770ece13b47f8136..c81e7a3b6d8a54fda99af2b574d1f6639fbdcc97 100644 >--- a/LayoutTests/platform/gtk/TestExpectations >+++ b/LayoutTests/platform/gtk/TestExpectations >@@ -599,6 +599,9 @@ webkit.org/b/186933 webrtc/getUserMedia-webaudio-autoplay.html > > imported/w3c/web-platform-tests/webrtc/ [ Skip ] > http/tests/webrtc [ Skip ] >+ >+http/wpt/mediarecorder [ Skip ] >+ > # The MediaStream implementation is also still not completed > webkit.org/b/79203 fast/mediastream/mock-media-source-webaudio.html [ Timeout ] > webkit.org/b/79203 fast/mediastream/getUserMedia-webaudio.html [ Failure ] >diff --git a/LayoutTests/platform/wpe/TestExpectations b/LayoutTests/platform/wpe/TestExpectations >index 32c07055b17b38d51e3b355157ce9e792c50cf9b..12a6a563ef77fa8ab21c5da7245484d06702e446 100644 >--- a/LayoutTests/platform/wpe/TestExpectations >+++ b/LayoutTests/platform/wpe/TestExpectations >@@ -494,6 +494,8 @@ http/tests/webrtc [ Skip ] > http/tests/websocket [ Skip ] > http/tests/xmlhttprequest [ Skip ] > >+http/wpt/mediarecorder [ Skip ] >+ > # Service-workers tests that fail, time out or crash. > webkit.org/b/175419 http/tests/workers/service/controller-change.html [ Skip ] > webkit.org/b/175419 http/tests/workers/service/no-page-cache-when-controlled.html [ Skip ]
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192371
:
356523
|
356525