haikuwebkit/LayoutTests/webrtc/stun-server-filtering.html

45 lines
2.0 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
<script src='../resources/testharness.js'></script>
<script src='../resources/testharnessreport.js'></script>
<script>
Add support for RTCPeerConnection.onicecandidateerror event https://bugs.webkit.org/show_bug.cgi?id=169644 Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/webrtc/idlharness.https.window-expected.txt: Source/WebCore: Expose RTCPeerConnection.onicecandidateerror and use it for wrong STUN/TURN server URLs. For that matter, add RTCPeerConnectionIceErrorEvent as per spec with a slight change to the init directory to keep the same terminology between event and init dictionary. Covered by updated webrtc/stun-server-filtering.html test. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::iceServersFromConfiguration): (WebCore::iceServersFromConfiguration): Deleted. * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/RTCPeerConnectionIceErrorEvent.cpp: Added. (WebCore::RTCPeerConnectionIceErrorEvent::create): (WebCore::RTCPeerConnectionIceErrorEvent::RTCPeerConnectionIceErrorEvent): (WebCore::RTCPeerConnectionIceErrorEvent::eventInterface const): * Modules/mediastream/RTCPeerConnectionIceErrorEvent.h: Added. * Modules/mediastream/RTCPeerConnectionIceErrorEvent.idl: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * dom/EventNames.h: * dom/EventNames.in: LayoutTests: * webrtc/rtcpeerconnection-error-messages-expected.txt: * webrtc/stun-server-filtering.html: Canonical link: https://commits.webkit.org/231814@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270101 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-20 11:05:32 +00:00
promise_test(async (test) => {
let pc = new RTCPeerConnection({iceServers:[{urls:['stun:foo.com', 'stun:blabla.local']}]});
Add support for RTCPeerConnection.onicecandidateerror event https://bugs.webkit.org/show_bug.cgi?id=169644 Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/webrtc/idlharness.https.window-expected.txt: Source/WebCore: Expose RTCPeerConnection.onicecandidateerror and use it for wrong STUN/TURN server URLs. For that matter, add RTCPeerConnectionIceErrorEvent as per spec with a slight change to the init directory to keep the same terminology between event and init dictionary. Covered by updated webrtc/stun-server-filtering.html test. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::iceServersFromConfiguration): (WebCore::iceServersFromConfiguration): Deleted. * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/RTCPeerConnectionIceErrorEvent.cpp: Added. (WebCore::RTCPeerConnectionIceErrorEvent::create): (WebCore::RTCPeerConnectionIceErrorEvent::RTCPeerConnectionIceErrorEvent): (WebCore::RTCPeerConnectionIceErrorEvent::eventInterface const): * Modules/mediastream/RTCPeerConnectionIceErrorEvent.h: Added. * Modules/mediastream/RTCPeerConnectionIceErrorEvent.idl: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * dom/EventNames.h: * dom/EventNames.in: LayoutTests: * webrtc/rtcpeerconnection-error-messages-expected.txt: * webrtc/stun-server-filtering.html: Canonical link: https://commits.webkit.org/231814@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270101 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-20 11:05:32 +00:00
let promise = new Promise(resolve => pc.onicecandidateerror = resolve);
let configuration = pc.getConfiguration();
assert_equals(configuration.iceServers[0].urls.length, 1);
assert_equals(configuration.iceServers[0].urls[0], 'stun:foo.com');
Add support for RTCPeerConnection.onicecandidateerror event https://bugs.webkit.org/show_bug.cgi?id=169644 Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/webrtc/idlharness.https.window-expected.txt: Source/WebCore: Expose RTCPeerConnection.onicecandidateerror and use it for wrong STUN/TURN server URLs. For that matter, add RTCPeerConnectionIceErrorEvent as per spec with a slight change to the init directory to keep the same terminology between event and init dictionary. Covered by updated webrtc/stun-server-filtering.html test. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::iceServersFromConfiguration): (WebCore::iceServersFromConfiguration): Deleted. * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/RTCPeerConnectionIceErrorEvent.cpp: Added. (WebCore::RTCPeerConnectionIceErrorEvent::create): (WebCore::RTCPeerConnectionIceErrorEvent::RTCPeerConnectionIceErrorEvent): (WebCore::RTCPeerConnectionIceErrorEvent::eventInterface const): * Modules/mediastream/RTCPeerConnectionIceErrorEvent.h: Added. * Modules/mediastream/RTCPeerConnectionIceErrorEvent.idl: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * dom/EventNames.h: * dom/EventNames.in: LayoutTests: * webrtc/rtcpeerconnection-error-messages-expected.txt: * webrtc/stun-server-filtering.html: Canonical link: https://commits.webkit.org/231814@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270101 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-20 11:05:32 +00:00
const event = await promise;
assert_equals(event.url, 'stun:blabla.local');
assert_equals(event.errorCode, 701);
}, "RTCPeerConnection and local STUN server");
Add support for RTCPeerConnection.onicecandidateerror event https://bugs.webkit.org/show_bug.cgi?id=169644 Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/webrtc/idlharness.https.window-expected.txt: Source/WebCore: Expose RTCPeerConnection.onicecandidateerror and use it for wrong STUN/TURN server URLs. For that matter, add RTCPeerConnectionIceErrorEvent as per spec with a slight change to the init directory to keep the same terminology between event and init dictionary. Covered by updated webrtc/stun-server-filtering.html test. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::iceServersFromConfiguration): (WebCore::iceServersFromConfiguration): Deleted. * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/RTCPeerConnectionIceErrorEvent.cpp: Added. (WebCore::RTCPeerConnectionIceErrorEvent::create): (WebCore::RTCPeerConnectionIceErrorEvent::RTCPeerConnectionIceErrorEvent): (WebCore::RTCPeerConnectionIceErrorEvent::eventInterface const): * Modules/mediastream/RTCPeerConnectionIceErrorEvent.h: Added. * Modules/mediastream/RTCPeerConnectionIceErrorEvent.idl: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * dom/EventNames.h: * dom/EventNames.in: LayoutTests: * webrtc/rtcpeerconnection-error-messages-expected.txt: * webrtc/stun-server-filtering.html: Canonical link: https://commits.webkit.org/231814@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270101 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-20 11:05:32 +00:00
promise_test(async (test) => {
let pc = new RTCPeerConnection({iceServers:[{username: 'test', credential: 'test', urls:['turn:foo.com', 'turn:blabla.local']}]});
Add support for RTCPeerConnection.onicecandidateerror event https://bugs.webkit.org/show_bug.cgi?id=169644 Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/webrtc/idlharness.https.window-expected.txt: Source/WebCore: Expose RTCPeerConnection.onicecandidateerror and use it for wrong STUN/TURN server URLs. For that matter, add RTCPeerConnectionIceErrorEvent as per spec with a slight change to the init directory to keep the same terminology between event and init dictionary. Covered by updated webrtc/stun-server-filtering.html test. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::iceServersFromConfiguration): (WebCore::iceServersFromConfiguration): Deleted. * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/RTCPeerConnectionIceErrorEvent.cpp: Added. (WebCore::RTCPeerConnectionIceErrorEvent::create): (WebCore::RTCPeerConnectionIceErrorEvent::RTCPeerConnectionIceErrorEvent): (WebCore::RTCPeerConnectionIceErrorEvent::eventInterface const): * Modules/mediastream/RTCPeerConnectionIceErrorEvent.h: Added. * Modules/mediastream/RTCPeerConnectionIceErrorEvent.idl: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * dom/EventNames.h: * dom/EventNames.in: LayoutTests: * webrtc/rtcpeerconnection-error-messages-expected.txt: * webrtc/stun-server-filtering.html: Canonical link: https://commits.webkit.org/231814@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270101 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-20 11:05:32 +00:00
let promise = new Promise(resolve => pc.onicecandidateerror = resolve);
let configuration = pc.getConfiguration();
assert_equals(configuration.iceServers[0].urls.length, 1);
assert_equals(configuration.iceServers[0].urls[0], 'turn:foo.com');
Add support for RTCPeerConnection.onicecandidateerror event https://bugs.webkit.org/show_bug.cgi?id=169644 Reviewed by Alex Christensen. LayoutTests/imported/w3c: * web-platform-tests/webrtc/idlharness.https.window-expected.txt: Source/WebCore: Expose RTCPeerConnection.onicecandidateerror and use it for wrong STUN/TURN server URLs. For that matter, add RTCPeerConnectionIceErrorEvent as per spec with a slight change to the init directory to keep the same terminology between event and init dictionary. Covered by updated webrtc/stun-server-filtering.html test. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::iceServersFromConfiguration): (WebCore::iceServersFromConfiguration): Deleted. * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/RTCPeerConnectionIceErrorEvent.cpp: Added. (WebCore::RTCPeerConnectionIceErrorEvent::create): (WebCore::RTCPeerConnectionIceErrorEvent::RTCPeerConnectionIceErrorEvent): (WebCore::RTCPeerConnectionIceErrorEvent::eventInterface const): * Modules/mediastream/RTCPeerConnectionIceErrorEvent.h: Added. * Modules/mediastream/RTCPeerConnectionIceErrorEvent.idl: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * dom/EventNames.h: * dom/EventNames.in: LayoutTests: * webrtc/rtcpeerconnection-error-messages-expected.txt: * webrtc/stun-server-filtering.html: Canonical link: https://commits.webkit.org/231814@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270101 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-20 11:05:32 +00:00
const event = await promise;
assert_equals(event.url, 'turn:blabla.local');
assert_equals(event.errorCode, 701);
}, "RTCPeerConnection and local TURN server");
test(() => {
let string509 = '';
for (let cptr = 0; cptr < 509; ++cptr)
string509 += 'a';
new RTCPeerConnection({iceServers:[{username: 'test', credential: string509, urls:['turn:foo.com']}]});
new RTCPeerConnection({iceServers:[{username: string509, credential: 'test', urls:['turn:foo.com']}]});
let string510 = string509 + 'a';
assert_throws(new TypeError, () => new RTCPeerConnection({iceServers:[{username: 'test', credential: string510, urls:['turn:foo.com']}]}));
assert_throws(new TypeError, () => new RTCPeerConnection({iceServers:[{username: string510, credential: 'test', urls:['turn:foo.com']}]}));
}, "RTCPeerConnection and big TURN username/credential");
</script>