Index: content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc |
diff --git a/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc b/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc |
index d36f21768996cd3ebd0b7d6f2f173495d3ccf4e8..0b9d27449d5693717ea15398655681785bd3df11 100644 |
--- a/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc |
+++ b/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc |
@@ -4,6 +4,7 @@ |
#include <map> |
+#include "base/bind.h" |
#include "base/file_path.h" |
#include "base/file_util.h" |
#include "base/memory/scoped_callback_factory.h" |
@@ -35,7 +36,7 @@ class IndexedDBQuotaClientTest : public testing::Test { |
kOriginB("http://host:8000"), |
kOriginOther("http://other"), |
usage_(0), |
- callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
+ weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
message_loop_(MessageLoop::TYPE_IO), |
webkit_thread_(BrowserThread::WEBKIT, &message_loop_), |
io_thread_(BrowserThread::IO, &message_loop_) { |
@@ -64,9 +65,10 @@ class IndexedDBQuotaClientTest : public testing::Test { |
const GURL& origin, |
quota::StorageType type) { |
usage_ = -1; |
- client->GetOriginUsage(origin, type, |
- callback_factory_.NewCallback( |
- &IndexedDBQuotaClientTest::OnGetOriginUsageComplete)); |
+ client->GetOriginUsage( |
+ origin, type, |
+ base::Bind(&IndexedDBQuotaClientTest::OnGetOriginUsageComplete, |
+ weak_factory_.GetWeakPtr())); |
MessageLoop::current()->RunAllPending(); |
EXPECT_GT(usage_, -1); |
return usage_; |
@@ -77,9 +79,10 @@ class IndexedDBQuotaClientTest : public testing::Test { |
quota::StorageType type) { |
origins_.clear(); |
type_ = quota::kStorageTypeTemporary; |
- client->GetOriginsForType(type, |
- callback_factory_.NewCallback( |
- &IndexedDBQuotaClientTest::OnGetOriginsComplete)); |
+ client->GetOriginsForType( |
+ type, |
+ base::Bind(&IndexedDBQuotaClientTest::OnGetOriginsComplete, |
+ weak_factory_.GetWeakPtr())); |
MessageLoop::current()->RunAllPending(); |
return origins_; |
} |
@@ -90,9 +93,10 @@ class IndexedDBQuotaClientTest : public testing::Test { |
const std::string& host) { |
origins_.clear(); |
type_ = quota::kStorageTypeTemporary; |
- client->GetOriginsForHost(type, host, |
- callback_factory_.NewCallback( |
- &IndexedDBQuotaClientTest::OnGetOriginsComplete)); |
+ client->GetOriginsForHost( |
+ type, host, |
+ base::Bind(&IndexedDBQuotaClientTest::OnGetOriginsComplete, |
+ weak_factory_.GetWeakPtr())); |
MessageLoop::current()->RunAllPending(); |
return origins_; |
} |
@@ -100,8 +104,10 @@ class IndexedDBQuotaClientTest : public testing::Test { |
quota::QuotaStatusCode DeleteOrigin(quota::QuotaClient* client, |
const GURL& origin_url) { |
delete_status_ = quota::kQuotaStatusUnknown; |
- client->DeleteOriginData(origin_url, kTemp, callback_factory_.NewCallback( |
- &IndexedDBQuotaClientTest::OnDeleteOriginComplete)); |
+ client->DeleteOriginData( |
+ origin_url, kTemp, |
+ base::Bind(&IndexedDBQuotaClientTest::OnDeleteOriginComplete, |
+ weak_factory_.GetWeakPtr())); |
MessageLoop::current()->RunAllPending(); |
return delete_status_; |
} |
@@ -145,7 +151,7 @@ class IndexedDBQuotaClientTest : public testing::Test { |
std::set<GURL> origins_; |
quota::StorageType type_; |
scoped_refptr<IndexedDBContext> idb_context_; |
- base::ScopedCallbackFactory<IndexedDBQuotaClientTest> callback_factory_; |
+ base::WeakPtrFactory<IndexedDBQuotaClientTest> weak_factory_; |
MessageLoop message_loop_; |
BrowserThread webkit_thread_; |
BrowserThread io_thread_; |