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

Side by Side Diff: media/base/audio_timestamp_helper_unittest.cc

Issue 2158923004: Convert media constants to constexpr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "media/base/audio_timestamp_helper.h" 9 #include "media/base/audio_timestamp_helper.h"
10 #include "media/base/timestamp_constants.h" 10 #include "media/base/timestamp_constants.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 EXPECT_EQ(0, AddFrames(0)); 55 EXPECT_EQ(0, AddFrames(0));
56 EXPECT_EQ(22, AddFrames(1)); 56 EXPECT_EQ(22, AddFrames(1));
57 EXPECT_EQ(45, AddFrames(1)); 57 EXPECT_EQ(45, AddFrames(1));
58 EXPECT_EQ(68, AddFrames(1)); 58 EXPECT_EQ(68, AddFrames(1));
59 EXPECT_EQ(90, AddFrames(1)); 59 EXPECT_EQ(90, AddFrames(1));
60 EXPECT_EQ(113, AddFrames(1)); 60 EXPECT_EQ(113, AddFrames(1));
61 61
62 // Verify that adding frames one frame at a time matches the timestamp 62 // Verify that adding frames one frame at a time matches the timestamp
63 // returned if the same number of frames are added all at once. 63 // returned if the same number of frames are added all at once.
64 base::TimeDelta timestamp_1 = helper_.GetTimestamp(); 64 base::TimeDelta timestamp_1 = helper_.GetTimestamp();
65 helper_.SetBaseTimestamp(kNoTimestamp()); 65 helper_.SetBaseTimestamp(kNoTimestamp);
66 EXPECT_TRUE(kNoTimestamp() == helper_.base_timestamp()); 66 EXPECT_TRUE(kNoTimestamp == helper_.base_timestamp());
67 helper_.SetBaseTimestamp(base::TimeDelta()); 67 helper_.SetBaseTimestamp(base::TimeDelta());
68 EXPECT_EQ(0, helper_.GetTimestamp().InMicroseconds()); 68 EXPECT_EQ(0, helper_.GetTimestamp().InMicroseconds());
69 69
70 helper_.AddFrames(5); 70 helper_.AddFrames(5);
71 EXPECT_EQ(113, helper_.GetTimestamp().InMicroseconds()); 71 EXPECT_EQ(113, helper_.GetTimestamp().InMicroseconds());
72 EXPECT_TRUE(timestamp_1 == helper_.GetTimestamp()); 72 EXPECT_TRUE(timestamp_1 == helper_.GetTimestamp());
73 } 73 }
74 74
75 75
76 TEST_F(AudioTimestampHelperTest, GetDuration) { 76 TEST_F(AudioTimestampHelperTest, GetDuration) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // tested above to verify that the code is rounding properly. 117 // tested above to verify that the code is rounding properly.
118 TestGetFramesToTargetRange(0, 103, 124); 118 TestGetFramesToTargetRange(0, 103, 124);
119 TestGetFramesToTargetRange(-1, 80, 102); 119 TestGetFramesToTargetRange(-1, 80, 102);
120 TestGetFramesToTargetRange(-2, 57, 79); 120 TestGetFramesToTargetRange(-2, 57, 79);
121 TestGetFramesToTargetRange(-3, 35, 56); 121 TestGetFramesToTargetRange(-3, 35, 56);
122 TestGetFramesToTargetRange(-4, 12, 34); 122 TestGetFramesToTargetRange(-4, 12, 34);
123 TestGetFramesToTargetRange(-5, 0, 11); 123 TestGetFramesToTargetRange(-5, 0, 11);
124 } 124 }
125 125
126 } // namespace media 126 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698