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

Unified Diff: ipc/ipc_sync_channel_unittest.cc

Issue 8718003: base::Bind: Convert Tasks in ipc_sync_channel_unittest.cc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove static in unnamed namespace. Created 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_sync_channel_unittest.cc
diff --git a/ipc/ipc_sync_channel_unittest.cc b/ipc/ipc_sync_channel_unittest.cc
index 6982b284283ae9fe580a3ef77e5acc8b32a6afe6..47289974f184bb4e0c67dbfa646906e30839b622 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();
}
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698