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

Side by Side Diff: media/audio/win/audio_low_latency_output_win_unittest.cc

Issue 8949015: Allow the AudioLowLatencyInputOutput tests to run on bots where audio hardware is available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Add the win input/output tests as well Created 9 years 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/win/audio_low_latency_input_win_unittest.cc ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <windows.h> 5 #include <windows.h>
6 #include <mmsystem.h> 6 #include <mmsystem.h>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 int file_size_; 136 int file_size_;
137 int pos_; 137 int pos_;
138 base::Time previous_call_time_; 138 base::Time previous_call_time_;
139 FILE* text_file_; 139 FILE* text_file_;
140 size_t elements_to_write_; 140 size_t elements_to_write_;
141 }; 141 };
142 142
143 // Convenience method which ensures that we are not running on the build 143 // Convenience method which ensures that we are not running on the build
144 // bots and that at least one valid output device can be found. 144 // bots and that at least one valid output device can be found.
145 static bool CanRunAudioTests(AudioManager* audio_man) { 145 static bool CanRunAudioTests(AudioManager* audio_man) {
146 if (NULL == audio_man)
147 return false;
148
149 scoped_ptr<base::Environment> env(base::Environment::Create());
150 if (env->HasVar("CHROME_HEADLESS"))
151 return false;
152 // TODO(henrika): note that we use Wave today to query the number of 146 // TODO(henrika): note that we use Wave today to query the number of
153 // existing output devices. 147 // existing output devices.
154 return audio_man->HasAudioOutputDevices(); 148 bool output = audio_man->HasAudioOutputDevices();
149 LOG_IF(WARNING, !output) << "No output devices detected.";
150 return output;
155 } 151 }
156 152
157 // Convenience method which creates a default AudioOutputStream object but 153 // Convenience method which creates a default AudioOutputStream object but
158 // also allows the user to modify the default settings. 154 // also allows the user to modify the default settings.
159 class AudioOutputStreamWrapper { 155 class AudioOutputStreamWrapper {
160 public: 156 public:
161 explicit AudioOutputStreamWrapper(AudioManager* audio_manager) 157 explicit AudioOutputStreamWrapper(AudioManager* audio_manager)
162 : com_init_(ScopedCOMInitializer::kMTA), 158 : com_init_(ScopedCOMInitializer::kMTA),
163 audio_man_(audio_manager), 159 audio_man_(audio_manager),
164 format_(AudioParameters::AUDIO_PCM_LOW_LATENCY), 160 format_(AudioParameters::AUDIO_PCM_LOW_LATENCY),
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 532
537 aos->Start(&file_source); 533 aos->Start(&file_source);
538 base::PlatformThread::Sleep(file_duration_ms); 534 base::PlatformThread::Sleep(file_duration_ms);
539 aos->Stop(); 535 aos->Stop();
540 536
541 LOG(INFO) << ">> File playout has stopped."; 537 LOG(INFO) << ">> File playout has stopped.";
542 aos->Close(); 538 aos->Close();
543 } 539 }
544 540
545 } // namespace media 541 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/win/audio_low_latency_input_win_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698