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

Side by Side Diff: media/cast/net/rtp/receiver_stats_unittest.cc

Issue 1178423008: Provision to start base::SimpleTestTickClock at initial ticks Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « media/cast/net/rtp/framer_unittest.cc ('k') | media/cast/net/rtp/rtp_packetizer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <gtest/gtest.h> 5 #include <gtest/gtest.h>
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/test/simple_test_tick_clock.h" 10 #include "base/test/simple_test_tick_clock.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "media/cast/net/rtp/receiver_stats.h" 12 #include "media/cast/net/rtp/receiver_stats.h"
13 #include "media/cast/net/rtp/rtp_defines.h" 13 #include "media/cast/net/rtp/rtp_defines.h"
14 14
15 namespace media { 15 namespace media {
16 namespace cast { 16 namespace cast {
17 17
18 static const int64_t kStartMillisecond = INT64_C(12345678900000); 18 static const int64_t kStartMillisecond = INT64_C(12345678900000);
19 static const uint32_t kStdTimeIncrementMs = 33; 19 static const uint32_t kStdTimeIncrementMs = 33;
20 20
21 class ReceiverStatsTest : public ::testing::Test { 21 class ReceiverStatsTest : public ::testing::Test {
22 protected: 22 protected:
23 ReceiverStatsTest() 23 ReceiverStatsTest()
24 : stats_(&testing_clock_) { 24 : stats_(&testing_clock_),
25 testing_clock_.Advance( 25 testing_clock_(base::TimeTicks() +
26 base::TimeDelta::FromMilliseconds(kStartMillisecond)); 26 base::TimeDelta::FromMilliseconds(kStartMillisecond)) {
27 start_time_ = testing_clock_.NowTicks(); 27 start_time_ = testing_clock_.NowTicks();
28 delta_increments_ = base::TimeDelta::FromMilliseconds(kStdTimeIncrementMs); 28 delta_increments_ = base::TimeDelta::FromMilliseconds(kStdTimeIncrementMs);
29 } 29 }
30 ~ReceiverStatsTest() override {} 30 ~ReceiverStatsTest() override {}
31 31
32 uint32_t ExpectedJitter(uint32_t const_interval, int num_packets) { 32 uint32_t ExpectedJitter(uint32_t const_interval, int num_packets) {
33 float jitter = 0; 33 float jitter = 0;
34 // Assume timestamps have a constant kStdTimeIncrementMs interval. 34 // Assume timestamps have a constant kStdTimeIncrementMs interval.
35 float float_interval = 35 float float_interval =
36 static_cast<float>(const_interval - kStdTimeIncrementMs); 36 static_cast<float>(const_interval - kStdTimeIncrementMs);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 EXPECT_FALSE(s.cumulative_lost); 145 EXPECT_FALSE(s.cumulative_lost);
146 // Build extended sequence number (one wrap cycle). 146 // Build extended sequence number (one wrap cycle).
147 const uint32_t extended_seq_num = rtp_header_.sequence_number - 1; 147 const uint32_t extended_seq_num = rtp_header_.sequence_number - 1;
148 EXPECT_EQ(extended_seq_num, s.extended_high_sequence_number); 148 EXPECT_EQ(extended_seq_num, s.extended_high_sequence_number);
149 EXPECT_EQ(ExpectedJitter(kStdTimeIncrementMs + kAdditionalIncrement, 300), 149 EXPECT_EQ(ExpectedJitter(kStdTimeIncrementMs + kAdditionalIncrement, 300),
150 s.jitter); 150 s.jitter);
151 } 151 }
152 152
153 } // namespace cast 153 } // namespace cast
154 } // namespace media 154 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/net/rtp/framer_unittest.cc ('k') | media/cast/net/rtp/rtp_packetizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698