cros: Remove default pinned apps trial.
[chromium-blink-merge.git] / chrome / browser / browsing_data / mock_browsing_data_indexed_db_helper.cc
blobc933bb9a05d5b68a2a04d20e726a982ff4ccdfbd
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_indexed_db_helper.h"
7 #include "base/callback.h"
8 #include "base/logging.h"
10 MockBrowsingDataIndexedDBHelper::MockBrowsingDataIndexedDBHelper() {
13 MockBrowsingDataIndexedDBHelper::~MockBrowsingDataIndexedDBHelper() {
16 void MockBrowsingDataIndexedDBHelper::StartFetching(
17 const base::Callback<void(const std::list<content::IndexedDBInfo>&)>&
18 callback) {
19 callback_ = callback;
22 void MockBrowsingDataIndexedDBHelper::DeleteIndexedDB(
23 const GURL& origin) {
24 CHECK(origins_.find(origin) != origins_.end());
25 origins_[origin] = false;
28 void MockBrowsingDataIndexedDBHelper::AddIndexedDBSamples() {
29 const GURL kOrigin1("http://idbhost1:1/");
30 const GURL kOrigin2("http://idbhost2:2/");
31 content::IndexedDBInfo info1(kOrigin1, 1, base::Time(), base::FilePath(), 0);
32 response_.push_back(info1);
33 origins_[kOrigin1] = true;
34 content::IndexedDBInfo info2(kOrigin2, 2, base::Time(), base::FilePath(), 0);
35 response_.push_back(info2);
36 origins_[kOrigin2] = true;
39 void MockBrowsingDataIndexedDBHelper::Notify() {
40 CHECK_EQ(false, callback_.is_null());
41 callback_.Run(response_);
44 void MockBrowsingDataIndexedDBHelper::Reset() {
45 for (std::map<GURL, bool>::iterator i = origins_.begin();
46 i != origins_.end(); ++i)
47 i->second = true;
50 bool MockBrowsingDataIndexedDBHelper::AllDeleted() {
51 for (std::map<GURL, bool>::const_iterator i = origins_.begin();
52 i != origins_.end(); ++i)
53 if (i->second)
54 return false;
55 return true;