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..525732cea52b9458184fed1c4902381da0aabd01 100644 |
--- a/content/test/data/media/getusermedia.html |
+++ b/content/test/data/media/getusermedia.html |
@@ -281,6 +281,56 @@ |
} |
} |
+ function getUserMediaInIframeAndCloseInSuccessCb(constraints) { |
+ var iframe = document.createElement('iframe'); |
+ iframe.onload = onIframeLoaded; |
+ addExpectedEvent(); |
+ document.body.appendChild(iframe); |
+ iframe.src = window.location; |
+ |
+ function onIframeLoaded() { |
+ var iframe = window.document.querySelector('iframe'); |
+ iframe.contentWindow.navigator.webkitGetUserMedia( |
+ constraints, |
+ function (stream) { |
+ console.log("getUserMedia succeeded."); |
+ // Remove the iframe from the parent within the callback scope. |
+ window.parent.document.querySelector('iframe').remove(); |
+ console.log("Removed Iframe."); |
phoglund_chromium
2015/04/09 15:05:12
Remove this log statement.
|
+ // Complete the test later. This will make the test fail if a crash |
+ // has occurred. Otherwise, the test might falsely pass. |
+ setTimeout(window.parent.eventOccured, 1); |
phoglund_chromium
2015/04/09 15:05:12
Also, consider just calling testSuccessful or what
phoglund_chromium
2015/04/09 15:05:12
Can we do something more useful, like assign the s
perkj_chrome
2015/04/10 09:39:06
Done.
|
+ }, |
+ window.parent.failedCallback); |
+ } |
+ } |
+ |
+ function getUserMediaInIframeAndCloseInFailureCb(constraints) { |
+ var iframe = document.createElement('iframe'); |
+ iframe.onload = onIframeLoaded; |
+ addExpectedEvent(); |
+ 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) { |
+ console.log("getUserMedia failed."); |
+ // Remove the iframe from the parent within the callback scope. |
+ window.parent.document.querySelector('iframe').remove(); |
+ console.log("Removed Iframe."); |
phoglund_chromium
2015/04/09 15:05:12
Remove
|
+ // Complete the test later. This will make the test fail if a crash |
+ // has occurred. Otherwise, the test might falsely pass. |
+ setTimeout(window.parent.eventOccured, 1); |
phoglund_chromium
2015/04/09 15:05:12
Same thing here.
perkj_chrome
2015/04/10 09:39:06
moved this to reportTestSuccess to fix all test ca
|
+ }); |
+ } |
+ } |
+ |
function failedCallback(error) { |
failTest('GetUserMedia call failed with code ' + error.code); |
} |