Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / browsing_data / mock_browsing_data_quota_helper.cc
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/browsing_data/mock_browsing_data_quota_helper.h"
6
7 #include "content/public/browser/browser_thread.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 using content::BrowserThread;
11
12 MockBrowsingDataQuotaHelper::MockBrowsingDataQuotaHelper(Profile* profile)
13     : BrowsingDataQuotaHelper(BrowserThread::GetMessageLoopProxyForThread(
14           BrowserThread::IO).get()) {}
15
16 MockBrowsingDataQuotaHelper::~MockBrowsingDataQuotaHelper() {}
17
18 void MockBrowsingDataQuotaHelper::StartFetching(
19     const FetchResultCallback& callback) {
20   ASSERT_FALSE(callback.is_null());
21   ASSERT_TRUE(callback_.is_null());
22   callback_ = callback;
23 }
24
25 void MockBrowsingDataQuotaHelper::RevokeHostQuota(const std::string& host) {
26 }
27
28 void MockBrowsingDataQuotaHelper::AddHost(
29     const std::string& host,
30     int64 temporary_usage,
31     int64 persistent_usage,
32     int64 syncable_usage) {
33   response_.push_back(QuotaInfo(
34       host,
35       temporary_usage,
36       persistent_usage,
37       syncable_usage));
38 }
39
40 void MockBrowsingDataQuotaHelper::AddQuotaSamples() {
41   AddHost("quotahost1", 1, 2, 1);
42   AddHost("quotahost2", 10, 20, 10);
43 }
44
45 void MockBrowsingDataQuotaHelper::Notify() {
46   callback_.Run(response_);
47   callback_.Reset();
48   response_.clear();
49 }