summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-18 23:37:51 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-18 23:37:51 +0000
commit05643d0f9575c171f13e7f30ea0f1d4520855f87 (patch)
tree8b06bb5488b99cbfc0e3e6af8b721b6627048f14
parent200c9187bd8029de9a6d4665082c7bf358c62829 (diff)
downloadchromium_src-05643d0f9575c171f13e7f30ea0f1d4520855f87.zip
chromium_src-05643d0f9575c171f13e7f30ea0f1d4520855f87.tar.gz
chromium_src-05643d0f9575c171f13e7f30ea0f1d4520855f87.tar.bz2
Remove an unused OnClose() method from AudioInputCallback.
BUG=328357 Review URL: https://codereview.chromium.org/107093010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241703 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/renderer_host/media/web_contents_audio_input_stream_unittest.cc2
-rw-r--r--media/audio/alsa/alsa_input.cc5
-rw-r--r--media/audio/android/audio_android_unittest.cc4
-rw-r--r--media/audio/android/audio_record_input.cc3
-rw-r--r--media/audio/android/opensles_input.cc9
-rw-r--r--media/audio/audio_input_controller.cc7
-rw-r--r--media/audio/audio_input_controller.h5
-rw-r--r--media/audio/audio_input_controller_unittest.cc4
-rw-r--r--media/audio/audio_input_unittest.cc1
-rw-r--r--media/audio/audio_io.h4
-rw-r--r--media/audio/audio_low_latency_input_output_unittest.cc1
-rw-r--r--media/audio/cras/cras_input.cc8
-rw-r--r--media/audio/cras/cras_input_unittest.cc3
-rw-r--r--media/audio/fake_audio_input_stream.cc6
-rw-r--r--media/audio/mac/audio_input_mac.cc8
-rw-r--r--media/audio/mac/audio_low_latency_input_mac.cc11
-rw-r--r--media/audio/mac/audio_low_latency_input_mac_unittest.cc16
-rw-r--r--media/audio/pulse/pulse_input.cc4
-rw-r--r--media/audio/virtual_audio_input_stream.cc6
-rw-r--r--media/audio/virtual_audio_input_stream_unittest.cc2
-rw-r--r--media/audio/win/audio_low_latency_input_win.cc6
-rw-r--r--media/audio/win/audio_low_latency_input_win_unittest.cc27
22 files changed, 27 insertions, 115 deletions
diff --git a/content/browser/renderer_host/media/web_contents_audio_input_stream_unittest.cc b/content/browser/renderer_host/media/web_contents_audio_input_stream_unittest.cc
index 3ce336d..4a782aa 100644
--- a/content/browser/renderer_host/media/web_contents_audio_input_stream_unittest.cc
+++ b/content/browser/renderer_host/media/web_contents_audio_input_stream_unittest.cc
@@ -164,7 +164,6 @@ class MockAudioInputCallback : public AudioInputStream::AudioInputCallback {
MOCK_METHOD5(OnData, void(AudioInputStream* stream, const uint8* src,
uint32 size, uint32 hardware_delay_bytes,
double volume));
- MOCK_METHOD1(OnClose, void(AudioInputStream* stream));
MOCK_METHOD1(OnError, void(AudioInputStream* stream));
private:
@@ -242,7 +241,6 @@ class WebContentsAudioInputStreamTest : public testing::Test {
EXPECT_CALL(mock_input_callback_, OnData(NotNull(), NotNull(), _, _, _))
.WillRepeatedly(
InvokeWithoutArgs(&on_data_event_, &base::WaitableEvent::Signal));
- EXPECT_CALL(mock_input_callback_, OnClose(_)); // At Stop() time.
wcais_->Start(&mock_input_callback_);
diff --git a/media/audio/alsa/alsa_input.cc b/media/audio/alsa/alsa_input.cc
index 9dcbf2b..bf31f51 100644
--- a/media/audio/alsa/alsa_input.cc
+++ b/media/audio/alsa/alsa_input.cc
@@ -245,6 +245,8 @@ void AlsaPcmInputStream::Stop() {
int error = wrapper_->PcmDrop(device_handle_);
if (error < 0)
HandleError("PcmDrop", error);
+
+ callback_ = NULL;
}
void AlsaPcmInputStream::Close() {
@@ -261,9 +263,6 @@ void AlsaPcmInputStream::Close() {
device_handle_ = NULL;
mixer_handle_ = NULL;
mixer_element_handle_ = NULL;
-
- if (callback_)
- callback_->OnClose(this);
}
audio_manager_->ReleaseInputStream(this);
diff --git a/media/audio/android/audio_android_unittest.cc b/media/audio/android/audio_android_unittest.cc
index 8f453c6..1e181f4 100644
--- a/media/audio/android/audio_android_unittest.cc
+++ b/media/audio/android/audio_android_unittest.cc
@@ -146,7 +146,6 @@ class MockAudioInputCallback : public AudioInputStream::AudioInputCallback {
uint32 size,
uint32 hardware_delay_bytes,
double volume));
- MOCK_METHOD1(OnClose, void(AudioInputStream* stream));
MOCK_METHOD1(OnError, void(AudioInputStream* stream));
};
@@ -293,7 +292,6 @@ class FileAudioSink : public AudioInputStream::AudioInputCallback {
event_->Signal();
}
- virtual void OnClose(AudioInputStream* stream) OVERRIDE {}
virtual void OnError(AudioInputStream* stream) OVERRIDE {}
private:
@@ -359,7 +357,6 @@ class FullDuplexAudioSinkSource
}
}
- virtual void OnClose(AudioInputStream* stream) OVERRIDE {}
virtual void OnError(AudioInputStream* stream) OVERRIDE {}
// AudioOutputStream::AudioSourceCallback implementation
@@ -549,7 +546,6 @@ class AudioAndroidInputTest : public AudioAndroidOutputTest,
.WillRepeatedly(
CheckCountAndPostQuitTask(&count, num_callbacks, loop()));
EXPECT_CALL(sink, OnError(stream)).Times(0);
- EXPECT_CALL(sink, OnClose(stream)).Times(1);
EXPECT_TRUE(stream->Open());
stream->Start(&sink);
diff --git a/media/audio/android/audio_record_input.cc b/media/audio/android/audio_record_input.cc
index 15a0c3d..583239d 100644
--- a/media/audio/android/audio_record_input.cc
+++ b/media/audio/android/audio_record_input.cc
@@ -90,8 +90,7 @@ void AudioRecordInputStream::Stop() {
base::android::AttachCurrentThread(), j_audio_record_.obj());
// The Java thread must have been stopped at this point, so we are free to
- // set |callback_|.
- callback_->OnClose(this);
+ // clear |callback_|.
callback_ = NULL;
}
diff --git a/media/audio/android/opensles_input.cc b/media/audio/android/opensles_input.cc
index e51ba4f..b927edb 100644
--- a/media/audio/android/opensles_input.cc
+++ b/media/audio/android/opensles_input.cc
@@ -132,6 +132,7 @@ void OpenSLESInputStream::Stop() {
(*simple_buffer_queue_)->Clear(simple_buffer_queue_));
started_ = false;
+ callback_ = NULL;
}
void OpenSLESInputStream::Close() {
@@ -141,15 +142,9 @@ void OpenSLESInputStream::Close() {
// Stop the stream if it is still recording.
Stop();
{
+ // TODO(henrika): Do we need to hold the lock here?
base::AutoLock lock(lock_);
- // TODO(henrika): we use |callback_| in Close() but |callback_| is set
- // in Start(). Hence, it should be cleared in Stop() and not used here.
- if (callback_) {
- callback_->OnClose(this);
- callback_ = NULL;
- }
-
// Destroy the buffer queue recorder object and invalidate all associated
// interfaces.
recorder_object_.Reset();
diff --git a/media/audio/audio_input_controller.cc b/media/audio/audio_input_controller.cc
index ef94d12..1f008b4 100644
--- a/media/audio/audio_input_controller.cc
+++ b/media/audio/audio_input_controller.cc
@@ -360,13 +360,6 @@ void AudioInputController::OnData(AudioInputStream* stream,
handler_->OnData(this, data, size);
}
-void AudioInputController::OnClose(AudioInputStream* stream) {
- DVLOG(1) << "AudioInputController::OnClose()";
- // TODO(satish): Sometimes the device driver closes the input stream without
- // us asking for it (may be if the device was unplugged?). Check how to handle
- // such cases here.
-}
-
void AudioInputController::OnError(AudioInputStream* stream) {
// Handle error on the audio-manager thread.
message_loop_->PostTask(FROM_HERE, base::Bind(
diff --git a/media/audio/audio_input_controller.h b/media/audio/audio_input_controller.h
index 6b40459..3ca87c4 100644
--- a/media/audio/audio_input_controller.h
+++ b/media/audio/audio_input_controller.h
@@ -198,7 +198,6 @@ class MEDIA_EXPORT AudioInputController
// device-specific implementation.
virtual void OnData(AudioInputStream* stream, const uint8* src, uint32 size,
uint32 hardware_delay_bytes, double volume) OVERRIDE;
- virtual void OnClose(AudioInputStream* stream) OVERRIDE;
virtual void OnError(AudioInputStream* stream) OVERRIDE;
bool LowLatencyMode() const { return sync_writer_ != NULL; }
@@ -256,8 +255,8 @@ class MEDIA_EXPORT AudioInputController
AudioInputStream* stream_;
// |no_data_timer_| is used to call OnError() when we stop receiving
- // OnData() calls without an OnClose() call. This can occur
- // when an audio input device is unplugged whilst recording on Windows.
+ // OnData() calls. This can occur when an audio input device is unplugged
+ // whilst recording on Windows.
// See http://crbug.com/79936 for details.
// This member is only touched by the audio thread.
scoped_ptr<base::Timer> no_data_timer_;
diff --git a/media/audio/audio_input_controller_unittest.cc b/media/audio/audio_input_controller_unittest.cc
index a7bb600..f95615c 100644
--- a/media/audio/audio_input_controller_unittest.cc
+++ b/media/audio/audio_input_controller_unittest.cc
@@ -142,8 +142,8 @@ TEST_F(AudioInputControllerTest, RecordAndClose) {
}
// Test that the AudioInputController reports an error when the input stream
-// stops without an OnClose() callback. This can happen when the underlying
-// audio layer stops feeding data as a result of a removed microphone device.
+// stops. This can happen when the underlying audio layer stops feeding data as
+// a result of a removed microphone device.
TEST_F(AudioInputControllerTest, RecordAndError) {
MockAudioInputControllerEventHandler event_handler;
int count = 0;
diff --git a/media/audio/audio_input_unittest.cc b/media/audio/audio_input_unittest.cc
index 838cab3..eb15b34 100644
--- a/media/audio/audio_input_unittest.cc
+++ b/media/audio/audio_input_unittest.cc
@@ -38,7 +38,6 @@ class TestInputCallback : public AudioInputStream::AudioInputCallback {
EXPECT_GE(value, 0);
}
}
- virtual void OnClose(AudioInputStream* stream) OVERRIDE {}
virtual void OnError(AudioInputStream* stream) OVERRIDE {
++had_error_;
}
diff --git a/media/audio/audio_io.h b/media/audio/audio_io.h
index 473af0d..db31902 100644
--- a/media/audio/audio_io.h
+++ b/media/audio/audio_io.h
@@ -117,10 +117,6 @@ class MEDIA_EXPORT AudioInputStream {
uint32 size, uint32 hardware_delay_bytes,
double volume) = 0;
- // The stream is done with this callback, the last call received by this
- // audio sink.
- virtual void OnClose(AudioInputStream* stream) = 0;
-
// There was an error while recording audio. The audio sink cannot be
// destroyed yet. No direct action needed by the AudioInputStream, but it
// is a good place to stop accumulating sound data since is is likely that
diff --git a/media/audio/audio_low_latency_input_output_unittest.cc b/media/audio/audio_low_latency_input_output_unittest.cc
index c0cfa69..033988f 100644
--- a/media/audio/audio_low_latency_input_output_unittest.cc
+++ b/media/audio/audio_low_latency_input_output_unittest.cc
@@ -214,7 +214,6 @@ class FullDuplexAudioSinkSource
}
}
- virtual void OnClose(AudioInputStream* stream) OVERRIDE {}
virtual void OnError(AudioInputStream* stream) OVERRIDE {}
// AudioOutputStream::AudioSourceCallback.
diff --git a/media/audio/cras/cras_input.cc b/media/audio/cras/cras_input.cc
index c41f364..2c4c6a7 100644
--- a/media/audio/cras/cras_input.cc
+++ b/media/audio/cras/cras_input.cc
@@ -86,17 +86,14 @@ bool CrasInputStream::Open() {
}
void CrasInputStream::Close() {
+ Stop();
+
if (client_) {
cras_client_stop(client_);
cras_client_destroy(client_);
client_ = NULL;
}
- if (callback_) {
- callback_->OnClose(this);
- callback_ = NULL;
- }
-
// Signal to the manager that we're closed and can be removed.
// Should be last call in the method as it deletes "this".
audio_manager_->ReleaseInputStream(this);
@@ -177,6 +174,7 @@ void CrasInputStream::Stop() {
cras_client_rm_stream(client_, stream_id_);
started_ = false;
+ callback_ = NULL;
}
// Static callback asking for samples. Run on high priority thread.
diff --git a/media/audio/cras/cras_input_unittest.cc b/media/audio/cras/cras_input_unittest.cc
index 27ea985..8f17c79 100644
--- a/media/audio/cras/cras_input_unittest.cc
+++ b/media/audio/cras/cras_input_unittest.cc
@@ -27,7 +27,6 @@ class MockAudioInputCallback : public AudioInputStream::AudioInputCallback {
MOCK_METHOD5(OnData, void(
AudioInputStream*, const uint8*, uint32, uint32, double));
MOCK_METHOD1(OnError, void(AudioInputStream*));
- MOCK_METHOD1(OnClose, void(AudioInputStream*));
};
class MockAudioManagerCrasInput : public AudioManagerCras {
@@ -93,8 +92,6 @@ class CrasInputStreamTest : public testing::Test {
EXPECT_TRUE(event.TimedWait(TestTimeouts::action_timeout()));
test_stream->Stop();
-
- EXPECT_CALL(mock_callback, OnClose(test_stream)).Times(1);
test_stream->Close();
}
diff --git a/media/audio/fake_audio_input_stream.cc b/media/audio/fake_audio_input_stream.cc
index a00a9b6..5ec09a4 100644
--- a/media/audio/fake_audio_input_stream.cc
+++ b/media/audio/fake_audio_input_stream.cc
@@ -65,6 +65,7 @@ bool FakeAudioInputStream::Open() {
void FakeAudioInputStream::Start(AudioInputCallback* callback) {
DCHECK(!thread_.IsRunning());
+ DCHECK(!callback_);
callback_ = callback;
last_callback_time_ = TimeTicks::Now();
thread_.Start();
@@ -133,13 +134,10 @@ void FakeAudioInputStream::DoCallback() {
void FakeAudioInputStream::Stop() {
thread_.Stop();
+ callback_ = NULL;
}
void FakeAudioInputStream::Close() {
- if (callback_) {
- callback_->OnClose(this);
- callback_ = NULL;
- }
audio_manager_->ReleaseInputStream(this);
}
diff --git a/media/audio/mac/audio_input_mac.cc b/media/audio/mac/audio_input_mac.cc
index 4aee117..8f98eed 100644
--- a/media/audio/mac/audio_input_mac.cc
+++ b/media/audio/mac/audio_input_mac.cc
@@ -85,9 +85,12 @@ void PCMQueueInAudioInputStream::Stop() {
HandleError(err);
started_ = false;
+ callback_ = NULL;
}
void PCMQueueInAudioInputStream::Close() {
+ Stop();
+
// It is valid to call Close() before calling Open() or Start(), thus
// |audio_queue_| and |callback_| might be NULL.
if (audio_queue_) {
@@ -96,10 +99,7 @@ void PCMQueueInAudioInputStream::Close() {
if (err != noErr)
HandleError(err);
}
- if (callback_) {
- callback_->OnClose(this);
- callback_ = NULL;
- }
+
manager_->ReleaseInputStream(this);
// CARE: This object may now be destroyed.
}
diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc
index dbc75bf..5623bce 100644
--- a/media/audio/mac/audio_low_latency_input_mac.cc
+++ b/media/audio/mac/audio_low_latency_input_mac.cc
@@ -289,9 +289,10 @@ void AUAudioInputStream::Stop() {
return;
StopAgc();
OSStatus result = AudioOutputUnitStop(audio_unit_);
- if (result == noErr) {
- started_ = false;
- }
+ DCHECK_EQ(result, noErr);
+ started_ = false;
+ sink_ = NULL;
+
OSSTATUS_DLOG_IF(ERROR, result != noErr, result)
<< "Failed to stop acquiring data";
}
@@ -310,10 +311,6 @@ void AUAudioInputStream::Close() {
CloseComponent(audio_unit_);
audio_unit_ = 0;
}
- if (sink_) {
- sink_->OnClose(this);
- sink_ = NULL;
- }
// Inform the audio manager that we have been closed. This can cause our
// destruction.
diff --git a/media/audio/mac/audio_low_latency_input_mac_unittest.cc b/media/audio/mac/audio_low_latency_input_mac_unittest.cc
index 9360bef..e80cbcd 100644
--- a/media/audio/mac/audio_low_latency_input_mac_unittest.cc
+++ b/media/audio/mac/audio_low_latency_input_mac_unittest.cc
@@ -33,7 +33,6 @@ class MockAudioInputCallback : public AudioInputStream::AudioInputCallback {
MOCK_METHOD5(OnData, void(AudioInputStream* stream,
const uint8* src, uint32 size,
uint32 hardware_delay_bytes, double volume));
- MOCK_METHOD1(OnClose, void(AudioInputStream* stream));
MOCK_METHOD1(OnError, void(AudioInputStream* stream));
};
@@ -84,7 +83,6 @@ class WriteToFileAudioSink : public AudioInputStream::AudioInputCallback {
}
}
- virtual void OnClose(AudioInputStream* stream) OVERRIDE {}
virtual void OnError(AudioInputStream* stream) OVERRIDE {}
private:
@@ -162,8 +160,6 @@ TEST_F(MacAudioInputTest, AUAudioInputStreamOpenStartAndClose) {
EXPECT_TRUE(ais->Open());
MockAudioInputCallback sink;
ais->Start(&sink);
- EXPECT_CALL(sink, OnClose(ais))
- .Times(1);
ais->Close();
}
@@ -176,8 +172,6 @@ TEST_F(MacAudioInputTest, AUAudioInputStreamOpenStartStopAndClose) {
MockAudioInputCallback sink;
ais->Start(&sink);
ais->Stop();
- EXPECT_CALL(sink, OnClose(ais))
- .Times(1);
ais->Close();
}
@@ -206,8 +200,6 @@ TEST_F(MacAudioInputTest, AUAudioInputStreamMiscCallingSequences) {
ais->Stop();
EXPECT_FALSE(auais->started());
- EXPECT_CALL(sink, OnClose(ais))
- .Times(1);
ais->Close();
}
@@ -239,10 +231,6 @@ TEST_F(MacAudioInputTest, AUAudioInputStreamVerifyMonoRecording) {
ais->Start(&sink);
loop.Run();
ais->Stop();
-
- // Verify that the sink receieves OnClose() call when calling Close().
- EXPECT_CALL(sink, OnClose(ais))
- .Times(1);
ais->Close();
}
@@ -281,10 +269,6 @@ TEST_F(MacAudioInputTest, AUAudioInputStreamVerifyStereoRecording) {
ais->Start(&sink);
loop.Run();
ais->Stop();
-
- // Verify that the sink receieves OnClose() call when calling Close().
- EXPECT_CALL(sink, OnClose(ais))
- .Times(1);
ais->Close();
}
diff --git a/media/audio/pulse/pulse_input.cc b/media/audio/pulse/pulse_input.cc
index 54dfc1e..9d31cdd 100644
--- a/media/audio/pulse/pulse_input.cc
+++ b/media/audio/pulse/pulse_input.cc
@@ -105,6 +105,7 @@ void PulseAudioInputStream::Stop() {
operation = pa_stream_cork(handle_, 1, &pulse::StreamSuccessCallback,
pa_mainloop_);
WaitForOperationCompletion(pa_mainloop_, operation);
+ callback_ = NULL;
}
void PulseAudioInputStream::Close() {
@@ -125,9 +126,6 @@ void PulseAudioInputStream::Close() {
}
}
- if (callback_)
- callback_->OnClose(this);
-
// Signal to the manager that we're closed and can be removed.
// This should be the last call in the function as it deletes "this".
audio_manager_->ReleaseInputStream(this);
diff --git a/media/audio/virtual_audio_input_stream.cc b/media/audio/virtual_audio_input_stream.cc
index 9c4e7a1..91b9f992 100644
--- a/media/audio/virtual_audio_input_stream.cc
+++ b/media/audio/virtual_audio_input_stream.cc
@@ -97,6 +97,7 @@ void VirtualAudioInputStream::Start(AudioInputCallback* callback) {
void VirtualAudioInputStream::Stop() {
DCHECK(thread_checker_.CalledOnValidThread());
fake_consumer_.Stop();
+ callback_ = NULL;
}
void VirtualAudioInputStream::AddOutputStream(
@@ -134,7 +135,6 @@ void VirtualAudioInputStream::RemoveOutputStream(
void VirtualAudioInputStream::PumpAudio(AudioBus* audio_bus) {
DCHECK(worker_loop_->BelongsToCurrentThread());
- DCHECK(callback_);
{
base::AutoLock scoped_lock(converter_network_lock_);
@@ -154,10 +154,6 @@ void VirtualAudioInputStream::Close() {
DCHECK(thread_checker_.CalledOnValidThread());
Stop(); // Make sure callback_ is no longer being used.
- if (callback_) {
- callback_->OnClose(this);
- callback_ = NULL;
- }
// If a non-null AfterCloseCallback was provided to the constructor, invoke it
// here. The callback is moved to a stack-local first since |this| could be
diff --git a/media/audio/virtual_audio_input_stream_unittest.cc b/media/audio/virtual_audio_input_stream_unittest.cc
index aab67cc..8c792d5 100644
--- a/media/audio/virtual_audio_input_stream_unittest.cc
+++ b/media/audio/virtual_audio_input_stream_unittest.cc
@@ -43,7 +43,6 @@ class MockInputCallback : public AudioInputStream::AudioInputCallback {
MOCK_METHOD5(OnData, void(AudioInputStream* stream, const uint8* data,
uint32 size, uint32 hardware_delay_bytes,
double volume));
- MOCK_METHOD1(OnClose, void(AudioInputStream* stream));
MOCK_METHOD1(OnError, void(AudioInputStream* stream));
void WaitForDataPushes() {
@@ -124,7 +123,6 @@ class VirtualAudioInputStreamTest : public testing::TestWithParam<bool> {
}
void Start() {
- EXPECT_CALL(input_callback_, OnClose(_));
EXPECT_CALL(input_callback_, OnData(_, NotNull(), _, _, _))
.Times(AtLeast(1));
diff --git a/media/audio/win/audio_low_latency_input_win.cc b/media/audio/win/audio_low_latency_input_win.cc
index b16ef13..8227908 100644
--- a/media/audio/win/audio_low_latency_input_win.cc
+++ b/media/audio/win/audio_low_latency_input_win.cc
@@ -123,6 +123,7 @@ void WASAPIAudioInputStream::Start(AudioInputCallback* callback) {
if (started_)
return;
+ DCHECK(!sink_);
sink_ = callback;
// Starts periodic AGC microphone measurements if the AGC has been enabled
@@ -173,6 +174,7 @@ void WASAPIAudioInputStream::Stop() {
}
started_ = false;
+ sink_ = NULL;
}
void WASAPIAudioInputStream::Close() {
@@ -180,10 +182,6 @@ void WASAPIAudioInputStream::Close() {
// It is valid to call Close() before calling open or Start().
// It is also valid to call Close() after Start() has been called.
Stop();
- if (sink_) {
- sink_->OnClose(this);
- sink_ = NULL;
- }
// Inform the audio manager that we have been closed. This will cause our
// destruction.
diff --git a/media/audio/win/audio_low_latency_input_win_unittest.cc b/media/audio/win/audio_low_latency_input_win_unittest.cc
index 54bd3f7..6f64072e 100644
--- a/media/audio/win/audio_low_latency_input_win_unittest.cc
+++ b/media/audio/win/audio_low_latency_input_win_unittest.cc
@@ -41,20 +41,17 @@ class MockAudioInputCallback : public AudioInputStream::AudioInputCallback {
MOCK_METHOD5(OnData, void(AudioInputStream* stream,
const uint8* src, uint32 size,
uint32 hardware_delay_bytes, double volume));
- MOCK_METHOD1(OnClose, void(AudioInputStream* stream));
MOCK_METHOD1(OnError, void(AudioInputStream* stream));
};
class FakeAudioInputCallback : public AudioInputStream::AudioInputCallback {
public:
FakeAudioInputCallback()
- : closed_(false),
- error_(false),
+ : error_(false),
data_event_(false, false) {
}
const std::vector<uint8>& received_data() const { return received_data_; }
- bool closed() const { return closed_; }
bool error() const { return error_; }
// Waits until OnData() is called on another thread.
@@ -69,10 +66,6 @@ class FakeAudioInputCallback : public AudioInputStream::AudioInputCallback {
data_event_.Signal();
}
- virtual void OnClose(AudioInputStream* stream) OVERRIDE {
- closed_ = true;
- }
-
virtual void OnError(AudioInputStream* stream) OVERRIDE {
error_ = true;
}
@@ -80,7 +73,6 @@ class FakeAudioInputCallback : public AudioInputStream::AudioInputCallback {
private:
std::vector<uint8> received_data_;
base::WaitableEvent data_event_;
- bool closed_;
bool error_;
DISALLOW_COPY_AND_ASSIGN(FakeAudioInputCallback);
@@ -137,7 +129,6 @@ class WriteToFileAudioSink : public AudioInputStream::AudioInputCallback {
}
}
- virtual void OnClose(AudioInputStream* stream) {}
virtual void OnError(AudioInputStream* stream) {}
private:
@@ -316,8 +307,6 @@ TEST(WinAudioInputTest, WASAPIAudioInputStreamOpenStartAndClose) {
EXPECT_TRUE(ais->Open());
MockAudioInputCallback sink;
ais->Start(&sink);
- EXPECT_CALL(sink, OnClose(ais.get()))
- .Times(1);
ais.Close();
}
@@ -332,8 +321,6 @@ TEST(WinAudioInputTest, WASAPIAudioInputStreamOpenStartStopAndClose) {
MockAudioInputCallback sink;
ais->Start(&sink);
ais->Stop();
- EXPECT_CALL(sink, OnClose(ais.get()))
- .Times(1);
ais.Close();
}
@@ -364,9 +351,6 @@ TEST(WinAudioInputTest, WASAPIAudioInputStreamMiscCallingSequences) {
EXPECT_FALSE(wais->started());
ais->Stop();
EXPECT_FALSE(wais->started());
-
- EXPECT_CALL(sink, OnClose(ais.get()))
- .Times(1);
ais.Close();
}
@@ -406,8 +390,6 @@ TEST(WinAudioInputTest, WASAPIAudioInputStreamTestPacketSizes) {
// Store current packet size (to be used in the subsequent tests).
int samples_per_packet_10ms = aisw.samples_per_packet();
- EXPECT_CALL(sink, OnClose(ais.get()))
- .Times(1);
ais.Close();
// 20 ms packet size.
@@ -425,9 +407,6 @@ TEST(WinAudioInputTest, WASAPIAudioInputStreamTestPacketSizes) {
ais->Start(&sink);
loop.Run();
ais->Stop();
-
- EXPECT_CALL(sink, OnClose(ais.get()))
- .Times(1);
ais.Close();
// 5 ms packet size.
@@ -445,9 +424,6 @@ TEST(WinAudioInputTest, WASAPIAudioInputStreamTestPacketSizes) {
ais->Start(&sink);
loop.Run();
ais->Stop();
-
- EXPECT_CALL(sink, OnClose(ais.get()))
- .Times(1);
ais.Close();
}
@@ -476,7 +452,6 @@ TEST(WinAudioInputTest, WASAPIAudioInputStreamLoopback) {
stream.Close();
EXPECT_FALSE(sink.received_data().empty());
- EXPECT_TRUE(sink.closed());
EXPECT_FALSE(sink.error());
}