| Index: content/test/data/media/getusermedia.html
|
| diff --git a/content/test/data/media/getusermedia.html b/content/test/data/media/getusermedia.html
|
| index f194e1a57d98329a45543d087e5c669345e7254b..3589ebde7b6b3f36a503dc31009c7f4b1e5aca36 100644
|
| --- a/content/test/data/media/getusermedia.html
|
| +++ b/content/test/data/media/getusermedia.html
|
| @@ -281,6 +281,58 @@
|
| }
|
| }
|
|
|
| + function getUserMediaInIframeAndCloseInSuccessCb(constraints) {
|
| + var iframe = document.createElement('iframe');
|
| + iframe.onload = onIframeLoaded;
|
| + document.body.appendChild(iframe);
|
| + iframe.src = window.location;
|
| +
|
| + function onIframeLoaded() {
|
| + var iframe = window.document.querySelector('iframe');
|
| + iframe.contentWindow.navigator.webkitGetUserMedia(
|
| + constraints,
|
| + function (stream) {
|
| + // Remove the iframe from the parent within the callback scope.
|
| + window.parent.document.querySelector('iframe').remove();
|
| + // This function enqueues reporting test success, rather than doing
|
| + // it directly. We do this so we catch crashes that occur in the
|
| + // current execution context, but after reportTestSuccess is
|
| + // invoked.
|
| + setTimeout(function () {
|
| + window.parent.reportTestSuccess();
|
| + }, 0);
|
| + },
|
| + window.parent.failedCallback);
|
| + }
|
| + }
|
| +
|
| + function getUserMediaInIframeAndCloseInFailureCb(constraints) {
|
| + var iframe = document.createElement('iframe');
|
| + iframe.onload = onIframeLoaded;
|
| + document.body.appendChild(iframe);
|
| + iframe.src = window.location;
|
| +
|
| + function onIframeLoaded() {
|
| + var iframe = window.document.querySelector('iframe');
|
| + iframe.contentWindow.navigator.webkitGetUserMedia(
|
| + constraints,
|
| + function (stream) {
|
| + window.parent.failTest('GetUserMedia call succeeded unexpectedly.');
|
| + },
|
| + function (error) {
|
| + // Remove the iframe from the parent within the callback scope.
|
| + window.parent.document.querySelector('iframe').remove();
|
| + // This function enqueues reporting test success, rather than doing
|
| + // it directly. We do this so we catch crashes that occur in the
|
| + // current execution context, but after reportTestSuccess is
|
| + // invoked.
|
| + setTimeout(function () {
|
| + window.parent.reportTestSuccess();
|
| + }, 0);
|
| + });
|
| + }
|
| + }
|
| +
|
| function failedCallback(error) {
|
| failTest('GetUserMedia call failed with code ' + error.code);
|
| }
|
|
|