| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../http/tests/inspector/resources/inspector-test.js"></script> |
| <script> |
| |
| if (window.internals) |
| window.internals.setICECandidateFiltering(true); |
| |
| function createDataChannel() { |
| let receivedCandidate = false; |
| |
| let dc = null; |
| |
| let pc = new RTCPeerConnection; |
| pc.onicecandidate = (event) => { |
| if (event.candidate) { |
| if (!receivedCandidate) |
| TestPage.addResult("PASS: received ICE candidate."); |
| receivedCandidate = true; |
| return; |
| } |
| |
| TestPage.dispatchEventToFrontend("DataChannel", {success: !!receivedCandidate}); |
| |
| delete pc.onicecandidate; |
| pc.close(); |
| dc.close(); |
| }; |
| |
| TestPage.addResult("Creating data channel..."); |
| dc = pc.createDataChannel("sendDataChannel"); |
| |
| pc.createOffer() |
| .then((offer) => { |
| TestPage.addResult("PASS: created offer"); |
| return pc.setLocalDescription(offer); |
| }) |
| .catch((error) => { |
| TestPage.addResult("FAIL: " + error); |
| }); |
| } |
| |
| function test() |
| { |
| let suite = InspectorTest.createAsyncSuite("Page.overrideSetting"); |
| |
| suite.addTestCase({ |
| name: "Page.overrideSetting.ICECandidateFilteringEnabled", |
| description: "Test that changing whether ice candidate filtering is enabled has an effect.", |
| async test() { |
| InspectorTest.log("Overriding ICECandidateFilteringEnabled to false..."); |
| await PageAgent.overrideSetting(InspectorBackend.Enum.Page.Setting.ICECandidateFilteringEnabled, false); |
| |
| let [overriddenResult] = await Promise.all([ |
| InspectorTest.awaitEvent("DataChannel"), |
| InspectorTest.evaluateInPage(`createDataChannel()`), |
| ]) |
| InspectorTest.expectThat(overriddenResult.data.success, "Should be able to establish a connection when filtering ice candidates."); |
| }, |
| }); |
| |
| suite.runTestCasesAndFinish(); |
| } |
| |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>Tests for the Page.overrideSetting command.</p> |
| </body> |
| </html> |