diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-01 00:28:29 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-01 00:28:29 +0000 |
commit | d6891eb663b9eaca784ac6547291212905342f9f (patch) | |
tree | f3ee0d95ba1150290118c3ddacd11bd6f2d81171 /chrome/renderer | |
parent | 3a29f7db26b4dc30eee84aeb958c26172eeae1fc (diff) | |
download | chromium_src-d6891eb663b9eaca784ac6547291212905342f9f.zip chromium_src-d6891eb663b9eaca784ac6547291212905342f9f.tar.gz chromium_src-d6891eb663b9eaca784ac6547291212905342f9f.tar.bz2 |
Speculative fix for memory leak in unit tests.TBR=erikkay
Review URL: http://codereview.chromium.org/28301
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10685 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/render_process_unittest.cc | 11 | ||||
-rw-r--r-- | chrome/renderer/render_thread_unittest.cc | 6 |
2 files changed, 14 insertions, 3 deletions
diff --git a/chrome/renderer/render_process_unittest.cc b/chrome/renderer/render_process_unittest.cc index 7859d8f..ef98907 100644 --- a/chrome/renderer/render_process_unittest.cc +++ b/chrome/renderer/render_process_unittest.cc @@ -13,16 +13,27 @@ namespace { class RenderProcessTest : public testing::Test { public: virtual void SetUp() { + // Need a MODE_SERVER to make MODE_CLIENTs (like a RenderThread) happy. + channel_ = new IPC::Channel(L"render_process_unittest", IPC::Channel::MODE_SERVER, NULL); render_process_.reset(new RenderProcess(L"render_process_unittest")); } virtual void TearDown() { + message_loop_.RunAllPending(); render_process_.reset(); + // Need to fully destruct IPC::SyncChannel before the message loop goes + // away. + message_loop_.RunAllPending(); + // Delete the server channel after the RenderThread so that + // IPC::SyncChannel's OnChannelError doesn't fire on the context and attempt + // to use the listener thread which is now gone. + delete channel_; } private: MessageLoopForIO message_loop_; scoped_ptr<RenderProcess> render_process_; + IPC::Channel *channel_; }; diff --git a/chrome/renderer/render_thread_unittest.cc b/chrome/renderer/render_thread_unittest.cc index 3d09c51..808bedf 100644 --- a/chrome/renderer/render_thread_unittest.cc +++ b/chrome/renderer/render_thread_unittest.cc @@ -24,13 +24,13 @@ class RenderThreadTest : public testing::Test { virtual void TearDown() { message_loop_.RunAllPending(); mock_process_.reset(); + // Need to fully destruct IPC::SyncChannel before the message loop goes + // away. + message_loop_.RunAllPending(); // Delete the server channel after the RenderThread so that // IPC::SyncChannel's OnChannelError doesn't fire on the context and attempt // to use the listener thread which is now gone. delete channel_; - // Need to fully destruct IPC::SyncChannel before the message loop goes - // away. - message_loop_.RunAllPending(); } protected: |