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

Unified Diff: chrome/browser/browsing_data_quota_helper_unittest.cc

Issue 8070001: Use base::Callback in Quota related code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 2 months 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 | « chrome/browser/browsing_data_quota_helper_impl.cc ('k') | chrome/browser/browsing_data_remover.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browsing_data_quota_helper_unittest.cc
diff --git a/chrome/browser/browsing_data_quota_helper_unittest.cc b/chrome/browser/browsing_data_quota_helper_unittest.cc
index bb0d67750e6f6ef39204e54706b1b32b775b0831..12ee98a410d2b5af7ce85aa2e220def85212e6af 100644
--- a/chrome/browser/browsing_data_quota_helper_unittest.cc
+++ b/chrome/browser/browsing_data_quota_helper_unittest.cc
@@ -4,6 +4,7 @@
#include "testing/gtest/include/gtest/gtest.h"
+#include "base/bind.h"
#include "base/memory/scoped_callback_factory.h"
#include "base/message_loop_proxy.h"
#include "base/scoped_temp_dir.h"
@@ -22,6 +23,7 @@ class BrowsingDataQuotaHelperTest : public testing::Test {
io_thread_(BrowserThread::IO, &message_loop_),
fetching_completed_(true),
quota_(-1),
+ weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {}
virtual ~BrowsingDataQuotaHelperTest() {}
@@ -73,15 +75,17 @@ class BrowsingDataQuotaHelperTest : public testing::Test {
void SetPersistentHostQuota(const std::string& host, int64 quota) {
quota_ = -1;
quota_manager_->SetPersistentHostQuota(
- host, quota, callback_factory_.NewCallback(
- &BrowsingDataQuotaHelperTest::GotPersistentHostQuota));
+ host, quota,
+ base::Bind(&BrowsingDataQuotaHelperTest::GotPersistentHostQuota,
+ weak_factory_.GetWeakPtr()));
}
void GetPersistentHostQuota(const std::string& host) {
quota_ = -1;
quota_manager_->GetPersistentHostQuota(
- host, callback_factory_.NewCallback(
- &BrowsingDataQuotaHelperTest::GotPersistentHostQuota));
+ host,
+ base::Bind(&BrowsingDataQuotaHelperTest::GotPersistentHostQuota,
+ weak_factory_.GetWeakPtr()));
}
void GotPersistentHostQuota(quota::QuotaStatusCode status,
@@ -119,6 +123,7 @@ class BrowsingDataQuotaHelperTest : public testing::Test {
bool fetching_completed_;
QuotaInfoArray quota_info_;
int64 quota_;
+ base::WeakPtrFactory<BrowsingDataQuotaHelperTest> weak_factory_;
base::ScopedCallbackFactory<BrowsingDataQuotaHelperTest> callback_factory_;
DISALLOW_COPY_AND_ASSIGN(BrowsingDataQuotaHelperTest);
« no previous file with comments | « chrome/browser/browsing_data_quota_helper_impl.cc ('k') | chrome/browser/browsing_data_remover.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698