Skip to content
Permalink
Browse files
Patch
Canonical link: https://commits.webkit.org/156494@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176011 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
philn committed Nov 12, 2014
1 parent 569785a commit 7c5f485961846111044032f74997be67dfea8bda
Showing 66 changed files with 1,513 additions and 21 deletions.
@@ -1,3 +1,34 @@
2014-09-01 Philippe Normand <pnormand@igalia.com>

[WK2] UserMediaClient support
https://bugs.webkit.org/show_bug.cgi?id=123158

Reviewed by Benjamin Poulain.

Simple UserMedia permission request tests inspired from the
Geolocation test suite.

* fast/mediastream/error-expected.txt: Added.
* fast/mediastream/error.html: Added.
* fast/mediastream/script-tests/error.js: Added.
* fast/mediastream/script-tests/success.js: Added.
* fast/mediastream/success-expected.txt: Added.
* fast/mediastream/success.html: Added.
* fast/mediastream/delayed-permission-allowed-expected.txt: Added.
* fast/mediastream/delayed-permission-allowed.html: Added.
* fast/mediastream/delayed-permission-denied-expected.txt: Added.
* fast/mediastream/delayed-permission-denied.html: Added.
* http/tests/media/media-stream/disconnected-frame-already-expected.txt: Added.
* http/tests/media/media-stream/disconnected-frame-already.html: Added.
* http/tests/media/media-stream/disconnected-frame-expected.txt: Added.
* http/tests/media/media-stream/disconnected-frame-permission-denied-expected.txt: Added.
* http/tests/media/media-stream/disconnected-frame-permission-denied.html: Added.
* http/tests/media/media-stream/disconnected-frame.html: Added.
* http/tests/media/media-stream/resources/disconnected-frame-already-inner1.html: Added.
* http/tests/media/media-stream/resources/disconnected-frame-already-inner2.html: Added.
* http/tests/media/media-stream/resources/disconnected-frame-inner.html: Added.
* platform/gtk/TestExpectations:

2014-11-11 Jinwoo Song <jinwoo7.song@samsung.com>

[EFL] Unreviewed EFL gardening. Rebaseline after r174535.
@@ -0,0 +1,10 @@
Tests that no callbacks are invoked until permission is allowed.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS Success callback invoked
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("Tests that no callbacks are invoked until permission is allowed.");
window.jsTestIsAsync = true;

function allowPermission() {
permissionSet = true;
if (window.testRunner)
testRunner.setUserMediaPermission(true);
}

var options = {audio: true, video: true};
navigator.webkitGetUserMedia(options, function(stream) {
if (permissionSet) {
testPassed('Success callback invoked');
finishJSTest();
return;
}
testFailed('Success callback invoked unexpectedly');
}, function(e) {
testFailed('Error callback invoked unexpectedly');
finishJSTest();
});

window.setTimeout(allowPermission, 100);
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
@@ -0,0 +1,10 @@
Tests that no callbacks are invoked until permission is denied.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS error.code is error.PERMISSION_DENIED
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("Tests that no callbacks are invoked until permission is denied.");
window.jsTestIsAsync = true;

function denyPermission() {
permissionSet = true;
if (window.testRunner)
testRunner.setUserMediaPermission(false);
}

var error;
var options = {audio: true, video: true};
navigator.webkitGetUserMedia(options, function(stream) {
testFailed('Success callback invoked unexpectedly');
finishJSTest();
}, function(e) {
if (permissionSet) {
error = e;
shouldBe('error.code', 'error.PERMISSION_DENIED');
finishJSTest();
return;
}
testFailed('Error callback invoked unexpectedly');
finishJSTest();
});

window.setTimeout(denyPermission, 100);
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
@@ -0,0 +1,10 @@
Tests UserMedia error callback using the mock service.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS error.code is error.PERMISSION_DENIED
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("Tests UserMedia error callback using the mock service.");
window.jsTestIsAsync = true;

if (window.testRunner)
testRunner.setUserMediaPermission(false);
else
debug('This test can not be run without the testRunner');

var error;
var options = {audio:false, video:true};
navigator.webkitGetUserMedia(options, function(stream) {
testFailed('Success callback invoked unexpectedly');
finishJSTest();
}, function(e) {
error = e;
shouldBe('error.code', 'error.PERMISSION_DENIED');
finishJSTest();
});
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
@@ -0,0 +1,9 @@
Tests UserMedia success callback using the mock service.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("Tests UserMedia success callback using the mock service.");
window.jsTestIsAsync = true;

if (window.testRunner)
testRunner.setUserMediaPermission(true);
else
debug('This test can not be run without the testRunner');

var options = {audio: true, video: true};
navigator.webkitGetUserMedia(options, function(stream) {
finishJSTest();
}, function(e) {
testFailed('Error callback invoked unexpectedly');
finishJSTest();
});
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
@@ -0,0 +1,11 @@
CONSOLE MESSAGE: line 24: NotSupportedError: DOM Exception 9: The implementation did not support the requested type of object or operation.
Tests that when a getUserMedia request is made after its frame has been disconnected, no callbacks are made and no crash occurs.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


webkitGetUserMedia called on object with disconnected Frame.
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<script src="../../../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("Tests that when a getUserMedia request is made after its frame has been disconnected, no callbacks are made and no crash occurs.");
window.jsTestIsAsync = true;

if (window.testRunner)
testRunner.setUserMediaPermission(true);

function onFirstIframeLoaded() {
iframeNavigator = iframe.contentWindow.navigator;
iframe.src = 'resources/disconnected-frame-already-inner2.html';
}

var error;
var options = {audio: true, video: true};
function onSecondIframeLoaded() {
setTimeout(finishTest, 100);

iframeNavigator.webkitGetUserMedia(options, function(stream) {
testFailed('Success callback invoked unexpectedly');
finishJSTest();
}, function(e) {
testFailed('Error callback invoked unexpectedly');
finishJSTest();
});
}

function finishTest() {
debug('webkitGetUserMedia called on object with disconnected Frame.');
finishJSTest();
}

var iframe = document.createElement('iframe');
iframe.src = 'resources/disconnected-frame-already-inner1.html';
document.body.appendChild(iframe);
</script>
<script src="../../../../resources/js-test-post.js"></script>
</body>
</html>
@@ -0,0 +1,11 @@
frame "<!--framePath //<!--frame0-->-->" - has 1 onunload handler(s)
Tests that when a request is made on a UserMedia object and its Frame is disconnected before a callback is made, the error callback is invoked with the correct error message.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS No callbacks invoked
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,13 @@
frame "<!--framePath //<!--frame0-->-->" - has 1 onunload handler(s)
Tests that when a getUserMedia request is made, permission is denied and its Frame is disconnected before a callback is made, the error callback is invoked with PERMISSION_DENIED.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS error.code is error.PERMISSION_DENIED

PASS No callbacks invoked
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html>
<head>
<script src="../../../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("Tests that when a getUserMedia request is made, permission is denied and its Frame is disconnected before a callback is made, the error callback is invoked with PERMISSION_DENIED.");
window.jsTestIsAsync = true;

if (window.testRunner)
testRunner.setUserMediaPermission(false);
else
debug('This test can not be run without the testRunner');

var error;
var options = {audio: true, video: true};
function onIframeLoaded() {
iframeNavigator = iframe.contentWindow.navigator;
iframeNavigator.webkitGetUserMedia(options, function(stream) {
testFailed('Success callback invoked unexpectedly');
finishJSTest();
}, function(e) {
error = e;
shouldBe('error.code', 'error.PERMISSION_DENIED');
debug('');
iframe.src = 'data:text/html,This frame should be visible when the test completes';
});
}

function onIframeUnloaded() {
// Make another request, with permission already denied.
iframeNavigator.webkitGetUserMedia(options, function(stream) {
testFailed('Success callback invoked unexpectedly');
finishJSTest();
}, function(e) {
testFailed('Error callback invoked unexpectedly');
finishJSTest();
});
setTimeout(function() {
testPassed('No callbacks invoked');
finishJSTest();
}, 100);
}

var iframe = document.createElement('iframe');
iframe.src = 'resources/disconnected-frame-inner.html';
document.body.appendChild(iframe);

</script>
<script src="../../../../resources/js-test-post.js"></script>
</body>
</html>
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("Tests that when a request is made on a UserMedia object and its Frame is disconnected before a callback is made, the error callback is invoked with the correct error message.");
window.jsTestIsAsync = true;

if (window.testRunner)
testRunner.setUserMediaPermission(true);

function onIframeLoaded() {
iframeNavigator = iframe.contentWindow.navigator;
iframe.src = 'data:text/html,This frame should be visible when the test completes';
}

function onIframeUnloaded() {
var options = {audio: true, video: true};
iframeNavigator.webkitGetUserMedia(options, function (stream) {
testFailed('Success callback invoked unexpectedly');
finishJSTest();
}, function(e) {
testFailed('Error callback invoked unexpectedly');
finishJSTest();
});

setTimeout(function() {
testPassed('No callbacks invoked');
finishJSTest();
}, 100);
}

var iframe = document.createElement('iframe');
iframe.src = 'resources/disconnected-frame-inner.html';
document.body.appendChild(iframe);

</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
@@ -0,0 +1,8 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body onload="window.parent.onFirstIframeLoaded()">
<p>This frame should be replaced before the test ends</p>
</body>
</html>

0 comments on commit 7c5f485

Please sign in to comment.