 Chromium Code Reviews
 Chromium Code Reviews Issue 2622413005:
  Replace use of ASSERT in test code.  (Closed)
    
  
    Issue 2622413005:
  Replace use of ASSERT in test code.  (Closed) 
  | Index: webrtc/p2p/base/dtlstransportchannel_unittest.cc | 
| diff --git a/webrtc/p2p/base/dtlstransportchannel_unittest.cc b/webrtc/p2p/base/dtlstransportchannel_unittest.cc | 
| index bff2e7da5d27ff18285a402d1f65c78a0a54ea0a..de9c9ed4aa46df6db98fc91df8915e54faef0f5f 100644 | 
| --- a/webrtc/p2p/base/dtlstransportchannel_unittest.cc | 
| +++ b/webrtc/p2p/base/dtlstransportchannel_unittest.cc | 
| @@ -14,6 +14,7 @@ | 
| #include "webrtc/p2p/base/dtlstransportchannel.h" | 
| #include "webrtc/p2p/base/faketransportcontroller.h" | 
| #include "webrtc/p2p/base/packettransportinterface.h" | 
| +#include "webrtc/base/checks.h" | 
| #include "webrtc/base/common.h" | 
| #include "webrtc/base/dscp.h" | 
| #include "webrtc/base/gunit.h" | 
| @@ -78,7 +79,7 @@ class DtlsTestClient : public sigslot::has_slots<> { | 
| return certificate_; | 
| } | 
| void SetupSrtp() { | 
| - ASSERT(certificate_); | 
| + RTC_CHECK(certificate_); | 
| use_dtls_srtp_ = true; | 
| } | 
| void SetupMaxProtocolVersion(rtc::SSLProtocolVersion version) { | 
| @@ -300,7 +301,7 @@ class DtlsTestClient : public sigslot::has_slots<> { | 
| } | 
| void SendPackets(size_t channel, size_t size, size_t count, bool srtp) { | 
| - ASSERT(channel < channels_.size()); | 
| + RTC_CHECK(channel < channels_.size()); | 
| 
kwiberg-webrtc
2017/01/17 09:39:25
Since ASSERT_* is used elsewhere in this function,
 
nisse-webrtc
2017/01/17 12:19:21
I'm a bit puzzled. I can use ASSERT_TRUE and ASSER
 
kwiberg-webrtc
2017/01/17 13:52:47
Yes, on failure ASSERT_* will set some flag and re
 
nisse-webrtc
2017/01/17 15:00:03
What do you suggest that I do? 
For the old (and
 
kwiberg-webrtc
2017/01/18 09:40:35
My inclination for cases where ASSERT seems like t
 
nisse-webrtc
2017/01/18 12:12:31
For the channel < channels_.size(), RTC_CHECK then
 
kwiberg-webrtc
2017/01/18 12:35:33
Acknowledged.
 | 
| std::unique_ptr<char[]> packet(new char[size]); | 
| size_t sent = 0; | 
| do { | 
| @@ -324,7 +325,7 @@ class DtlsTestClient : public sigslot::has_slots<> { | 
| } | 
| int SendInvalidSrtpPacket(size_t channel, size_t size) { | 
| - ASSERT(channel < channels_.size()); | 
| + RTC_CHECK(channel < channels_.size()); | 
| std::unique_ptr<char[]> packet(new char[size]); | 
| // Fill the packet with 0 to form an invalid SRTP packet. | 
| memset(packet.get(), 0, size); |