| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/mock_browsing_data_quota_helper.h" | |
| 6 | |
| 7 MockBrowsingDataQuotaHelper::MockBrowsingDataQuotaHelper(Profile* profile) | |
| 8 : BrowsingDataQuotaHelper(BrowserThread::GetMessageLoopProxyForThread( | |
| 9 BrowserThread::IO)) {} | |
| 10 | |
| 11 MockBrowsingDataQuotaHelper::~MockBrowsingDataQuotaHelper() {} | |
| 12 | |
| 13 void MockBrowsingDataQuotaHelper::StartFetching( | |
| 14 FetchResultCallback* callback) { | |
| 15 callback_.reset(callback); | |
| 16 } | |
| 17 | |
| 18 void MockBrowsingDataQuotaHelper::CancelNotification() { | |
| 19 callback_.reset(NULL); | |
| 20 } | |
| 21 | |
| 22 void MockBrowsingDataQuotaHelper::AddHost( | |
| 23 const std::string& host, | |
| 24 int64 temporary_usage, | |
| 25 int64 persistent_usage) { | |
| 26 response_.push_back(QuotaInfo( | |
| 27 host, | |
| 28 temporary_usage, | |
| 29 persistent_usage)); | |
| 30 } | |
| 31 | |
| 32 void MockBrowsingDataQuotaHelper::AddQuotaSamples() { | |
| 33 AddHost("quotahost1", 1, 2); | |
| 34 AddHost("quotahost2", 10, 20); | |
| 35 } | |
| 36 | |
| 37 void MockBrowsingDataQuotaHelper::Notify() { | |
| 38 CHECK(callback_.get()); | |
| 39 callback_->Run(response_); | |
| 40 callback_.reset(); | |
| 41 response_.clear(); | |
| 42 } | |
| OLD | NEW |