Index: webkit/fileapi/file_system_quota_client_unittest.cc |
diff --git a/webkit/fileapi/file_system_quota_client_unittest.cc b/webkit/fileapi/file_system_quota_client_unittest.cc |
index 59d11dd5a3993a34e12cd97c78d92fe5761e9e60..39e53147425c29ef5ce99f0fd658399fa1614919 100644 |
--- a/webkit/fileapi/file_system_quota_client_unittest.cc |
+++ b/webkit/fileapi/file_system_quota_client_unittest.cc |
@@ -2,9 +2,9 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include "base/bind.h" |
#include "base/basictypes.h" |
#include "base/file_util.h" |
-#include "base/memory/scoped_callback_factory.h" |
#include "base/message_loop.h" |
#include "base/message_loop_proxy.h" |
#include "base/platform_file.h" |
@@ -45,7 +45,7 @@ class MockFileSystemPathManager : public FileSystemPathManager { |
class FileSystemQuotaClientTest : public testing::Test { |
public: |
FileSystemQuotaClientTest() |
- : callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
+ : weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
additional_callback_count_(0), |
deletion_status_(quota::kQuotaStatusUnknown) { |
} |
@@ -79,9 +79,10 @@ class FileSystemQuotaClientTest : public testing::Test { |
void GetOriginUsageAsync(FileSystemQuotaClient* quota_client, |
const std::string& origin_url, |
quota::StorageType type) { |
- quota_client->GetOriginUsage(GURL(origin_url), type, |
- callback_factory_.NewCallback( |
- &FileSystemQuotaClientTest::OnGetUsage)); |
+ quota_client->GetOriginUsage( |
+ GURL(origin_url), type, |
+ base::Bind(&FileSystemQuotaClientTest::OnGetUsage, |
+ weak_factory_.GetWeakPtr())); |
} |
int64 GetOriginUsage(FileSystemQuotaClient* quota_client, |
@@ -95,9 +96,10 @@ class FileSystemQuotaClientTest : public testing::Test { |
const std::set<GURL>& GetOriginsForType(FileSystemQuotaClient* quota_client, |
quota::StorageType type) { |
origins_.clear(); |
- quota_client->GetOriginsForType(type, |
- callback_factory_.NewCallback( |
- &FileSystemQuotaClientTest::OnGetOrigins)); |
+ quota_client->GetOriginsForType( |
+ type, |
+ base::Bind(&FileSystemQuotaClientTest::OnGetOrigins, |
+ weak_factory_.GetWeakPtr())); |
MessageLoop::current()->RunAllPending(); |
return origins_; |
} |
@@ -106,9 +108,10 @@ class FileSystemQuotaClientTest : public testing::Test { |
quota::StorageType type, |
const std::string& host) { |
origins_.clear(); |
- quota_client->GetOriginsForHost(type, host, |
- callback_factory_.NewCallback( |
- &FileSystemQuotaClientTest::OnGetOrigins)); |
+ quota_client->GetOriginsForHost( |
+ type, host, |
+ base::Bind(&FileSystemQuotaClientTest::OnGetOrigins, |
+ weak_factory_.GetWeakPtr())); |
MessageLoop::current()->RunAllPending(); |
return origins_; |
} |
@@ -116,9 +119,10 @@ class FileSystemQuotaClientTest : public testing::Test { |
void RunAdditionalOriginUsageTask(FileSystemQuotaClient* quota_client, |
const std::string& origin_url, |
quota::StorageType type) { |
- quota_client->GetOriginUsage(GURL(origin_url), type, |
- callback_factory_.NewCallback( |
- &FileSystemQuotaClientTest::OnGetAdditionalUsage)); |
+ quota_client->GetOriginUsage( |
+ GURL(origin_url), type, |
+ base::Bind(&FileSystemQuotaClientTest::OnGetAdditionalUsage, |
+ weak_factory_.GetWeakPtr())); |
} |
FilePath GetOriginBasePath(const std::string& origin_url, |
@@ -234,8 +238,8 @@ class FileSystemQuotaClientTest : public testing::Test { |
deletion_status_ = quota::kQuotaStatusUnknown; |
quota_client->DeleteOriginData( |
GURL(origin), type, |
- callback_factory_.NewCallback( |
- &FileSystemQuotaClientTest::OnDeleteOrigin)); |
+ base::Bind(&FileSystemQuotaClientTest::OnDeleteOrigin, |
+ weak_factory_.GetWeakPtr())); |
} |
int64 usage() const { return usage_; } |
@@ -266,7 +270,7 @@ class FileSystemQuotaClientTest : public testing::Test { |
ScopedTempDir data_dir_; |
scoped_refptr<FileSystemContext> file_system_context_; |
- base::ScopedCallbackFactory<FileSystemQuotaClientTest> callback_factory_; |
+ base::WeakPtrFactory<FileSystemQuotaClientTest> weak_factory_; |
int64 usage_; |
int additional_callback_count_; |
std::set<GURL> origins_; |