OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/browsing_data/mock_browsing_data_quota_helper.h" | 5 #include "chrome/browser/browsing_data/mock_browsing_data_quota_helper.h" |
6 | 6 |
7 #include "content/public/browser/browser_thread.h" | 7 #include "content/public/browser/browser_thread.h" |
8 | 8 |
9 using content::BrowserThread; | 9 using content::BrowserThread; |
10 | 10 |
11 MockBrowsingDataQuotaHelper::MockBrowsingDataQuotaHelper(Profile* profile) | 11 MockBrowsingDataQuotaHelper::MockBrowsingDataQuotaHelper(Profile* profile) |
12 : BrowsingDataQuotaHelper(BrowserThread::GetMessageLoopProxyForThread( | 12 : BrowsingDataQuotaHelper(BrowserThread::GetMessageLoopProxyForThread( |
13 BrowserThread::IO)) {} | 13 BrowserThread::IO)) {} |
14 | 14 |
15 MockBrowsingDataQuotaHelper::~MockBrowsingDataQuotaHelper() {} | 15 MockBrowsingDataQuotaHelper::~MockBrowsingDataQuotaHelper() {} |
16 | 16 |
17 void MockBrowsingDataQuotaHelper::StartFetching( | 17 void MockBrowsingDataQuotaHelper::StartFetching( |
18 const FetchResultCallback& callback) { | 18 const FetchResultCallback& callback) { |
19 callback_ = callback; | 19 callback_ = callback; |
20 } | 20 } |
21 | 21 |
22 void MockBrowsingDataQuotaHelper::RevokeHostQuota(const std::string& host) { | 22 void MockBrowsingDataQuotaHelper::RevokeHostQuota(const std::string& host) { |
23 } | 23 } |
24 | 24 |
25 void MockBrowsingDataQuotaHelper::AddHost( | 25 void MockBrowsingDataQuotaHelper::AddHost( |
26 const std::string& host, | 26 const std::string& host, |
27 int64 temporary_usage, | 27 int64 temporary_usage, |
28 int64 persistent_usage) { | 28 int64 persistent_usage, |
| 29 int64 syncable_usage) { |
29 response_.push_back(QuotaInfo( | 30 response_.push_back(QuotaInfo( |
30 host, | 31 host, |
31 temporary_usage, | 32 temporary_usage, |
32 persistent_usage)); | 33 persistent_usage, |
| 34 syncable_usage)); |
33 } | 35 } |
34 | 36 |
35 void MockBrowsingDataQuotaHelper::AddQuotaSamples() { | 37 void MockBrowsingDataQuotaHelper::AddQuotaSamples() { |
36 AddHost("quotahost1", 1, 2); | 38 AddHost("quotahost1", 1, 2, 1); |
37 AddHost("quotahost2", 10, 20); | 39 AddHost("quotahost2", 10, 20, 10); |
38 } | 40 } |
39 | 41 |
40 void MockBrowsingDataQuotaHelper::Notify() { | 42 void MockBrowsingDataQuotaHelper::Notify() { |
41 CHECK_EQ(false, callback_.is_null()); | 43 CHECK_EQ(false, callback_.is_null()); |
42 callback_.Run(response_); | 44 callback_.Run(response_); |
43 callback_.Reset(); | 45 callback_.Reset(); |
44 response_.clear(); | 46 response_.clear(); |
45 } | 47 } |
OLD | NEW |