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

Side by Side Diff: media/base/decoder_buffer_queue_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 "media/base/decoder_buffer.h" 5 #include "media/base/decoder_buffer.h"
6 #include "media/base/decoder_buffer_queue.h" 6 #include "media/base/decoder_buffer_queue.h"
7 #include "media/base/timestamp_constants.h" 7 #include "media/base/timestamp_constants.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace media { 10 namespace media {
11 11
12 static base::TimeDelta ToTimeDelta(int seconds) { 12 static base::TimeDelta ToTimeDelta(int seconds) {
13 if (seconds < 0) 13 if (seconds < 0)
14 return kNoTimestamp(); 14 return kNoTimestamp;
15 return base::TimeDelta::FromSeconds(seconds); 15 return base::TimeDelta::FromSeconds(seconds);
16 } 16 }
17 17
18 // Helper to create buffers with specified timestamp in seconds. 18 // Helper to create buffers with specified timestamp in seconds.
19 // 19 //
20 // Negative numbers will be converted to kNoTimestamp(); 20 // Negative numbers will be converted to kNoTimestamp;
21 static scoped_refptr<DecoderBuffer> CreateBuffer(int timestamp) { 21 static scoped_refptr<DecoderBuffer> CreateBuffer(int timestamp) {
22 scoped_refptr<DecoderBuffer> buffer = new DecoderBuffer(0); 22 scoped_refptr<DecoderBuffer> buffer = new DecoderBuffer(0);
23 buffer->set_timestamp(ToTimeDelta(timestamp)); 23 buffer->set_timestamp(ToTimeDelta(timestamp));
24 buffer->set_duration(ToTimeDelta(0)); 24 buffer->set_duration(ToTimeDelta(0));
25 return buffer; 25 return buffer;
26 } 26 }
27 27
28 static scoped_refptr<DecoderBuffer> CreateBuffer(int timestamp, int size) { 28 static scoped_refptr<DecoderBuffer> CreateBuffer(int timestamp, int size) {
29 scoped_refptr<DecoderBuffer> buffer = new DecoderBuffer(size); 29 scoped_refptr<DecoderBuffer> buffer = new DecoderBuffer(size);
30 buffer->set_timestamp(ToTimeDelta(timestamp)); 30 buffer->set_timestamp(ToTimeDelta(timestamp));
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 EXPECT_EQ(queue.data_size(), 2998u); 160 EXPECT_EQ(queue.data_size(), 2998u);
161 161
162 queue.Clear(); 162 queue.Clear();
163 EXPECT_EQ(queue.data_size(), 0u); 163 EXPECT_EQ(queue.data_size(), 0u);
164 164
165 queue.Push(CreateBuffer(4, 1400u)); 165 queue.Push(CreateBuffer(4, 1400u));
166 EXPECT_EQ(queue.data_size(), 1400u); 166 EXPECT_EQ(queue.data_size(), 1400u);
167 } 167 }
168 168
169 } // namespace media 169 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698