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.
5 #include "chrome/browser/browsing_data/mock_browsing_data_local_storage_helper.h"
7 #include "base/callback.h"
8 #include "base/logging.h"
10 MockBrowsingDataLocalStorageHelper::MockBrowsingDataLocalStorageHelper(
12 : BrowsingDataLocalStorageHelper(profile
) {
15 MockBrowsingDataLocalStorageHelper::~MockBrowsingDataLocalStorageHelper() {
18 void MockBrowsingDataLocalStorageHelper::StartFetching(
19 const base::Callback
<void(const std::list
<LocalStorageInfo
>&)>& callback
) {
23 void MockBrowsingDataLocalStorageHelper::DeleteOrigin(
25 CHECK(origins_
.find(origin
) != origins_
.end());
26 last_deleted_origin_
= origin
;
27 origins_
[origin
] = false;
30 void MockBrowsingDataLocalStorageHelper::AddLocalStorageSamples() {
31 const GURL
kOrigin1("http://host1:1/");
32 const GURL
kOrigin2("http://host2:2/");
34 BrowsingDataLocalStorageHelper::LocalStorageInfo(
35 kOrigin1
, 1, base::Time()));
36 origins_
[kOrigin1
] = true;
38 BrowsingDataLocalStorageHelper::LocalStorageInfo(
39 kOrigin2
, 2, base::Time()));
40 origins_
[kOrigin2
] = true;
43 void MockBrowsingDataLocalStorageHelper::Notify() {
44 CHECK_EQ(false, callback_
.is_null());
45 callback_
.Run(response_
);
48 void MockBrowsingDataLocalStorageHelper::Reset() {
49 for (std::map
<const GURL
, bool>::iterator i
= origins_
.begin();
50 i
!= origins_
.end(); ++i
)
54 bool MockBrowsingDataLocalStorageHelper::AllDeleted() {
55 for (std::map
<const GURL
, bool>::const_iterator i
=
56 origins_
.begin(); i
!= origins_
.end(); ++i
)