diff options
-rw-r--r-- | net/dns/serial_worker_unittest.cc | 23 | ||||
-rw-r--r-- | net/dns/watching_file_reader_unittest.cc | 23 |
2 files changed, 16 insertions, 30 deletions
diff --git a/net/dns/serial_worker_unittest.cc b/net/dns/serial_worker_unittest.cc index 4062c2a..7fe0ef7 100644 --- a/net/dns/serial_worker_unittest.cc +++ b/net/dns/serial_worker_unittest.cc @@ -4,6 +4,7 @@ #include "net/dns/serial_worker.h" +#include "base/bind.h" #include "base/message_loop.h" #include "base/synchronization/lock.h" #include "base/synchronization/waitable_event.h" @@ -60,23 +61,15 @@ class SerialWorkerTest : public testing::Test { } protected: - friend class BreakTask; - class BreakTask : public Task { - public: - BreakTask(SerialWorkerTest* test, std::string breakpoint) - : test_(test), breakpoint_(breakpoint) {} - virtual ~BreakTask() {} - virtual void Run() OVERRIDE { - test_->breakpoint_ = breakpoint_; - MessageLoop::current()->QuitNow(); - } - private: - SerialWorkerTest* test_; - std::string breakpoint_; - }; + void BreakCallback(std::string breakpoint) { + breakpoint_ = breakpoint; + MessageLoop::current()->QuitNow(); + } void BreakNow(std::string b) { - message_loop_->PostTask(FROM_HERE, new BreakTask(this, b)); + message_loop_->PostTask(FROM_HERE, + base::Bind(&SerialWorkerTest::BreakCallback, + base::Unretained(this), b)); } void RunUntilBreak(std::string b) { diff --git a/net/dns/watching_file_reader_unittest.cc b/net/dns/watching_file_reader_unittest.cc index 510398c..7ff5534 100644 --- a/net/dns/watching_file_reader_unittest.cc +++ b/net/dns/watching_file_reader_unittest.cc @@ -4,6 +4,7 @@ #include "net/dns/watching_file_reader.h" +#include "base/bind.h" #include "base/message_loop.h" #include "base/synchronization/lock.h" #include "base/synchronization/waitable_event.h" @@ -105,23 +106,15 @@ class WatchingFileReaderTest : public testing::Test { } protected: - friend class BreakTask; - class BreakTask : public Task { - public: - BreakTask(WatchingFileReaderTest* test, std::string breakpoint) - : test_(test), breakpoint_(breakpoint) {} - virtual ~BreakTask() {} - virtual void Run() OVERRIDE { - test_->breakpoint_ = breakpoint_; - MessageLoop::current()->QuitNow(); - } - private: - WatchingFileReaderTest* test_; - std::string breakpoint_; - }; + void BreakCallback(std::string breakpoint) { + breakpoint_ = breakpoint; + MessageLoop::current()->QuitNow(); + } void BreakNow(std::string b) { - message_loop_->PostTask(FROM_HERE, new BreakTask(this, b)); + message_loop_->PostTask(FROM_HERE, + base::Bind(&WatchingFileReaderTest::BreakCallback, + base::Unretained(this), b)); } void RunUntilBreak(std::string b) { |