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

Side by Side Diff: media/audio/simple_sources_unittest.cc

Issue 10184011: Remove unused parameter "stream" from all variants of OnMoreData(). (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « media/audio/simple_sources.cc ('k') | media/audio/win/audio_low_latency_output_win.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 (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 <algorithm> // std::min
6
5 #include "base/logging.h" 7 #include "base/logging.h"
6 #include "base/basictypes.h" 8 #include "base/basictypes.h"
7 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
8 #include "base/time.h" 10 #include "base/time.h"
9 #include "media/audio/audio_manager.h" 11 #include "media/audio/audio_manager.h"
10 #include "media/audio/fake_audio_output_stream.h" 12 #include "media/audio/fake_audio_output_stream.h"
11 #include "media/audio/simple_sources.h" 13 #include "media/audio/simple_sources.h"
12 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
13 15
14 namespace media { 16 namespace media {
(...skipping 29 matching lines...) Expand all
44 // Write everything into this push source. 46 // Write everything into this push source.
45 for (uint32 i = 0; i < kDataSize; i += kWriteSize) { 47 for (uint32 i = 0; i < kDataSize; i += kWriteSize) {
46 uint32 size = std::min(kDataSize - i, kWriteSize); 48 uint32 size = std::min(kDataSize - i, kWriteSize);
47 EXPECT_TRUE(push_source.Write(data.get() + i, size)); 49 EXPECT_TRUE(push_source.Write(data.get() + i, size));
48 } 50 }
49 EXPECT_EQ(kDataSize, push_source.UnProcessedBytes()); 51 EXPECT_EQ(kDataSize, push_source.UnProcessedBytes());
50 52
51 // Read everything from the push source. 53 // Read everything from the push source.
52 for (uint32 i = 0; i < kDataSize; i += kReadSize) { 54 for (uint32 i = 0; i < kDataSize; i += kReadSize) {
53 uint32 size = std::min(kDataSize - i , kReadSize); 55 uint32 size = std::min(kDataSize - i , kReadSize);
54 EXPECT_EQ(size, push_source.OnMoreData(NULL, read_data.get(), size, 56 EXPECT_EQ(size, push_source.OnMoreData(read_data.get(), size,
55 AudioBuffersState())); 57 AudioBuffersState()));
56 EXPECT_EQ(0, memcmp(data.get() + i, read_data.get(), size)); 58 EXPECT_EQ(0, memcmp(data.get() + i, read_data.get(), size));
57 } 59 }
58 EXPECT_EQ(0u, push_source.UnProcessedBytes()); 60 EXPECT_EQ(0u, push_source.UnProcessedBytes());
59 } 61 }
60 62
61 // Validate that the SineWaveAudioSource writes the expected values for 63 // Validate that the SineWaveAudioSource writes the expected values for
62 // the FORMAT_16BIT_MONO. The values are carefully selected so rounding issues 64 // the FORMAT_16BIT_MONO. The values are carefully selected so rounding issues
63 // do not affect the result. We also test that AudioManager::GetLastMockBuffer 65 // do not affect the result. We also test that AudioManager::GetLastMockBuffer
64 // works. 66 // works.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 EXPECT_TRUE(last_buffer[2] < last_buffer[3]); 98 EXPECT_TRUE(last_buffer[2] < last_buffer[3]);
97 // Spot test negative incursion of sine wave. 99 // Spot test negative incursion of sine wave.
98 EXPECT_EQ(0, last_buffer[half_period]); 100 EXPECT_EQ(0, last_buffer[half_period]);
99 EXPECT_EQ(-5126, last_buffer[half_period + 1]); 101 EXPECT_EQ(-5126, last_buffer[half_period + 1]);
100 EXPECT_TRUE(last_buffer[half_period + 1] > last_buffer[half_period + 2]); 102 EXPECT_TRUE(last_buffer[half_period + 1] > last_buffer[half_period + 2]);
101 EXPECT_TRUE(last_buffer[half_period + 2] > last_buffer[half_period + 3]); 103 EXPECT_TRUE(last_buffer[half_period + 2] > last_buffer[half_period + 3]);
102 oas->Close(); 104 oas->Close();
103 } 105 }
104 106
105 } // namespace media 107 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/simple_sources.cc ('k') | media/audio/win/audio_low_latency_output_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698