diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-28 18:35:39 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-28 18:35:39 +0000 |
commit | 0633e315df85edb2b96dff1518ab05a74dad15d1 (patch) | |
tree | b713a4b685308c0cf65ae0112866040ba1e2fadb /ipc | |
parent | 5693dba19b2ac8a6b7a3093840c7473d432b15d8 (diff) | |
download | chromium_src-0633e315df85edb2b96dff1518ab05a74dad15d1.zip chromium_src-0633e315df85edb2b96dff1518ab05a74dad15d1.tar.gz chromium_src-0633e315df85edb2b96dff1518ab05a74dad15d1.tar.bz2 |
base::Bind: Convert Tasks in ipc_sync_channel_unittest.cc.
BUG=none
TEST=none
R=groby@chromium.org
Review URL: http://codereview.chromium.org/8718003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111728 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/ipc_sync_channel_unittest.cc | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/ipc/ipc_sync_channel_unittest.cc b/ipc/ipc_sync_channel_unittest.cc index 6982b28..4728997 100644 --- a/ipc/ipc_sync_channel_unittest.cc +++ b/ipc/ipc_sync_channel_unittest.cc @@ -1032,26 +1032,17 @@ TEST_F(IPCSyncChannelTest, DISABLED_SendWithTimeoutMixedOKAndTimeout) { namespace { -class NestedTask : public Task { - public: - explicit NestedTask(Worker* server) : server_(server) {} - void Run() { - // Sleep a bit so that we wake up after the reply has been received. - base::PlatformThread::Sleep(250); - server_->SendAnswerToLife(true, base::kNoTimeout, true); - } - - Worker* server_; -}; +void NestedCallback(Worker* server) { + // Sleep a bit so that we wake up after the reply has been received. + base::PlatformThread::Sleep(250); + server->SendAnswerToLife(true, base::kNoTimeout, true); +} -static bool timeout_occured = false; +bool timeout_occurred = false; -class TimeoutTask : public Task { - public: - void Run() { - timeout_occured = true; - } -}; +void TimeoutCallback() { + timeout_occurred = true; +} class DoneEventRaceServer : public Worker { public: @@ -1059,14 +1050,16 @@ class DoneEventRaceServer : public Worker { : Worker(Channel::MODE_SERVER, "done_event_race_server") { } void Run() { - MessageLoop::current()->PostTask(FROM_HERE, new NestedTask(this)); - MessageLoop::current()->PostDelayedTask(FROM_HERE, new TimeoutTask(), 9000); + MessageLoop::current()->PostTask(FROM_HERE, + base::Bind(&NestedCallback, this)); + MessageLoop::current()->PostDelayedTask( + FROM_HERE, base::Bind(&TimeoutCallback), 9000); // Even though we have a timeout on the Send, it will succeed since for this // bug, the reply message comes back and is deserialized, however the done // event wasn't set. So we indirectly use the timeout task to notice if a // timeout occurred. SendAnswerToLife(true, 10000, true); - DCHECK(!timeout_occured); + DCHECK(!timeout_occurred); Done(); } }; |