summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-30 00:20:06 +0000
committerfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-30 00:20:06 +0000
commita51e9cb55e55dc40321a239ff4adfe3a52223a29 (patch)
tree13f64f8c71e151830461ad7ad97034301b5db38a /media
parent7dc99087e5f341d05750fc812a1915caf96811d5 (diff)
downloadchromium_src-a51e9cb55e55dc40321a239ff4adfe3a52223a29.zip
chromium_src-a51e9cb55e55dc40321a239ff4adfe3a52223a29.tar.gz
chromium_src-a51e9cb55e55dc40321a239ff4adfe3a52223a29.tar.bz2
Avoid leaking memory in PostTaskAndReply by Run()'ing the message_loop.
Turns out that PostTaskAndReply to a runner that never Run()s triggers a leak. See http://crbug.com/120289 for details. BUG=119714 TEST=Cmd line that uses suppressions before this CL and doesn't after: ./tools/heapcheck/chrome_tests.sh --build_dir ninja/Debug --test media --gtest_filter=AudioInput* Review URL: http://codereview.chromium.org/9858027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129735 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/audio/audio_input_controller_unittest.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/media/audio/audio_input_controller_unittest.cc b/media/audio/audio_input_controller_unittest.cc
index be6f8f3..e0850c4 100644
--- a/media/audio/audio_input_controller_unittest.cc
+++ b/media/audio/audio_input_controller_unittest.cc
@@ -66,7 +66,7 @@ class AudioInputControllerTest : public testing::Test {
virtual ~AudioInputControllerTest() {}
protected:
- MessageLoopForIO message_loop_;
+ MessageLoop message_loop_;
private:
DISALLOW_COPY_AND_ASSIGN(AudioInputControllerTest);
@@ -78,7 +78,7 @@ TEST_F(AudioInputControllerTest, CreateAndClose) {
// OnCreated() will be posted once.
EXPECT_CALL(event_handler, OnCreated(NotNull()))
- .WillOnce(QuitMessageLoop(message_loop_.message_loop_proxy()));
+ .WillOnce(QuitMessageLoop(&message_loop_));
scoped_ptr<AudioManager> audio_manager(AudioManager::Create());
AudioParameters params(AudioParameters::AUDIO_MOCK, kChannelLayout,
@@ -87,6 +87,9 @@ TEST_F(AudioInputControllerTest, CreateAndClose) {
AudioInputController::Create(audio_manager.get(), &event_handler, params);
ASSERT_TRUE(controller.get());
+ // Wait for OnCreated() to fire.
+ message_loop_.Run();
+
// Close the AudioInputController synchronously.
CloseAudioController(controller);
}
@@ -154,7 +157,7 @@ TEST_F(AudioInputControllerTest, RecordAndError) {
// controller is in a recording state.
EXPECT_CALL(event_handler, OnError(NotNull(), 0))
.Times(Exactly(1))
- .WillOnce(QuitMessageLoop(message_loop_.message_loop_proxy()));
+ .WillOnce(QuitMessageLoop(&message_loop_));
scoped_ptr<AudioManager> audio_manager(AudioManager::Create());
AudioParameters params(AudioParameters::AUDIO_MOCK, kChannelLayout,