Skip to content

Commit

Permalink
webrtc wpt: add WPT for RTCSessionDescription.toJSON
Browse files Browse the repository at this point in the history
BUG=chromium:1385266

Change-Id: Ie8925e208c5e23f6f48403c85fa3b8d0b30098de
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4031748
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Harald Alvestrand <hta@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1078154}
  • Loading branch information
fippo authored and pull[bot] committed Jan 5, 2024
1 parent 28beda6 commit 1305896
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion webrtc/toJSON.html
@@ -1,9 +1,29 @@
<!doctype html>
<title>WebRTC objects toJSON()</title>
<title>WebRTC objects toJSON() methods</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
'use strict';
// The tests for
// * RTCSessionDescription.toJSON()
// * RTCIceCandidate.toJSON()
// are kept in a single file since they are similar and typically
// would need to be changed together.
test(t => {
const desc = new RTCSessionDescription({
type: 'offer',
sdp: 'bogus sdp',
});
const json = desc.toJSON();

// Assert that candidates which should be serialized are present.
assert_equals(json.type, desc.type);
assert_equals(json.sdp, desc.sdp);

// Assert that no other attributes are present by checking the size.
assert_equals(Object.keys(json).length, 2);

}, 'RTCSessionDescription.toJSON serializes only specific attributes');

test(t => {
const candidate = new RTCIceCandidate({
Expand Down

0 comments on commit 1305896

Please sign in to comment.