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

Unified Diff: webrtc/modules/video_coding/codecs/test/stats_unittest.cc

Issue 2916883002: Small updates to test::Stats. (Closed)
Patch Set: Created 3 years, 7 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/modules/video_coding/codecs/test/stats.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/codecs/test/stats_unittest.cc
diff --git a/webrtc/modules/video_coding/codecs/test/stats_unittest.cc b/webrtc/modules/video_coding/codecs/test/stats_unittest.cc
index ed8525214d60ac99b034f9ae9184164bd385082b..55bdfaff91bb935062eef195c19a8960993600c7 100644
--- a/webrtc/modules/video_coding/codecs/test/stats_unittest.cc
+++ b/webrtc/modules/video_coding/codecs/test/stats_unittest.cc
@@ -16,42 +16,31 @@
namespace webrtc {
namespace test {
-class StatsTest : public testing::Test {
- protected:
- StatsTest() {}
-
- virtual ~StatsTest() {}
-
- void SetUp() { stats_ = new Stats(); }
-
- void TearDown() { delete stats_; }
-
- Stats* stats_;
-};
-
-// Test empty object
-TEST_F(StatsTest, Uninitialized) {
- EXPECT_EQ(0u, stats_->stats_.size());
- stats_->PrintSummary(); // should not crash
+TEST(StatsTest, TestEmptyObject) {
+ Stats stats;
+ EXPECT_EQ(0u, stats.stats_.size());
+ stats.PrintSummary(); // should not crash
}
-// Add single frame stats and verify
-TEST_F(StatsTest, AddOne) {
- stats_->NewFrame(0u);
- FrameStatistic* frameStat = &stats_->stats_[0];
- EXPECT_EQ(0, frameStat->frame_number);
+TEST(StatsTest, AddSingleFrame) {
+ const int kFrameNumber = 0;
+ Stats stats;
+ stats.NewFrame(kFrameNumber);
+ EXPECT_EQ(1u, stats.stats_.size());
+ FrameStatistic* frame_stat = &stats.stats_[0];
+ EXPECT_EQ(kFrameNumber, frame_stat->frame_number);
}
-// Add multiple frame stats and verify
-TEST_F(StatsTest, AddMany) {
- int nbr_of_frames = 1000;
- for (int i = 0; i < nbr_of_frames; ++i) {
- FrameStatistic& frameStat = stats_->NewFrame(i);
- EXPECT_EQ(i, frameStat.frame_number);
+TEST(StatsTest, AddMultipleFrames) {
+ Stats stats;
+ const int kNumFrames = 1000;
+ for (int i = 0; i < kNumFrames; ++i) {
+ FrameStatistic& frame_stat = stats.NewFrame(i);
+ EXPECT_EQ(i, frame_stat.frame_number);
}
- EXPECT_EQ(nbr_of_frames, static_cast<int>(stats_->stats_.size()));
+ EXPECT_EQ(kNumFrames, static_cast<int>(stats.stats_.size()));
- stats_->PrintSummary(); // should not crash
+ stats.PrintSummary(); // should not crash
}
} // namespace test
« no previous file with comments | « webrtc/modules/video_coding/codecs/test/stats.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698