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

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

Issue 1377273003: cast: cleanup rtp header and parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased the commits Created 5 years, 2 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
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/test/simple_test_tick_clock.h" 9 #include "base/test/simple_test_tick_clock.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "media/cast/net/rtp/receiver_stats.h" 11 #include "media/cast/net/rtp/receiver_stats.h"
12 #include "media/cast/net/rtp/rtp_receiver_defines.h" 12 #include "media/cast/net/rtp/rtp_defines.h"
13 13
14 namespace media { 14 namespace media {
15 namespace cast { 15 namespace cast {
16 16
17 static const int64 kStartMillisecond = INT64_C(12345678900000); 17 static const int64 kStartMillisecond = INT64_C(12345678900000);
18 static const uint32 kStdTimeIncrementMs = 33; 18 static const uint32 kStdTimeIncrementMs = 33;
19 19
20 class ReceiverStatsTest : public ::testing::Test { 20 class ReceiverStatsTest : public ::testing::Test {
21 protected: 21 protected:
22 ReceiverStatsTest() 22 ReceiverStatsTest()
(...skipping 15 matching lines...) Expand all
38 } 38 }
39 return static_cast<uint32>(jitter + 0.5f); 39 return static_cast<uint32>(jitter + 0.5f);
40 } 40 }
41 41
42 ReceiverStats stats_; 42 ReceiverStats stats_;
43 RtpCastHeader rtp_header_; 43 RtpCastHeader rtp_header_;
44 base::SimpleTestTickClock testing_clock_; 44 base::SimpleTestTickClock testing_clock_;
45 base::TimeTicks start_time_; 45 base::TimeTicks start_time_;
46 base::TimeDelta delta_increments_; 46 base::TimeDelta delta_increments_;
47 47
48 private:
48 DISALLOW_COPY_AND_ASSIGN(ReceiverStatsTest); 49 DISALLOW_COPY_AND_ASSIGN(ReceiverStatsTest);
49 }; 50 };
50 51
51 TEST_F(ReceiverStatsTest, ResetState) { 52 TEST_F(ReceiverStatsTest, ResetState) {
52 RtpReceiverStatistics s = stats_.GetStatistics(); 53 RtpReceiverStatistics s = stats_.GetStatistics();
53 EXPECT_EQ(0u, s.fraction_lost); 54 EXPECT_EQ(0u, s.fraction_lost);
54 EXPECT_EQ(0u, s.cumulative_lost); 55 EXPECT_EQ(0u, s.cumulative_lost);
55 EXPECT_EQ(0u, s.extended_high_sequence_number); 56 EXPECT_EQ(0u, s.extended_high_sequence_number);
56 EXPECT_EQ(0u, s.jitter); 57 EXPECT_EQ(0u, s.jitter);
57 } 58 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 EXPECT_FALSE(s.cumulative_lost); 144 EXPECT_FALSE(s.cumulative_lost);
144 // Build extended sequence number (one wrap cycle). 145 // Build extended sequence number (one wrap cycle).
145 const uint32 extended_seq_num = rtp_header_.sequence_number - 1; 146 const uint32 extended_seq_num = rtp_header_.sequence_number - 1;
146 EXPECT_EQ(extended_seq_num, s.extended_high_sequence_number); 147 EXPECT_EQ(extended_seq_num, s.extended_high_sequence_number);
147 EXPECT_EQ(ExpectedJitter(kStdTimeIncrementMs + kAdditionalIncrement, 300), 148 EXPECT_EQ(ExpectedJitter(kStdTimeIncrementMs + kAdditionalIncrement, 300),
148 s.jitter); 149 s.jitter);
149 } 150 }
150 151
151 } // namespace cast 152 } // namespace cast
152 } // namespace media 153 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698