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

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

Issue 12611030: Remove unused parameter to OnError() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits + rebase Created 7 years, 9 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
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 <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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); 61 loop->PostTask(FROM_HERE, MessageLoop::QuitClosure());
62 } 62 }
63 63
64 class MockAudioSourceCallback : public AudioOutputStream::AudioSourceCallback { 64 class MockAudioSourceCallback : public AudioOutputStream::AudioSourceCallback {
65 public: 65 public:
66 MOCK_METHOD2(OnMoreData, int(AudioBus* audio_bus, 66 MOCK_METHOD2(OnMoreData, int(AudioBus* audio_bus,
67 AudioBuffersState buffers_state)); 67 AudioBuffersState buffers_state));
68 MOCK_METHOD3(OnMoreIOData, int(AudioBus* source, 68 MOCK_METHOD3(OnMoreIOData, int(AudioBus* source,
69 AudioBus* dest, 69 AudioBus* dest,
70 AudioBuffersState buffers_state)); 70 AudioBuffersState buffers_state));
71 MOCK_METHOD2(OnError, void(AudioOutputStream* stream, int code)); 71 MOCK_METHOD1(OnError, void(AudioOutputStream* stream));
72 }; 72 };
73 73
74 // This audio source implementation should be used for manual tests only since 74 // This audio source implementation should be used for manual tests only since
75 // it takes about 20 seconds to play out a file. 75 // it takes about 20 seconds to play out a file.
76 class ReadFromFileAudioSource : public AudioOutputStream::AudioSourceCallback { 76 class ReadFromFileAudioSource : public AudioOutputStream::AudioSourceCallback {
77 public: 77 public:
78 explicit ReadFromFileAudioSource(const std::string& name) 78 explicit ReadFromFileAudioSource(const std::string& name)
79 : pos_(0), 79 : pos_(0),
80 previous_call_time_(base::Time::Now()), 80 previous_call_time_(base::Time::Now()),
81 text_file_(NULL), 81 text_file_(NULL),
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 return frames; 139 return frames;
140 } 140 }
141 141
142 virtual int OnMoreIOData(AudioBus* source, 142 virtual int OnMoreIOData(AudioBus* source,
143 AudioBus* dest, 143 AudioBus* dest,
144 AudioBuffersState buffers_state) OVERRIDE { 144 AudioBuffersState buffers_state) OVERRIDE {
145 NOTREACHED(); 145 NOTREACHED();
146 return 0; 146 return 0;
147 } 147 }
148 148
149 virtual void OnError(AudioOutputStream* stream, int code) {} 149 virtual void OnError(AudioOutputStream* stream) {}
150 150
151 int file_size() { return file_->GetDataSize(); } 151 int file_size() { return file_->GetDataSize(); }
152 152
153 private: 153 private:
154 scoped_refptr<DecoderBuffer> file_; 154 scoped_refptr<DecoderBuffer> file_;
155 scoped_array<int> delta_times_; 155 scoped_array<int> delta_times_;
156 int pos_; 156 int pos_;
157 base::Time previous_call_time_; 157 base::Time previous_call_time_;
158 FILE* text_file_; 158 FILE* text_file_;
159 size_t elements_to_write_; 159 size_t elements_to_write_;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 290 }
291 291
292 // Test Open(), Start(), Close() calling sequence. 292 // Test Open(), Start(), Close() calling sequence.
293 TEST(WASAPIAudioOutputStreamTest, OpenStartAndClose) { 293 TEST(WASAPIAudioOutputStreamTest, OpenStartAndClose) {
294 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); 294 scoped_ptr<AudioManager> audio_manager(AudioManager::Create());
295 if (!CanRunAudioTests(audio_manager.get())) 295 if (!CanRunAudioTests(audio_manager.get()))
296 return; 296 return;
297 AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get()); 297 AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get());
298 EXPECT_TRUE(aos->Open()); 298 EXPECT_TRUE(aos->Open());
299 MockAudioSourceCallback source; 299 MockAudioSourceCallback source;
300 EXPECT_CALL(source, OnError(aos, _)) 300 EXPECT_CALL(source, OnError(aos))
301 .Times(0); 301 .Times(0);
302 aos->Start(&source); 302 aos->Start(&source);
303 aos->Close(); 303 aos->Close();
304 } 304 }
305 305
306 // Test Open(), Start(), Stop(), Close() calling sequence. 306 // Test Open(), Start(), Stop(), Close() calling sequence.
307 TEST(WASAPIAudioOutputStreamTest, OpenStartStopAndClose) { 307 TEST(WASAPIAudioOutputStreamTest, OpenStartStopAndClose) {
308 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); 308 scoped_ptr<AudioManager> audio_manager(AudioManager::Create());
309 if (!CanRunAudioTests(audio_manager.get())) 309 if (!CanRunAudioTests(audio_manager.get()))
310 return; 310 return;
311 AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get()); 311 AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get());
312 EXPECT_TRUE(aos->Open()); 312 EXPECT_TRUE(aos->Open());
313 MockAudioSourceCallback source; 313 MockAudioSourceCallback source;
314 EXPECT_CALL(source, OnError(aos, _)) 314 EXPECT_CALL(source, OnError(aos))
315 .Times(0); 315 .Times(0);
316 aos->Start(&source); 316 aos->Start(&source);
317 aos->Stop(); 317 aos->Stop();
318 aos->Close(); 318 aos->Close();
319 } 319 }
320 320
321 // Test SetVolume(), GetVolume() 321 // Test SetVolume(), GetVolume()
322 TEST(WASAPIAudioOutputStreamTest, Volume) { 322 TEST(WASAPIAudioOutputStreamTest, Volume) {
323 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); 323 scoped_ptr<AudioManager> audio_manager(AudioManager::Create());
324 if (!CanRunAudioTests(audio_manager.get())) 324 if (!CanRunAudioTests(audio_manager.get()))
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 692
693 aos->Start(&source); 693 aos->Start(&source);
694 loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), 694 loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(),
695 TestTimeouts::action_timeout()); 695 TestTimeouts::action_timeout());
696 loop.Run(); 696 loop.Run();
697 aos->Stop(); 697 aos->Stop();
698 aos->Close(); 698 aos->Close();
699 } 699 }
700 700
701 } // namespace media 701 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/win/audio_low_latency_output_win.cc ('k') | media/audio/win/audio_output_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698