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

Unified Diff: chrome/nacl/nacl_ipc_adapter_unittest.cc

Issue 10383167: PPAPI/NaCl: Fix leaky NaClIPCAdapter test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ipc/ipc_channel_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/nacl/nacl_ipc_adapter_unittest.cc
diff --git a/chrome/nacl/nacl_ipc_adapter_unittest.cc b/chrome/nacl/nacl_ipc_adapter_unittest.cc
index f5121252aad70225fb8dea54c6a4390228ae0388..0f62ff174885130c1a64a3983d879eb26eab7eff 100644
--- a/chrome/nacl/nacl_ipc_adapter_unittest.cc
+++ b/chrome/nacl/nacl_ipc_adapter_unittest.cc
@@ -24,13 +24,19 @@ class NaClIPCAdapterTest : public testing::Test {
virtual void SetUp() OVERRIDE {
sink_ = new IPC::TestSink;
- // Takes ownership of the sink_ pointer.
+ // Takes ownership of the sink_ pointer. Note we provide the current message
+ // loop instead of using a real IO thread. This should work OK since we do
+ // not need real IPC for the tests.
adapter_ = new NaClIPCAdapter(scoped_ptr<IPC::Channel>(sink_),
base::MessageLoopProxy::current());
}
virtual void TearDown() OVERRIDE {
sink_ = NULL; // This pointer is actually owned by the IPCAdapter.
adapter_ = NULL;
+ // The adapter destructor has to post a task to destroy the Channel on the
+ // IO thread. For the purposes of the test, we just need to make sure that
+ // task gets run, or it will appear as a leak.
+ message_loop_.RunAllPending();
}
protected:
@@ -108,7 +114,7 @@ TEST_F(NaClIPCAdapterTest, SendRewriting) {
EXPECT_EQ(buf_size, result);
// Check that the message came out the other end in the test sink
- // (messages are posted to we have to pump).
+ // (messages are posted, so we have to pump).
message_loop_.RunAllPending();
ASSERT_EQ(1u, sink_->message_count());
const IPC::Message* msg = sink_->GetMessageAt(0);
« no previous file with comments | « no previous file | ipc/ipc_channel_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698