Remove SignalDataChannelTransportChannelClosed_s

This removes one sigslot and also simplifies the teardown procedure
of a data channel when the channel is closed by the transport.
In this case we no longer need an additional async teardown task that
releases the last remaining reference to the channel.

Bug: webrtc:11943, webrtc:11547
Change-Id: I1c170349a6cbb3cb3c5a47d284e3a3d416c92b11
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/296981
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39551}
diff --git a/pc/data_channel_unittest.cc b/pc/data_channel_unittest.cc
index 973c694..529cb6b 100644
--- a/pc/data_channel_unittest.cc
+++ b/pc/data_channel_unittest.cc
@@ -162,20 +162,21 @@
 
 // Tests the state of the data channel.
 TEST_F(SctpDataChannelTest, StateTransition) {
+  AddObserver();
+
   EXPECT_EQ(DataChannelInterface::kConnecting, webrtc_data_channel_->state());
-  EXPECT_EQ(controller_->channels_opened(), 0);
-  EXPECT_EQ(controller_->channels_closed(), 0);
+  EXPECT_EQ(observer_->on_state_change_count(), 0u);
   SetChannelReady();
 
   EXPECT_EQ(DataChannelInterface::kOpen, webrtc_data_channel_->state());
-  EXPECT_EQ(controller_->channels_opened(), 1);
-  EXPECT_EQ(controller_->channels_closed(), 0);
+  EXPECT_EQ(observer_->on_state_change_count(), 1u);
 
+  // `Close()` should trigger two state changes, first `kClosing`, then
+  // `kClose`.
   webrtc_data_channel_->Close();
   EXPECT_EQ(DataChannelInterface::kClosed, webrtc_data_channel_->state());
+  EXPECT_EQ(observer_->on_state_change_count(), 3u);
   EXPECT_TRUE(webrtc_data_channel_->error().ok());
-  EXPECT_EQ(controller_->channels_opened(), 1);
-  EXPECT_EQ(controller_->channels_closed(), 1);
   // Verifies that it's disconnected from the transport.
   EXPECT_FALSE(controller_->IsConnected(webrtc_data_channel_.get()));
 }