OLD | NEW |
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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/basictypes.h" | 6 #include "base/basictypes.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "media/audio/audio_manager.h" | 9 #include "media/audio/audio_manager.h" |
10 #include "media/audio/fake_audio_output_stream.h" | 10 #include "media/audio/fake_audio_output_stream.h" |
11 #include "media/audio/simple_sources.h" | 11 #include "media/audio/simple_sources.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace media { | |
15 | |
16 static void GenerateRandomData(char* buffer, uint32 len) { | 14 static void GenerateRandomData(char* buffer, uint32 len) { |
17 static bool called = false; | 15 static bool called = false; |
18 if (!called) { | 16 if (!called) { |
19 called = true; | 17 called = true; |
20 int seed = static_cast<int>(base::Time::Now().ToInternalValue()); | 18 int seed = static_cast<int>(base::Time::Now().ToInternalValue()); |
21 srand(seed); | 19 srand(seed); |
22 VLOG(1) << "Random seed: " << seed; | 20 VLOG(1) << "Random seed: " << seed; |
23 } | 21 } |
24 | 22 |
25 for (uint32 i = 0; i < len; i++) | 23 for (uint32 i = 0; i < len; i++) |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 EXPECT_EQ(5126, last_buffer[1]); | 92 EXPECT_EQ(5126, last_buffer[1]); |
95 EXPECT_TRUE(last_buffer[1] < last_buffer[2]); | 93 EXPECT_TRUE(last_buffer[1] < last_buffer[2]); |
96 EXPECT_TRUE(last_buffer[2] < last_buffer[3]); | 94 EXPECT_TRUE(last_buffer[2] < last_buffer[3]); |
97 // Spot test negative incursion of sine wave. | 95 // Spot test negative incursion of sine wave. |
98 EXPECT_EQ(0, last_buffer[half_period]); | 96 EXPECT_EQ(0, last_buffer[half_period]); |
99 EXPECT_EQ(-5126, last_buffer[half_period + 1]); | 97 EXPECT_EQ(-5126, last_buffer[half_period + 1]); |
100 EXPECT_TRUE(last_buffer[half_period + 1] > last_buffer[half_period + 2]); | 98 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]); | 99 EXPECT_TRUE(last_buffer[half_period + 2] > last_buffer[half_period + 3]); |
102 oas->Close(); | 100 oas->Close(); |
103 } | 101 } |
104 | |
105 } // namespace media | |
OLD | NEW |