Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1081)

Unified Diff: webrtc/stats/rtcstats_unittest.cc

Issue 2278433003: RTCStatsReport: Take ownership of other's stats with TakeMembersFrom (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added comment Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/stats/BUILD.gn ('k') | webrtc/stats/rtcstatsreport.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/stats/rtcstats_unittest.cc
diff --git a/webrtc/stats/rtcstats_unittest.cc b/webrtc/stats/rtcstats_unittest.cc
index 12364aed56b1a9eadd7e50eb44fad4ec3d9f3d91..44e75c41becd23a37e04000c05e9dc679e9a4bdd 100644
--- a/webrtc/stats/rtcstats_unittest.cc
+++ b/webrtc/stats/rtcstats_unittest.cc
@@ -9,11 +9,9 @@
*/
#include "webrtc/api/rtcstats.h"
-#include "webrtc/api/rtcstatsreport.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/gunit.h"
-#include "webrtc/base/logging.h"
namespace webrtc {
@@ -165,39 +163,6 @@ TEST(RTCStatsTest, RTCStatsGrandChild) {
EXPECT_EQ(*copy.grandchild_int, *stats.grandchild_int);
}
-TEST(RTCStatsTest, TestRTCStatsReport) {
- rtc::scoped_refptr<RTCStatsReport> report = RTCStatsReport::Create();
- EXPECT_EQ(report->size(), static_cast<size_t>(0));
- report->AddStats(std::unique_ptr<RTCStats>(new RTCTestStats("a0", 1.0)));
- report->AddStats(std::unique_ptr<RTCStats>(new RTCTestStats("a1", 2.0)));
- report->AddStats(std::unique_ptr<RTCStats>(new RTCChildStats("b0", 4.0)));
- report->AddStats(std::unique_ptr<RTCStats>(new RTCChildStats("b1", 8.0)));
- report->AddStats(std::unique_ptr<RTCStats>(new RTCTestStats("a2", 16.0)));
- report->AddStats(std::unique_ptr<RTCStats>(new RTCChildStats("b2", 32.0)));
- EXPECT_EQ(report->size(), static_cast<size_t>(6));
-
- EXPECT_EQ((*report)["missing"], nullptr);
- EXPECT_EQ((*report)["a0"]->id(), "a0");
- EXPECT_EQ((*report)["b2"]->id(), "b2");
-
- std::vector<const RTCTestStats*> a = report->GetStatsOfType<RTCTestStats>();
- EXPECT_EQ(a.size(), static_cast<size_t>(3));
- uint32_t mask = 0;
- for (const RTCTestStats* stats : a)
- mask |= static_cast<uint32_t>(stats->timestamp());
- EXPECT_EQ(mask, static_cast<uint32_t>(1 | 2 | 16));
-
- std::vector<const RTCChildStats*> b = report->GetStatsOfType<RTCChildStats>();
- EXPECT_EQ(b.size(), static_cast<size_t>(3));
- mask = 0;
- for (const RTCChildStats* stats : b)
- mask |= static_cast<uint32_t>(stats->timestamp());
- EXPECT_EQ(mask, static_cast<uint32_t>(4 | 8 | 32));
-
- EXPECT_EQ(report->GetStatsOfType<RTCGrandChildStats>().size(),
- static_cast<size_t>(0));
-}
-
// Death tests.
// Disabled on Android because death tests misbehave on Android, see
// base/test/gtest_util.h.
« no previous file with comments | « webrtc/stats/BUILD.gn ('k') | webrtc/stats/rtcstatsreport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698