Relanding WebRTC peerconnection iframe test.
This is a version of perkj's test in codereview.chromium.org/1073783003 which also covers a full peer connection call. It does not attempt to verify the case where we nuke the iframe though since we don't know what will happen past the gUM call in that call. The WebRTC call in the iframe will just get torn down so there's not much we can test. This fixes a bug in the test from the original patch, where we would negotiate the call twice because of an iframe.onload quirk. This actually worked except on Windows, but it's a degenerate use case we should not test (except maybe in a fuzzer). BUG=479093 Review URL: https://codereview.chromium.org/1161403002 Cr-Commit-Position: refs/heads/master@{#332586}
This commit is contained in:
content
@ -432,4 +432,8 @@ IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, CreateOfferWithOfferOptions) {
|
||||
MakeTypicalPeerConnectionCall("testCreateOfferOptions();");
|
||||
}
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, CallInsideIframe) {
|
||||
MakeTypicalPeerConnectionCall("callInsideIframe({video: true, audio:true});");
|
||||
}
|
||||
|
||||
} // namespace content
|
||||
|
@ -551,6 +551,33 @@
|
||||
});
|
||||
}
|
||||
|
||||
// Loads this page inside itself using an iframe, and ensures we can make a
|
||||
// successful getUserMedia + peerconnection call inside the iframe.
|
||||
function callInsideIframe(constraints) {
|
||||
runInsideIframe(function(iframe) {
|
||||
// Run a regular webrtc call inside the iframe.
|
||||
iframe.contentWindow.call(constraints);
|
||||
});
|
||||
}
|
||||
|
||||
// Func should accept an iframe as its first argument.
|
||||
function runInsideIframe(func) {
|
||||
var iframe = document.createElement('iframe');
|
||||
document.body.appendChild(iframe);
|
||||
iframe.onload = onIframeLoaded;
|
||||
iframe.src = window.location;
|
||||
|
||||
function onIframeLoaded() {
|
||||
var iframe = window.document.querySelector('iframe');
|
||||
|
||||
// Propagate test success out of the iframe.
|
||||
iframe.contentWindow.setAllEventsOccuredHandler(
|
||||
window.parent.reportTestSuccess);
|
||||
|
||||
func(iframe);
|
||||
}
|
||||
}
|
||||
|
||||
// This function is used for setting up a test that:
|
||||
// 1. Creates a data channel on |gFirstConnection| and sends data to
|
||||
// |gSecondConnection|.
|
||||
|
Reference in New Issue
Block a user