Revert "Replace the usage of MetricsObserverInterface by RTC_HISTOGRAM_*."
This reverts commit 870bca1f418a1abf445169a638a61f9a649d557f. Reason for revert: it breaks internal tests and builds Original change's description: > Replace the usage of MetricsObserverInterface by RTC_HISTOGRAM_*. > > We now use RTC_HISTOGRAM_* macros in system_wrappers/include/metrics.h > to report the metrics in pc/ and p2p/ that are currently been reported > using MetricsObserverInterface. > > TBR=tommi@webrtc.org > > Bug: webrtc:9409 > Change-Id: I47c9975402293c72250203fa1ec19eb1668766f6 > Reviewed-on: https://webrtc-review.googlesource.com/83782 > Commit-Queue: Qingsi Wang <qingsi@google.com> > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > Reviewed-by: Taylor (left Google) <deadbeef@webrtc.org> > Reviewed-by: Steve Anton <steveanton@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#23914} TBR=steveanton@webrtc.org,deadbeef@webrtc.org,hta@webrtc.org,tommi@webrtc.org Change-Id: I1afd92d44f3b8cf3ae9aa6e6daa9a3a272e8097f No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:9409 Reviewed-on: https://webrtc-review.googlesource.com/88040 Reviewed-by: Qingsi Wang <qingsi@webrtc.org> Commit-Queue: Qingsi Wang <qingsi@google.com> Cr-Commit-Position: refs/heads/master@{#23916}
This commit is contained in:
@ -13,21 +13,20 @@
|
||||
#include <string>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "api/fakemetricsobserver.h"
|
||||
#include "media/base/fakertp.h"
|
||||
#include "pc/srtptestutil.h"
|
||||
#include "rtc_base/gunit.h"
|
||||
#include "rtc_base/sslstreamadapter.h" // For rtc::SRTP_*
|
||||
#include "system_wrappers/include/metrics_default.h"
|
||||
#include "third_party/libsrtp/include/srtp.h"
|
||||
|
||||
namespace rtc {
|
||||
|
||||
using webrtc::FakeMetricsObserver;
|
||||
|
||||
std::vector<int> kEncryptedHeaderExtensionIds;
|
||||
|
||||
class SrtpSessionTest : public testing::Test {
|
||||
public:
|
||||
SrtpSessionTest() { webrtc::metrics::Reset(); }
|
||||
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
rtp_len_ = sizeof(kPcmuFrame);
|
||||
@ -137,6 +136,9 @@ TEST_F(SrtpSessionTest, TestGetSendStreamPacketIndex) {
|
||||
|
||||
// Test that we fail to unprotect if someone tampers with the RTP/RTCP paylaods.
|
||||
TEST_F(SrtpSessionTest, TestTamperReject) {
|
||||
rtc::scoped_refptr<FakeMetricsObserver> metrics_observer(
|
||||
new rtc::RefCountedObject<FakeMetricsObserver>());
|
||||
s2_.SetMetricsObserver(metrics_observer);
|
||||
int out_len;
|
||||
EXPECT_TRUE(s1_.SetSend(SRTP_AES128_CM_SHA1_80, kTestKey1, kTestKeyLen,
|
||||
kEncryptedHeaderExtensionIds));
|
||||
@ -147,38 +149,29 @@ TEST_F(SrtpSessionTest, TestTamperReject) {
|
||||
rtp_packet_[0] = 0x12;
|
||||
rtcp_packet_[1] = 0x34;
|
||||
EXPECT_FALSE(s2_.UnprotectRtp(rtp_packet_, rtp_len_, &out_len));
|
||||
EXPECT_EQ(1, webrtc::metrics::NumSamples(
|
||||
"WebRTC.PeerConnection.SrtpUnprotectError"));
|
||||
EXPECT_EQ(
|
||||
1, webrtc::metrics::NumEvents("WebRTC.PeerConnection.SrtpUnprotectError",
|
||||
srtp_err_status_bad_param));
|
||||
EXPECT_TRUE(metrics_observer->ExpectOnlySingleEnumCount(
|
||||
webrtc::kEnumCounterSrtpUnprotectError, srtp_err_status_bad_param));
|
||||
EXPECT_FALSE(s2_.UnprotectRtcp(rtcp_packet_, rtcp_len_, &out_len));
|
||||
EXPECT_EQ(1, webrtc::metrics::NumSamples(
|
||||
"WebRTC.PeerConnection.SrtcpUnprotectError"));
|
||||
EXPECT_EQ(
|
||||
1, webrtc::metrics::NumEvents("WebRTC.PeerConnection.SrtcpUnprotectError",
|
||||
srtp_err_status_auth_fail));
|
||||
EXPECT_TRUE(metrics_observer->ExpectOnlySingleEnumCount(
|
||||
webrtc::kEnumCounterSrtcpUnprotectError, srtp_err_status_auth_fail));
|
||||
}
|
||||
|
||||
// Test that we fail to unprotect if the payloads are not authenticated.
|
||||
TEST_F(SrtpSessionTest, TestUnencryptReject) {
|
||||
rtc::scoped_refptr<FakeMetricsObserver> metrics_observer(
|
||||
new rtc::RefCountedObject<FakeMetricsObserver>());
|
||||
s2_.SetMetricsObserver(metrics_observer);
|
||||
int out_len;
|
||||
EXPECT_TRUE(s1_.SetSend(SRTP_AES128_CM_SHA1_80, kTestKey1, kTestKeyLen,
|
||||
kEncryptedHeaderExtensionIds));
|
||||
EXPECT_TRUE(s2_.SetRecv(SRTP_AES128_CM_SHA1_80, kTestKey1, kTestKeyLen,
|
||||
kEncryptedHeaderExtensionIds));
|
||||
EXPECT_FALSE(s2_.UnprotectRtp(rtp_packet_, rtp_len_, &out_len));
|
||||
EXPECT_EQ(1, webrtc::metrics::NumSamples(
|
||||
"WebRTC.PeerConnection.SrtpUnprotectError"));
|
||||
EXPECT_EQ(
|
||||
1, webrtc::metrics::NumEvents("WebRTC.PeerConnection.SrtpUnprotectError",
|
||||
srtp_err_status_auth_fail));
|
||||
EXPECT_TRUE(metrics_observer->ExpectOnlySingleEnumCount(
|
||||
webrtc::kEnumCounterSrtpUnprotectError, srtp_err_status_auth_fail));
|
||||
EXPECT_FALSE(s2_.UnprotectRtcp(rtcp_packet_, rtcp_len_, &out_len));
|
||||
EXPECT_EQ(1, webrtc::metrics::NumSamples(
|
||||
"WebRTC.PeerConnection.SrtcpUnprotectError"));
|
||||
EXPECT_EQ(
|
||||
1, webrtc::metrics::NumEvents("WebRTC.PeerConnection.SrtcpUnprotectError",
|
||||
srtp_err_status_cant_check));
|
||||
EXPECT_TRUE(metrics_observer->ExpectOnlySingleEnumCount(
|
||||
webrtc::kEnumCounterSrtcpUnprotectError, srtp_err_status_cant_check));
|
||||
}
|
||||
|
||||
// Test that we fail when using buffers that are too small.
|
||||
|
Reference in New Issue
Block a user