Index: mojo/common/handle_watcher_unittest.cc |
diff --git a/mojo/common/handle_watcher_unittest.cc b/mojo/common/handle_watcher_unittest.cc |
index a10585aa49a1610e613e86ba1319df39a53cb780..ae1a1755ad6f0c5b6a20a62308bdb381df927f3c 100644 |
--- a/mojo/common/handle_watcher_unittest.cc |
+++ b/mojo/common/handle_watcher_unittest.cc |
@@ -32,14 +32,6 @@ void RunUntilIdle() { |
run_loop.RunUntilIdle(); |
} |
-void DeleteWatcherAndForwardResult( |
- HandleWatcher* watcher, |
- base::Callback<void(MojoResult)> next_callback, |
- MojoResult result) { |
- delete watcher; |
- next_callback.Run(result); |
-} |
- |
// Helper class to manage the callback and running the message loop waiting for |
// message to be received. Typical usage is something like: |
// Schedule callback returned from GetCallback(). |
@@ -67,22 +59,17 @@ class CallbackHelper { |
run_loop.Run(); |
} |
- base::Callback<void(MojoResult)> GetCallback() { |
+ base::Closure GetCallback() { |
return base::Bind(&CallbackHelper::OnCallback, weak_factory_.GetWeakPtr()); |
} |
void Start(HandleWatcher* watcher, MojoHandle handle) { |
- StartWithCallback(watcher, handle, GetCallback()); |
- } |
- |
- void StartWithCallback(HandleWatcher* watcher, MojoHandle handle, |
- const base::Callback<void(MojoResult)>& callback) { |
watcher->Start(handle, MOJO_WAIT_FLAG_READABLE, MOJO_DEADLINE_INDEFINITE, |
- callback); |
+ GetCallback()); |
} |
private: |
- void OnCallback(MojoResult result) { |
+ void OnCallback() { |
got_callback_ = true; |
if (run_loop_) |
run_loop_->Quit(); |
@@ -288,20 +275,6 @@ TEST_F(HandleWatcherTest, Deadline) { |
EXPECT_FALSE(callback_helper3.got_callback()); |
} |
-TEST_F(HandleWatcherTest, DeleteInCallback) { |
- ScopedMessagePipe test_pipe; |
- CallbackHelper callback_helper; |
- |
- HandleWatcher* watcher = new HandleWatcher(); |
- callback_helper.StartWithCallback(watcher, test_pipe.handle_1(), |
- base::Bind(&DeleteWatcherAndForwardResult, |
- watcher, |
- callback_helper.GetCallback())); |
- WriteToHandle(test_pipe.handle_0()); |
- callback_helper.RunUntilGotCallback(); |
- EXPECT_TRUE(callback_helper.got_callback()); |
-} |
- |
} // namespace test |
} // namespace common |
} // namespace mojo |