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