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

Side by Side Diff: media/base/audio_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/audio_buffer_queue.h" 5 #include "media/base/audio_buffer_queue.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <memory> 10 #include <memory>
(...skipping 24 matching lines...) Expand all
35 } 35 }
36 } 36 }
37 } 37 }
38 38
39 template <typename T> 39 template <typename T>
40 static scoped_refptr<AudioBuffer> MakeTestBuffer(SampleFormat format, 40 static scoped_refptr<AudioBuffer> MakeTestBuffer(SampleFormat format,
41 ChannelLayout channel_layout, 41 ChannelLayout channel_layout,
42 T start, 42 T start,
43 T step, 43 T step,
44 int frames) { 44 int frames) {
45 return MakeAudioBuffer<T>(format, 45 return MakeAudioBuffer<T>(format, channel_layout,
46 channel_layout,
47 ChannelLayoutToChannelCount(channel_layout), 46 ChannelLayoutToChannelCount(channel_layout),
48 kSampleRate, 47 kSampleRate, start, step, frames, kNoTimestamp);
49 start,
50 step,
51 frames,
52 kNoTimestamp());
53 } 48 }
54 49
55 TEST(AudioBufferQueueTest, AppendAndClear) { 50 TEST(AudioBufferQueueTest, AppendAndClear) {
56 const ChannelLayout channel_layout = CHANNEL_LAYOUT_MONO; 51 const ChannelLayout channel_layout = CHANNEL_LAYOUT_MONO;
57 AudioBufferQueue buffer; 52 AudioBufferQueue buffer;
58 EXPECT_EQ(0, buffer.frames()); 53 EXPECT_EQ(0, buffer.frames());
59 buffer.Append( 54 buffer.Append(
60 MakeTestBuffer<uint8_t>(kSampleFormatU8, channel_layout, 10, 1, 8)); 55 MakeTestBuffer<uint8_t>(kSampleFormatU8, channel_layout, 10, 1, 8));
61 EXPECT_EQ(8, buffer.frames()); 56 EXPECT_EQ(8, buffer.frames());
62 buffer.Clear(); 57 buffer.Clear();
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 EXPECT_EQ(5, buffer.PeekFrames(5, 10, 0, bus1.get())); 344 EXPECT_EQ(5, buffer.PeekFrames(5, 10, 0, bus1.get()));
350 VerifyBus(bus1.get(), 0, 5, bus1->frames(), 40, 1); 345 VerifyBus(bus1.get(), 0, 5, bus1->frames(), 40, 1);
351 346
352 // Peek to the end of the buffer. 347 // Peek to the end of the buffer.
353 EXPECT_EQ(30, buffer.frames()); 348 EXPECT_EQ(30, buffer.frames());
354 EXPECT_EQ(30, buffer.PeekFrames(60, 0, 0, bus1.get())); 349 EXPECT_EQ(30, buffer.PeekFrames(60, 0, 0, bus1.get()));
355 EXPECT_EQ(30, buffer.PeekFrames(30, 0, 0, bus1.get())); 350 EXPECT_EQ(30, buffer.PeekFrames(30, 0, 0, bus1.get()));
356 } 351 }
357 352
358 } // namespace media 353 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698