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

Side by Side Diff: chrome/browser/renderer_host/audio_renderer_host_unittest.cc

Issue 21277: Fix a memory leak caused by AudioRenedererHost. (Closed)
Patch Set: todo Created 11 years, 10 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 | « chrome/browser/renderer_host/audio_renderer_host.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "base/message_loop.h" 5 #include "base/message_loop.h"
6 #include "base/process.h" 6 #include "base/process.h"
7 #include "base/scoped_ptr.h" 7 #include "base/scoped_ptr.h"
8 #include "chrome/browser/renderer_host/audio_renderer_host.h" 8 #include "chrome/browser/renderer_host/audio_renderer_host.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 class AudioRendererHostTest : public testing::Test { 11 class AudioRendererHostTest : public testing::Test {
12 protected: 12 protected:
13 virtual void SetUp() { 13 virtual void SetUp() {
14 // Create a message loop so AudioRendererHost can use it. 14 // Create a message loop so AudioRendererHost can use it.
15 message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO)); 15 message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO));
16 host_ = new AudioRendererHost(MessageLoop::current()); 16 host_ = new AudioRendererHost(message_loop_.get());
17 } 17 }
18 18
19 virtual void TearDown() { 19 virtual void TearDown() {
20 // This task post a task to message_loop_ to do internal destruction on
21 // message_loop_.
20 host_->Destroy(); 22 host_->Destroy();
23 // We need to continue running message_loop_ to complete all destructions.
24 message_loop_->RunAllPending();
21 } 25 }
22 26
23 scoped_refptr<AudioRendererHost> host_; 27 scoped_refptr<AudioRendererHost> host_;
24 scoped_ptr<MessageLoop> message_loop_; 28 scoped_ptr<MessageLoop> message_loop_;
25 }; 29 };
26 30
27 TEST_F(AudioRendererHostTest, NoTest) { 31 TEST_F(AudioRendererHostTest, NoTest) {
28 // TODO(hclam): come up with useful tests. 32 // TODO(hclam): come up with useful tests.
29 } 33 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/audio_renderer_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698