RTCDataChannel: Ignore "id" when "negotiated" is false
This updates behavior to be aligned with the WebRTC spec.
Bug: chromium:948055
Change-Id: Id3bbf05b3df084c9b7f7d12598c09187679d60fc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/130493
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27394}
diff --git a/pc/peer_connection_interface_unittest.cc b/pc/peer_connection_interface_unittest.cc
index 90c5208..371cdc1 100644
--- a/pc/peer_connection_interface_unittest.cc
+++ b/pc/peer_connection_interface_unittest.cc
@@ -2141,6 +2141,7 @@
rtc::scoped_refptr<DataChannelInterface> channel;
config.id = 1;
+ config.negotiated = true;
channel = pc_->CreateDataChannel("1", &config);
EXPECT_TRUE(channel != NULL);
EXPECT_EQ(1, channel->id());
@@ -2149,11 +2150,13 @@
EXPECT_TRUE(channel == NULL);
config.id = cricket::kMaxSctpSid;
+ config.negotiated = true;
channel = pc_->CreateDataChannel("max", &config);
EXPECT_TRUE(channel != NULL);
EXPECT_EQ(config.id, channel->id());
config.id = cricket::kMaxSctpSid + 1;
+ config.negotiated = true;
channel = pc_->CreateDataChannel("x", &config);
EXPECT_TRUE(channel == NULL);
}