RTCIceCandidateStats.deleted = false added.

Since previously, only the deleted = false case is supported, but now
that stat is added. It's a recent addition to the spec:
https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatestats-deleted

BUG=webrtc:6756, chromium:632723, chromium:627816

Review-Url: https://codereview.webrtc.org/2591963003
Cr-Commit-Position: refs/heads/master@{#15871}
This commit is contained in:
hbos
2017-01-02 08:09:59 -08:00
committed by Commit bot
parent 06495bcbb7
commit d17a5a7709
4 changed files with 17 additions and 3 deletions

View File

@ -397,6 +397,7 @@ class RTCStatsReportVerifier {
verifier.TestMemberIsDefined(candidate.candidate_type); verifier.TestMemberIsDefined(candidate.candidate_type);
verifier.TestMemberIsNonNegative<int32_t>(candidate.priority); verifier.TestMemberIsNonNegative<int32_t>(candidate.priority);
verifier.TestMemberIsUndefined(candidate.url); verifier.TestMemberIsUndefined(candidate.url);
verifier.TestMemberIsDefined(candidate.deleted);
return verifier.ExpectAllMembersSuccessfullyTested(); return verifier.ExpectAllMembersSuccessfullyTested();
} }

View File

@ -923,6 +923,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) {
expected_a_remote_srflx.protocol = "remote_srflx's protocol"; expected_a_remote_srflx.protocol = "remote_srflx's protocol";
expected_a_remote_srflx.candidate_type = "srflx"; expected_a_remote_srflx.candidate_type = "srflx";
expected_a_remote_srflx.priority = 1; expected_a_remote_srflx.priority = 1;
expected_a_remote_srflx.deleted = false;
EXPECT_TRUE(*expected_a_remote_srflx.is_remote); EXPECT_TRUE(*expected_a_remote_srflx.is_remote);
std::unique_ptr<cricket::Candidate> a_local_prflx = CreateFakeCandidate( std::unique_ptr<cricket::Candidate> a_local_prflx = CreateFakeCandidate(
@ -937,6 +938,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) {
expected_a_local_prflx.protocol = "a_local_prflx's protocol"; expected_a_local_prflx.protocol = "a_local_prflx's protocol";
expected_a_local_prflx.candidate_type = "prflx"; expected_a_local_prflx.candidate_type = "prflx";
expected_a_local_prflx.priority = 2; expected_a_local_prflx.priority = 2;
expected_a_local_prflx.deleted = false;
EXPECT_FALSE(*expected_a_local_prflx.is_remote); EXPECT_FALSE(*expected_a_local_prflx.is_remote);
std::unique_ptr<cricket::Candidate> a_remote_relay = CreateFakeCandidate( std::unique_ptr<cricket::Candidate> a_remote_relay = CreateFakeCandidate(
@ -951,6 +953,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) {
expected_a_remote_relay.protocol = "a_remote_relay's protocol"; expected_a_remote_relay.protocol = "a_remote_relay's protocol";
expected_a_remote_relay.candidate_type = "relay"; expected_a_remote_relay.candidate_type = "relay";
expected_a_remote_relay.priority = 3; expected_a_remote_relay.priority = 3;
expected_a_remote_relay.deleted = false;
EXPECT_TRUE(*expected_a_remote_relay.is_remote); EXPECT_TRUE(*expected_a_remote_relay.is_remote);
// Candidates in the second transport stats. // Candidates in the second transport stats.
@ -966,6 +969,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) {
expected_b_local.protocol = "b_local's protocol"; expected_b_local.protocol = "b_local's protocol";
expected_b_local.candidate_type = "host"; expected_b_local.candidate_type = "host";
expected_b_local.priority = 42; expected_b_local.priority = 42;
expected_b_local.deleted = false;
EXPECT_FALSE(*expected_b_local.is_remote); EXPECT_FALSE(*expected_b_local.is_remote);
std::unique_ptr<cricket::Candidate> b_remote = CreateFakeCandidate( std::unique_ptr<cricket::Candidate> b_remote = CreateFakeCandidate(
@ -980,6 +984,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) {
expected_b_remote.protocol = "b_remote's protocol"; expected_b_remote.protocol = "b_remote's protocol";
expected_b_remote.candidate_type = "host"; expected_b_remote.candidate_type = "host";
expected_b_remote.priority = 42; expected_b_remote.priority = 42;
expected_b_remote.deleted = false;
EXPECT_TRUE(*expected_b_remote.is_remote); EXPECT_TRUE(*expected_b_remote.is_remote);
SessionStats session_stats; SessionStats session_stats;
@ -1118,6 +1123,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidatePairStats) {
expected_local_candidate.protocol = "protocol"; expected_local_candidate.protocol = "protocol";
expected_local_candidate.candidate_type = "host"; expected_local_candidate.candidate_type = "host";
expected_local_candidate.priority = 42; expected_local_candidate.priority = 42;
expected_local_candidate.deleted = false;
EXPECT_FALSE(*expected_local_candidate.is_remote); EXPECT_FALSE(*expected_local_candidate.is_remote);
ASSERT_TRUE(report->Get(expected_local_candidate.id())); ASSERT_TRUE(report->Get(expected_local_candidate.id()));
EXPECT_EQ(expected_local_candidate, EXPECT_EQ(expected_local_candidate,
@ -1131,6 +1137,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidatePairStats) {
expected_remote_candidate.protocol = "protocol"; expected_remote_candidate.protocol = "protocol";
expected_remote_candidate.candidate_type = "host"; expected_remote_candidate.candidate_type = "host";
expected_remote_candidate.priority = 42; expected_remote_candidate.priority = 42;
expected_remote_candidate.deleted = false;
EXPECT_TRUE(*expected_remote_candidate.is_remote); EXPECT_TRUE(*expected_remote_candidate.is_remote);
ASSERT_TRUE(report->Get(expected_remote_candidate.id())); ASSERT_TRUE(report->Get(expected_remote_candidate.id()));
EXPECT_EQ(expected_remote_candidate, EXPECT_EQ(expected_remote_candidate,

View File

@ -176,6 +176,9 @@ class RTCIceCandidateStats : public RTCStats {
RTCStatsMember<int32_t> priority; RTCStatsMember<int32_t> priority;
// TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/632723 // TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/632723
RTCStatsMember<std::string> url; RTCStatsMember<std::string> url;
// TODO(hbos): |deleted = true| case is not supported by |RTCStatsCollector|.
// crbug.com/632723
RTCStatsMember<bool> deleted; // = false
protected: protected:
RTCIceCandidateStats( RTCIceCandidateStats(

View File

@ -242,7 +242,8 @@ WEBRTC_RTCSTATS_IMPL(RTCIceCandidateStats, RTCStats, "ice-candidate",
&protocol, &protocol,
&candidate_type, &candidate_type,
&priority, &priority,
&url); &url,
&deleted);
RTCIceCandidateStats::RTCIceCandidateStats( RTCIceCandidateStats::RTCIceCandidateStats(
const std::string& id, int64_t timestamp_us, bool is_remote) const std::string& id, int64_t timestamp_us, bool is_remote)
@ -258,7 +259,8 @@ RTCIceCandidateStats::RTCIceCandidateStats(
protocol("protocol"), protocol("protocol"),
candidate_type("candidateType"), candidate_type("candidateType"),
priority("priority"), priority("priority"),
url("url") { url("url"),
deleted("deleted", false) {
} }
RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other) RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other)
@ -269,7 +271,8 @@ RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other)
protocol(other.protocol), protocol(other.protocol),
candidate_type(other.candidate_type), candidate_type(other.candidate_type),
priority(other.priority), priority(other.priority),
url(other.url) { url(other.url),
deleted(other.deleted) {
} }
RTCIceCandidateStats::~RTCIceCandidateStats() { RTCIceCandidateStats::~RTCIceCandidateStats() {