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

Unified Diff: mojo/common/handle_watcher_unittest.cc

Issue 69283002: Revert "Mojo: Add BindingsSupportImpl on top of HandleWatcher" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | « mojo/common/handle_watcher.cc ('k') | mojo/mojo.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « mojo/common/handle_watcher.cc ('k') | mojo/mojo.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698