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

Side by Side Diff: webkit/appcache/appcache_service_unittest.cc

Issue 8399019: base::Bind usage (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/appcache/appcache_service.cc ('k') | webkit/appcache/appcache_url_request_job.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "base/bind.h"
7 #include "base/message_loop.h" 8 #include "base/message_loop.h"
8 #include "base/pickle.h" 9 #include "base/pickle.h"
9 #include "net/base/completion_callback.h" 10 #include "net/base/completion_callback.h"
10 #include "net/base/io_buffer.h" 11 #include "net/base/io_buffer.h"
11 #include "net/http/http_response_headers.h" 12 #include "net/http/http_response_headers.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 #include "webkit/appcache/appcache_response.h" 14 #include "webkit/appcache/appcache_response.h"
14 #include "webkit/appcache/appcache_service.h" 15 #include "webkit/appcache/appcache_service.h"
15 #include "webkit/appcache/mock_appcache_storage.h" 16 #include "webkit/appcache/mock_appcache_storage.h"
16 17
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 return; 59 return;
59 } 60 }
60 DCHECK(buf_len >= data_size_); 61 DCHECK(buf_len >= data_size_);
61 memcpy(buf->data(), data_, data_size_); 62 memcpy(buf->data(), data_, data_size_);
62 ScheduleUserCallback(data_size_); 63 ScheduleUserCallback(data_size_);
63 data_size_ = 0; 64 data_size_ = 0;
64 } 65 }
65 66
66 private: 67 private:
67 void ScheduleUserCallback(int result) { 68 void ScheduleUserCallback(int result) {
68 MessageLoop::current()->PostTask(FROM_HERE, 69 MessageLoop::current()->PostTask(
69 method_factory_.NewRunnableMethod( 70 FROM_HERE,
70 &MockResponseReader::InvokeUserOldCompletionCallback, result)); 71 base::Bind(&MockResponseReader::InvokeUserOldCompletionCallback,
72 weak_factory_.GetWeakPtr(), result));
71 } 73 }
72 74
73 scoped_ptr<net::HttpResponseInfo> info_; 75 scoped_ptr<net::HttpResponseInfo> info_;
74 int info_size_; 76 int info_size_;
75 const char* data_; 77 const char* data_;
76 int data_size_; 78 int data_size_;
77 }; 79 };
78 80
79 } // namespace 81 } // namespace
80 82
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 MessageLoop::current()->RunAllPending(); 306 MessageLoop::current()->RunAllPending();
305 EXPECT_EQ(0, CountPendingHelpers()); 307 EXPECT_EQ(0, CountPendingHelpers());
306 EXPECT_FALSE(IsGroupStored(kManifestUrl)); 308 EXPECT_FALSE(IsGroupStored(kManifestUrl));
307 ResetStorage(); 309 ResetStorage();
308 310
309 service_.reset(); // Clean up. 311 service_.reset(); // Clean up.
310 MessageLoop::current()->RunAllPending(); 312 MessageLoop::current()->RunAllPending();
311 } 313 }
312 314
313 } // namespace appcache 315 } // namespace appcache
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_service.cc ('k') | webkit/appcache/appcache_url_request_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698