Support SizeClassIdiom on iOS7.
[chromium-blink-merge.git] / chrome / browser / browsing_data / mock_browsing_data_local_storage_helper.cc
blobccb0b72017e79111f073579b80a35e0cd53de97d
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"
9 #include "testing/gtest/include/gtest/gtest.h"
11 MockBrowsingDataLocalStorageHelper::MockBrowsingDataLocalStorageHelper(
12 Profile* profile)
13 : BrowsingDataLocalStorageHelper(profile) {
16 MockBrowsingDataLocalStorageHelper::~MockBrowsingDataLocalStorageHelper() {
19 void MockBrowsingDataLocalStorageHelper::StartFetching(
20 const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback) {
21 ASSERT_FALSE(callback.is_null());
22 ASSERT_TRUE(callback_.is_null());
23 callback_ = callback;
26 void MockBrowsingDataLocalStorageHelper::DeleteOrigin(
27 const GURL& origin) {
28 ASSERT_FALSE(callback_.is_null());
29 ASSERT_TRUE(origins_.find(origin) != origins_.end());
30 last_deleted_origin_ = origin;
31 origins_[origin] = false;
34 void MockBrowsingDataLocalStorageHelper::AddLocalStorageSamples() {
35 const GURL kOrigin1("http://host1:1/");
36 const GURL kOrigin2("http://host2:2/");
37 response_.push_back(
38 BrowsingDataLocalStorageHelper::LocalStorageInfo(
39 kOrigin1, 1, base::Time()));
40 origins_[kOrigin1] = true;
41 response_.push_back(
42 BrowsingDataLocalStorageHelper::LocalStorageInfo(
43 kOrigin2, 2, base::Time()));
44 origins_[kOrigin2] = true;
47 void MockBrowsingDataLocalStorageHelper::Notify() {
48 callback_.Run(response_);
51 void MockBrowsingDataLocalStorageHelper::Reset() {
52 for (std::map<const GURL, bool>::iterator i = origins_.begin();
53 i != origins_.end(); ++i)
54 i->second = true;
57 bool MockBrowsingDataLocalStorageHelper::AllDeleted() {
58 for (std::map<const GURL, bool>::const_iterator i =
59 origins_.begin(); i != origins_.end(); ++i)
60 if (i->second)
61 return false;
62 return true;