OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/rand_util.h" | 7 #include "base/rand_util.h" |
8 #include "base/test/simple_test_tick_clock.h" | 8 #include "base/test/simple_test_tick_clock.h" |
9 #include "base/time/tick_clock.h" | 9 #include "base/time/tick_clock.h" |
10 #include "media/cast/cast_environment.h" | 10 #include "media/cast/cast_environment.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 it = stats_map.find(StatsEventSubscriber::NUM_FRAMES_CAPTURED); | 125 it = stats_map.find(StatsEventSubscriber::NUM_FRAMES_CAPTURED); |
126 ASSERT_TRUE(it != stats_map.end()); | 126 ASSERT_TRUE(it != stats_map.end()); |
127 | 127 |
128 EXPECT_DOUBLE_EQ(it->second, static_cast<double>(num_frames)); | 128 EXPECT_DOUBLE_EQ(it->second, static_cast<double>(num_frames)); |
129 | 129 |
130 it = stats_map.find(StatsEventSubscriber::NUM_FRAMES_DROPPED_BY_ENCODER); | 130 it = stats_map.find(StatsEventSubscriber::NUM_FRAMES_DROPPED_BY_ENCODER); |
131 ASSERT_TRUE(it != stats_map.end()); | 131 ASSERT_TRUE(it != stats_map.end()); |
132 | 132 |
133 EXPECT_DOUBLE_EQ(it->second, static_cast<double>(dropped_frames)); | 133 EXPECT_DOUBLE_EQ(it->second, static_cast<double>(dropped_frames)); |
| 134 |
| 135 it = stats_map.find(StatsEventSubscriber::DURATION_MS); |
| 136 ASSERT_TRUE(it != stats_map.end()); |
| 137 |
| 138 EXPECT_DOUBLE_EQ(it->second, (end_time - start_time).InMillisecondsF()); |
134 } | 139 } |
135 | 140 |
136 TEST_F(StatsEventSubscriberTest, Encode) { | 141 TEST_F(StatsEventSubscriberTest, Encode) { |
137 Init(VIDEO_EVENT); | 142 Init(VIDEO_EVENT); |
138 | 143 |
139 uint32 rtp_timestamp = 0; | 144 uint32 rtp_timestamp = 0; |
140 uint32 frame_id = 0; | 145 uint32 frame_id = 0; |
141 int num_frames = 10; | 146 int num_frames = 10; |
142 base::TimeTicks start_time = sender_clock_->NowTicks(); | 147 base::TimeTicks start_time = sender_clock_->NowTicks(); |
143 int total_size = 0; | 148 int total_size = 0; |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 EXPECT_DOUBLE_EQ(it->second, static_cast<double>(num_packets_retransmitted)); | 464 EXPECT_DOUBLE_EQ(it->second, static_cast<double>(num_packets_retransmitted)); |
460 | 465 |
461 it = stats_map.find(StatsEventSubscriber::NUM_PACKETS_RTX_REJECTED); | 466 it = stats_map.find(StatsEventSubscriber::NUM_PACKETS_RTX_REJECTED); |
462 ASSERT_TRUE(it != stats_map.end()); | 467 ASSERT_TRUE(it != stats_map.end()); |
463 | 468 |
464 EXPECT_DOUBLE_EQ(it->second, static_cast<double>(num_packets_rtx_rejected)); | 469 EXPECT_DOUBLE_EQ(it->second, static_cast<double>(num_packets_rtx_rejected)); |
465 } | 470 } |
466 | 471 |
467 } // namespace cast | 472 } // namespace cast |
468 } // namespace media | 473 } // namespace media |
OLD | NEW |