Renamed dtlstransportchannel.h/.cc/_unittest.cc.

Renamed the dtlstransportchannel.h/.cc to dtlstransport.h/.cc which are
the right names for those files because the concept of DtlsTransportChannel
no longer exists.

BUG=None

Review-Url: https://codereview.webrtc.org/3004503002
Cr-Original-Commit-Position: refs/heads/master@{#19478}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: ca6d3b60b521184a9c641162cf3dfad2dd0ff9e9
diff --git a/p2p/BUILD.gn b/p2p/BUILD.gn
index 16b8762..588f6bd 100644
--- a/p2p/BUILD.gn
+++ b/p2p/BUILD.gn
@@ -27,8 +27,8 @@
     "base/basicpacketsocketfactory.h",
     "base/candidate.h",
     "base/common.h",
-    "base/dtlstransportchannel.cc",
-    "base/dtlstransportchannel.h",
+    "base/dtlstransport.cc",
+    "base/dtlstransport.h",
     "base/dtlstransportinternal.h",
     "base/icetransportinternal.h",
     "base/jseptransport.cc",
@@ -174,7 +174,7 @@
     }
     sources = [
       "base/asyncstuntcpsocket_unittest.cc",
-      "base/dtlstransportchannel_unittest.cc",
+      "base/dtlstransport_unittest.cc",
       "base/jseptransport_unittest.cc",
       "base/p2ptransportchannel_unittest.cc",
       "base/packetlossestimator_unittest.cc",
diff --git a/p2p/base/dtlstransportchannel.cc b/p2p/base/dtlstransport.cc
similarity index 97%
rename from p2p/base/dtlstransportchannel.cc
rename to p2p/base/dtlstransport.cc
index 08dfb6b..5f32a9b 100644
--- a/p2p/base/dtlstransportchannel.cc
+++ b/p2p/base/dtlstransport.cc
@@ -8,10 +8,11 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include <algorithm>
 #include <memory>
 #include <utility>
 
-#include "webrtc/p2p/base/dtlstransportchannel.h"
+#include "webrtc/p2p/base/dtlstransport.h"
 
 #include "webrtc/p2p/base/common.h"
 #include "webrtc/p2p/base/packettransportinternal.h"
@@ -62,9 +63,9 @@
       packets_(kMaxPendingPackets, kMaxDtlsPacketLen) {}
 
 rtc::StreamResult StreamInterfaceChannel::Read(void* buffer,
-                                                     size_t buffer_len,
-                                                     size_t* read,
-                                                     int* error) {
+                                               size_t buffer_len,
+                                               size_t* read,
+                                               int* error) {
   if (state_ == rtc::SS_CLOSED)
     return rtc::SR_EOS;
   if (state_ == rtc::SS_OPENING)
@@ -78,9 +79,9 @@
 }
 
 rtc::StreamResult StreamInterfaceChannel::Write(const void* data,
-                                                      size_t data_len,
-                                                      size_t* written,
-                                                      int* error) {
+                                                size_t data_len,
+                                                size_t* written,
+                                                int* error) {
   // Always succeeds, since this is an unreliable transport anyway.
   // TODO(zhihuang): Should this block if ice_transport_'s temporarily
   // unwritable?
@@ -329,7 +330,6 @@
   return dtls_->GetDtlsSrtpCryptoSuite(cipher);
 }
 
-
 // Called from upper layers to send a media packet.
 int DtlsTransport::SendPacket(const char* data,
                               size_t size,
@@ -671,8 +671,7 @@
     // Limit the timeout to a reasonable range in case the ICE RTT takes
     // extreme values.
     int initial_timeout = std::max(kMinHandshakeTimeout,
-                                   std::min(kMaxHandshakeTimeout,
-                                            2 * (*rtt)));
+                                   std::min(kMaxHandshakeTimeout, 2 * (*rtt)));
     LOG_J(LS_INFO, this) << "configuring DTLS handshake timeout "
                          << initial_timeout << " based on ICE RTT " << *rtt;
 
@@ -683,5 +682,4 @@
   }
 }
 
-
 }  // namespace cricket
diff --git a/p2p/base/dtlstransportchannel.h b/p2p/base/dtlstransport.h
similarity index 94%
rename from p2p/base/dtlstransportchannel.h
rename to p2p/base/dtlstransport.h
index 12b94ce..4c0432c 100644
--- a/p2p/base/dtlstransportchannel.h
+++ b/p2p/base/dtlstransport.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_
-#define WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_
+#ifndef WEBRTC_P2P_BASE_DTLSTRANSPORT_H_
+#define WEBRTC_P2P_BASE_DTLSTRANSPORT_H_
 
 #include <memory>
 #include <string>
@@ -58,7 +58,6 @@
   RTC_DISALLOW_COPY_AND_ASSIGN(StreamInterfaceChannel);
 };
 
-
 // This class provides a DTLS SSLStreamAdapter inside a TransportChannel-style
 // packet-based interface, wrapping an existing TransportChannel instance
 // (e.g a P2PTransportChannel)
@@ -116,7 +115,6 @@
                             const uint8_t* digest,
                             size_t digest_len) override;
 
-
   // Called to send a packet (via DTLS, if turned on).
   int SendPacket(const char* data,
                  size_t size,
@@ -152,11 +150,10 @@
                             bool use_context,
                             uint8_t* result,
                             size_t result_len) override {
-    return (dtls_.get()) ? dtls_->ExportKeyingMaterial(label, context,
-                                                       context_len,
-                                                       use_context,
-                                                       result, result_len)
-        : false;
+    return (dtls_.get())
+               ? dtls_->ExportKeyingMaterial(label, context, context_len,
+                                             use_context, result, result_len)
+               : false;
   }
 
   IceTransportInternal* ice_transport() override { return ice_transport_; }
@@ -217,7 +214,7 @@
   std::unique_ptr<rtc::SSLStreamAdapter> dtls_;  // The DTLS stream
   StreamInterfaceChannel*
       downward_;  // Wrapper for ice_transport_, owned by dtls_.
-  std::vector<int> srtp_ciphers_;     // SRTP ciphers to use with DTLS.
+  std::vector<int> srtp_ciphers_;  // SRTP ciphers to use with DTLS.
   bool dtls_active_ = false;
   rtc::scoped_refptr<rtc::RTCCertificate> local_certificate_;
   rtc::SSLRole ssl_role_;
@@ -239,4 +236,4 @@
 
 }  // namespace cricket
 
-#endif  // WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_
+#endif  // WEBRTC_P2P_BASE_DTLSTRANSPORT_H_
diff --git a/p2p/base/dtlstransportchannel_unittest.cc b/p2p/base/dtlstransport_unittest.cc
similarity index 96%
rename from p2p/base/dtlstransportchannel_unittest.cc
rename to p2p/base/dtlstransport_unittest.cc
index e5e7a6d..adad443 100644
--- a/p2p/base/dtlstransportchannel_unittest.cc
+++ b/p2p/base/dtlstransport_unittest.cc
@@ -8,10 +8,11 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include <algorithm>
 #include <memory>
 #include <set>
 
-#include "webrtc/p2p/base/dtlstransportchannel.h"
+#include "webrtc/p2p/base/dtlstransport.h"
 #include "webrtc/p2p/base/fakeicetransport.h"
 #include "webrtc/p2p/base/packettransportinternal.h"
 #include "webrtc/rtc_base/checks.h"
@@ -68,7 +69,7 @@
 // configuration directly instead of negotiating TransportDescriptions.
 class DtlsTestClient : public sigslot::has_slots<> {
  public:
-  DtlsTestClient(const std::string& name) : name_(name) {}
+  explicit DtlsTestClient(const std::string& name) : name_(name) {}
   void CreateCertificate(rtc::KeyType key_type) {
     certificate_ =
         rtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>(
@@ -134,8 +135,10 @@
 
   // Offer DTLS if we have an identity; pass in a remote fingerprint only if
   // both sides support DTLS.
-  void Negotiate(DtlsTestClient* peer, cricket::ContentAction action,
-                 ConnectionRole local_role, ConnectionRole remote_role,
+  void Negotiate(DtlsTestClient* peer,
+                 cricket::ContentAction action,
+                 ConnectionRole local_role,
+                 ConnectionRole remote_role,
                  int flags) {
     Negotiate(certificate_, certificate_ ? peer->certificate_ : nullptr, action,
               local_role, remote_role, flags);
@@ -319,9 +322,7 @@
     received_.clear();
   }
 
-  size_t NumPacketsReceived() {
-    return received_.size();
-  }
+  size_t NumPacketsReceived() { return received_.size(); }
 
   bool VerifyPacket(const char* data, size_t size, uint32_t* out_num) {
     if (size != packet_size_ ||
@@ -501,14 +502,16 @@
       rtc::SSLRole client1_ssl_role =
           (client1_role == cricket::CONNECTIONROLE_ACTIVE ||
            (client2_role == cricket::CONNECTIONROLE_PASSIVE &&
-            client1_role == cricket::CONNECTIONROLE_ACTPASS)) ?
-              rtc::SSL_CLIENT : rtc::SSL_SERVER;
+            client1_role == cricket::CONNECTIONROLE_ACTPASS))
+              ? rtc::SSL_CLIENT
+              : rtc::SSL_SERVER;
 
       rtc::SSLRole client2_ssl_role =
           (client2_role == cricket::CONNECTIONROLE_ACTIVE ||
            (client1_role == cricket::CONNECTIONROLE_PASSIVE &&
-            client2_role == cricket::CONNECTIONROLE_ACTPASS)) ?
-              rtc::SSL_CLIENT : rtc::SSL_SERVER;
+            client2_role == cricket::CONNECTIONROLE_ACTPASS))
+              ? rtc::SSL_CLIENT
+              : rtc::SSL_SERVER;
 
       client1_.CheckRole(client1_ssl_role);
       client2_.CheckRole(client2_ssl_role);
@@ -546,10 +549,10 @@
     client1_.SetupChannels(channel_ct_, cricket::ICEROLE_CONTROLLING);
     client2_.SetupChannels(channel_ct_, cricket::ICEROLE_CONTROLLED);
     // Expect success from SLTD and SRTD.
-    client1_.Negotiate(&client2_, cricket::CA_OFFER,
-                       client1_role, client2_role, 0);
-    client2_.Negotiate(&client1_, cricket::CA_ANSWER,
-                       client2_role, client1_role, 0);
+    client1_.Negotiate(&client2_, cricket::CA_OFFER, client1_role, client2_role,
+                       0);
+    client2_.Negotiate(&client1_, cricket::CA_ANSWER, client2_role,
+                       client1_role, 0);
   }
 
   // Negotiate with legacy client |client2|. Legacy client doesn't use setup
@@ -567,18 +570,19 @@
   }
 
   void Renegotiate(DtlsTestClient* reoffer_initiator,
-                   ConnectionRole client1_role, ConnectionRole client2_role,
+                   ConnectionRole client1_role,
+                   ConnectionRole client2_role,
                    int flags) {
     if (reoffer_initiator == &client1_) {
-      client1_.Negotiate(&client2_, cricket::CA_OFFER,
-                         client1_role, client2_role, flags);
-      client2_.Negotiate(&client1_, cricket::CA_ANSWER,
-                         client2_role, client1_role, flags);
+      client1_.Negotiate(&client2_, cricket::CA_OFFER, client1_role,
+                         client2_role, flags);
+      client2_.Negotiate(&client1_, cricket::CA_ANSWER, client2_role,
+                         client1_role, flags);
     } else {
-      client2_.Negotiate(&client1_, cricket::CA_OFFER,
-                         client2_role, client1_role, flags);
-      client1_.Negotiate(&client2_, cricket::CA_ANSWER,
-                         client1_role, client2_role, flags);
+      client2_.Negotiate(&client1_, cricket::CA_OFFER, client2_role,
+                         client1_role, flags);
+      client1_.Negotiate(&client2_, cricket::CA_ANSWER, client1_role,
+                         client2_role, flags);
     }
   }
 
@@ -802,8 +806,8 @@
   SetChannelCount(2);
   PrepareDtls(true, true, rtc::KT_DEFAULT);
   // Initial role for client1 is ACTPASS and client2 is ACTIVE.
-  ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS,
-                      cricket::CONNECTIONROLE_ACTIVE));
+  ASSERT_TRUE(
+      Connect(cricket::CONNECTIONROLE_ACTPASS, cricket::CONNECTIONROLE_ACTIVE));
   TestTransfer(0, 1000, 100, true);
   TestTransfer(1, 1000, 100, true);
   // Using input roles for the re-offer.
@@ -817,8 +821,8 @@
   SetChannelCount(2);
   PrepareDtls(true, true, rtc::KT_DEFAULT);
   // Initial role for client1 is ACTPASS and client2 is ACTIVE.
-  ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS,
-                      cricket::CONNECTIONROLE_ACTIVE));
+  ASSERT_TRUE(
+      Connect(cricket::CONNECTIONROLE_ACTPASS, cricket::CONNECTIONROLE_ACTIVE));
   TestTransfer(0, 1000, 100, true);
   TestTransfer(1, 1000, 100, true);
   // Using input roles for the re-offer.
@@ -837,8 +841,7 @@
 
   // Renegotiate from client2 with actpass and client1 as active.
   Renegotiate(&client2_, cricket::CONNECTIONROLE_ACTPASS,
-              cricket::CONNECTIONROLE_ACTIVE,
-              NF_REOFFER | NF_EXPECT_FAILURE);
+              cricket::CONNECTIONROLE_ACTIVE, NF_REOFFER | NF_EXPECT_FAILURE);
 }
 
 // Test that using different setup attributes which results in similar ssl
diff --git a/p2p/base/jseptransport.cc b/p2p/base/jseptransport.cc
index a8f4564..191d34f 100644
--- a/p2p/base/jseptransport.cc
+++ b/p2p/base/jseptransport.cc
@@ -14,7 +14,7 @@
 #include <utility>  // for std::pair
 
 #include "webrtc/p2p/base/candidate.h"
-#include "webrtc/p2p/base/dtlstransportchannel.h"
+#include "webrtc/p2p/base/dtlstransport.h"
 #include "webrtc/p2p/base/p2pconstants.h"
 #include "webrtc/p2p/base/p2ptransportchannel.h"
 #include "webrtc/p2p/base/port.h"
diff --git a/p2p/base/transportcontroller.h b/p2p/base/transportcontroller.h
index f16e893..108800e 100644
--- a/p2p/base/transportcontroller.h
+++ b/p2p/base/transportcontroller.h
@@ -17,7 +17,7 @@
 #include <vector>
 
 #include "webrtc/p2p/base/candidate.h"
-#include "webrtc/p2p/base/dtlstransportchannel.h"
+#include "webrtc/p2p/base/dtlstransport.h"
 #include "webrtc/p2p/base/jseptransport.h"
 #include "webrtc/p2p/base/p2ptransportchannel.h"
 #include "webrtc/rtc_base/asyncinvoker.h"
diff --git a/p2p/base/transportcontroller_unittest.cc b/p2p/base/transportcontroller_unittest.cc
index 8a2d298..9352f15 100644
--- a/p2p/base/transportcontroller_unittest.cc
+++ b/p2p/base/transportcontroller_unittest.cc
@@ -11,7 +11,7 @@
 #include <map>
 #include <memory>
 
-#include "webrtc/p2p/base/dtlstransportchannel.h"
+#include "webrtc/p2p/base/dtlstransport.h"
 #include "webrtc/p2p/base/fakeportallocator.h"
 #include "webrtc/p2p/base/faketransportcontroller.h"
 #include "webrtc/p2p/base/p2ptransportchannel.h"