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

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

Issue 1130753005: Get audio_unittests passing with h/w on windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | media/audio/audio_manager.cc » ('j') | media/audio/audio_manager.cc » ('J')
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 <cmath> 5 #include <cmath>
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "media/audio/audio_io.h" 9 #include "media/audio/audio_io.h"
10 #include "media/audio/audio_manager_base.h" 10 #include "media/audio/audio_manager_base.h"
(...skipping 20 matching lines...) Expand all
31 31
32 // Sleep 100ms to wait for the operation. 32 // Sleep 100ms to wait for the operation.
33 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); 33 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100));
34 } 34 }
35 35
36 return volume; 36 return volume;
37 } 37 }
38 38
39 class AudioInputVolumeTest : public ::testing::Test { 39 class AudioInputVolumeTest : public ::testing::Test {
40 protected: 40 protected:
41 AudioInputVolumeTest() 41 AudioInputVolumeTest() : audio_manager_(AudioManager::CreateForTesting()) {}
42 : audio_manager_(AudioManager::CreateForTesting())
43 #if defined(OS_WIN)
44 , com_init_(base::win::ScopedCOMInitializer::kMTA)
45 #endif
46 {
47 }
48 42
49 bool HasCoreAudioAndInputDevices() { 43 bool HasCoreAudioAndInputDevices() {
50 #if defined(OS_WIN) 44 #if defined(OS_WIN)
51 // TODO(henrika): add support for volume control on Windows XP as well. 45 // TODO(henrika): add support for volume control on Windows XP as well.
52 if (!CoreAudioUtil::IsSupported()) 46 if (!CoreAudioUtil::IsSupported())
53 return false; 47 return false;
54 #endif 48 #endif
55 return audio_manager_->HasAudioInputDevices(); 49 return audio_manager_->HasAudioInputDevices();
56 } 50 }
57 51
(...skipping 22 matching lines...) Expand all
80 ais = NULL; 74 ais = NULL;
81 } 75 }
82 #elif defined(OS_WIN) || defined(OS_MACOSX) 76 #elif defined(OS_WIN) || defined(OS_MACOSX)
83 EXPECT_TRUE(ais->Open()); 77 EXPECT_TRUE(ais->Open());
84 #endif 78 #endif
85 79
86 return ais; 80 return ais;
87 } 81 }
88 82
89 scoped_ptr<AudioManager> audio_manager_; 83 scoped_ptr<AudioManager> audio_manager_;
90
91 #if defined(OS_WIN)
92 base::win::ScopedCOMInitializer com_init_;
93 #endif
94 }; 84 };
95 85
96 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 86 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
97 // Currently failing on linux ARM bot: http://crbug/238490 87 // Currently failing on linux ARM bot: http://crbug/238490
98 // Also flaky on x86_64: http://crbug/236936 88 // Also flaky on x86_64: http://crbug/236936
99 #define MAYBE_InputVolumeTest DISABLED_InputVolumeTest 89 #define MAYBE_InputVolumeTest DISABLED_InputVolumeTest
100 #else 90 #else
101 #define MAYBE_InputVolumeTest InputVolumeTest 91 #define MAYBE_InputVolumeTest InputVolumeTest
102 #endif 92 #endif
103 93
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // Restores the volume to the original value. 161 // Restores the volume to the original value.
172 ais->SetVolume(original_volume); 162 ais->SetVolume(original_volume);
173 current_volume = ais->GetVolume(); 163 current_volume = ais->GetVolume();
174 EXPECT_EQ(original_volume, current_volume); 164 EXPECT_EQ(original_volume, current_volume);
175 165
176 ais->Close(); 166 ais->Close();
177 } 167 }
178 } 168 }
179 169
180 } // namespace media 170 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/audio/audio_manager.cc » ('j') | media/audio/audio_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698