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

Unified Diff: talk/app/webrtc/statscollector_unittest.cc

Issue 1204493002: Set / verify stats report timestamps. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 6 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 | « talk/app/webrtc/statscollector.cc ('k') | talk/app/webrtc/test/mockpeerconnectionobservers.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/statscollector_unittest.cc
diff --git a/talk/app/webrtc/statscollector_unittest.cc b/talk/app/webrtc/statscollector_unittest.cc
index ed035acba4d2b4c2a1d6b459c5a3fda47e4ce0e9..315366ceca333d9779af5d35d88fb2504420c5f2 100644
--- a/talk/app/webrtc/statscollector_unittest.cc
+++ b/talk/app/webrtc/statscollector_unittest.cc
@@ -597,6 +597,7 @@ class StatsCollectorTest : public testing::Test {
const StatsReport* report = FindNthReportByType(
*reports, StatsReport::kStatsReportTypeSsrc, 1);
EXPECT_FALSE(report == NULL);
+ EXPECT_EQ(stats->GetTimeNow(), report->timestamp());
std::string track_id = ExtractSsrcStatsValue(
*reports, StatsReport::kStatsValueNameTrackId);
EXPECT_EQ(audio_track->id(), track_id);
@@ -619,6 +620,7 @@ class StatsCollectorTest : public testing::Test {
const StatsReport* track_report = FindNthReportByType(
track_reports, StatsReport::kStatsReportTypeSsrc, 1);
EXPECT_TRUE(track_report);
+ EXPECT_EQ(stats->GetTimeNow(), track_report->timestamp());
track_id = ExtractSsrcStatsValue(track_reports,
StatsReport::kStatsValueNameTrackId);
EXPECT_EQ(audio_track->id(), track_id);
@@ -929,6 +931,7 @@ TEST_F(StatsCollectorTest, TrackObjectExistsWithoutUpdateStats) {
stats.GetStats(NULL, &reports);
EXPECT_EQ((size_t)1, reports.size());
EXPECT_EQ(StatsReport::kStatsReportTypeTrack, reports[0]->type());
+ EXPECT_EQ(0, reports[0]->timestamp());
std::string trackValue =
ExtractStatsValue(StatsReport::kStatsReportTypeTrack,
@@ -991,6 +994,7 @@ TEST_F(StatsCollectorTest, TrackAndSsrcObjectExistAfterUpdateSsrcStats) {
track_report = FindNthReportByType(
reports, StatsReport::kStatsReportTypeTrack, 1);
EXPECT_TRUE(track_report);
+ EXPECT_EQ(stats.GetTimeNow(), track_report->timestamp());
std::string ssrc_id = ExtractSsrcStatsValue(
reports, StatsReport::kStatsValueNameSsrc);
@@ -1179,6 +1183,7 @@ TEST_F(StatsCollectorTest, ReportsFromRemoteTrack) {
const StatsReport* track_report = FindNthReportByType(
reports, StatsReport::kStatsReportTypeTrack, 1);
EXPECT_TRUE(track_report);
+ EXPECT_EQ(stats.GetTimeNow(), track_report->timestamp());
std::string ssrc_id = ExtractSsrcStatsValue(
reports, StatsReport::kStatsValueNameSsrc);
@@ -1553,6 +1558,7 @@ TEST_F(StatsCollectorTest, GetStatsAfterRemoveAudioStream) {
const StatsReport* report = FindNthReportByType(
reports, StatsReport::kStatsReportTypeSsrc, 1);
EXPECT_FALSE(report == NULL);
+ EXPECT_EQ(stats.GetTimeNow(), report->timestamp());
std::string track_id = ExtractSsrcStatsValue(
reports, StatsReport::kStatsValueNameTrackId);
EXPECT_EQ(kLocalTrackId, track_id);
@@ -1630,6 +1636,7 @@ TEST_F(StatsCollectorTest, LocalAndRemoteTracksWithSameSsrc) {
const StatsReport* track_report = FindNthReportByType(
reports, StatsReport::kStatsReportTypeSsrc, 1);
EXPECT_TRUE(track_report);
+ EXPECT_EQ(stats.GetTimeNow(), track_report->timestamp());
std::string track_id = ExtractSsrcStatsValue(
reports, StatsReport::kStatsValueNameTrackId);
EXPECT_EQ(kLocalTrackId, track_id);
@@ -1641,6 +1648,7 @@ TEST_F(StatsCollectorTest, LocalAndRemoteTracksWithSameSsrc) {
track_report = FindNthReportByType(reports,
StatsReport::kStatsReportTypeSsrc, 1);
EXPECT_TRUE(track_report);
+ EXPECT_EQ(stats.GetTimeNow(), track_report->timestamp());
track_id = ExtractSsrcStatsValue(reports,
StatsReport::kStatsValueNameTrackId);
EXPECT_EQ(kRemoteTrackId, track_id);
« no previous file with comments | « talk/app/webrtc/statscollector.cc ('k') | talk/app/webrtc/test/mockpeerconnectionobservers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698