71 lines
2.0 KiB
HTML
71 lines
2.0 KiB
HTML
<!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() {
|
|
let [overriddenResult] = await Promise.all([
|
|
InspectorTest.awaitEvent("DataChannel"),
|
|
InspectorTest.evaluateInPage(`createDataChannel()`),
|
|
PageAgent.overrideSetting(InspectorBackend.Enum.Page.Setting.ICECandidateFilteringEnabled, false),
|
|
]);
|
|
InspectorTest.expectThat(overriddenResult.data.success, "Should be able to establish a connection when filtering ice candidates.");
|
|
},
|
|
timeout: -1,
|
|
});
|
|
|
|
suite.runTestCasesAndFinish();
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
<body onload="runTest()">
|
|
<p>Tests for the Page.overrideSetting command.</p>
|
|
</body>
|
|
</html>
|