| Index: webkit/appcache/appcache_request_handler_unittest.cc
|
| diff --git a/webkit/appcache/appcache_request_handler_unittest.cc b/webkit/appcache/appcache_request_handler_unittest.cc
|
| index edbda461eaf106db11c8cfc752e461d2d79267ac..c576133e0c1b4aa9208737c076f8a2d72fc46178 100644
|
| --- a/webkit/appcache/appcache_request_handler_unittest.cc
|
| +++ b/webkit/appcache/appcache_request_handler_unittest.cc
|
| @@ -55,24 +55,13 @@ class AppCacheRequestHandlerTest : public testing::Test {
|
| virtual void OnContentBlocked(int host_id, const GURL& manifest_url) {}
|
| };
|
|
|
| - // Helper class run a test on our io_thread. The io_thread
|
| - // is spun up once and reused for all tests.
|
| + // Helper callback to run a test on our io_thread. The io_thread is spun up
|
| + // once and reused for all tests.
|
| template <class Method>
|
| - class WrapperTask : public Task {
|
| - public:
|
| - WrapperTask(AppCacheRequestHandlerTest* test, Method method)
|
| - : test_(test), method_(method) {
|
| - }
|
| -
|
| - virtual void Run() {
|
| - test_->SetUpTest();
|
| - (test_->*method_)();
|
| - }
|
| -
|
| - private:
|
| - AppCacheRequestHandlerTest* test_;
|
| - Method method_;
|
| - };
|
| + void MethodWrapper(Method method) {
|
| + SetUpTest();
|
| + (this->*method)();
|
| + }
|
|
|
| // Subclasses to simulate particular responses so test cases can
|
| // exercise fallback code paths.
|
| @@ -168,7 +157,9 @@ class AppCacheRequestHandlerTest : public testing::Test {
|
| void RunTestOnIOThread(Method method) {
|
| test_finished_event_ .reset(new base::WaitableEvent(false, false));
|
| io_thread_->message_loop()->PostTask(
|
| - FROM_HERE, new WrapperTask<Method>(this, method));
|
| + FROM_HERE,
|
| + base::Bind(&AppCacheRequestHandlerTest::MethodWrapper<Method>,
|
| + base::Unretained(this), method));
|
| test_finished_event_->Wait();
|
| }
|
|
|
|
|