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

Unified Diff: webkit/appcache/appcache_request_handler_unittest.cc

Issue 8991001: base::Bind: Convert most of webkit/appcache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix 2. Created 9 years 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 | « webkit/appcache/appcache_disk_cache.cc ('k') | webkit/appcache/appcache_response.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « webkit/appcache/appcache_disk_cache.cc ('k') | webkit/appcache/appcache_response.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698