cros: Remove default pinned apps trial.
[chromium-blink-merge.git] / chrome / browser / browsing_data / mock_browsing_data_database_helper.cc
blob3db7ca9fe3adcfee15931a10577b1c38b16fe65f
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_database_helper.h"
7 #include "base/callback.h"
9 MockBrowsingDataDatabaseHelper::MockBrowsingDataDatabaseHelper(
10 Profile* profile)
11 : BrowsingDataDatabaseHelper(profile) {
14 MockBrowsingDataDatabaseHelper::~MockBrowsingDataDatabaseHelper() {
17 void MockBrowsingDataDatabaseHelper::StartFetching(
18 const base::Callback<void(const std::list<DatabaseInfo>&)>& callback) {
19 callback_ = callback;
22 void MockBrowsingDataDatabaseHelper::DeleteDatabase(
23 const std::string& origin,
24 const std::string& name) {
25 std::string key = origin + ":" + name;
26 CHECK(databases_.find(key) != databases_.end());
27 last_deleted_origin_ = origin;
28 last_deleted_db_ = name;
29 databases_[key] = false;
32 void MockBrowsingDataDatabaseHelper::AddDatabaseSamples() {
33 webkit_database::DatabaseIdentifier id1 =
34 webkit_database::DatabaseIdentifier::Parse("http_gdbhost1_1");
35 response_.push_back(BrowsingDataDatabaseHelper::DatabaseInfo(
36 id1, "db1", "description 1", 1, base::Time()));
37 databases_["http_gdbhost1_1:db1"] = true;
38 webkit_database::DatabaseIdentifier id2 =
39 webkit_database::DatabaseIdentifier::Parse("http_gdbhost2_2");
40 response_.push_back(BrowsingDataDatabaseHelper::DatabaseInfo(
41 id2, "db2", "description 2", 2, base::Time()));
42 databases_["http_gdbhost2_2:db2"] = true;
45 void MockBrowsingDataDatabaseHelper::Notify() {
46 CHECK_EQ(false, callback_.is_null());
47 callback_.Run(response_);
50 void MockBrowsingDataDatabaseHelper::Reset() {
51 for (std::map<const std::string, bool>::iterator i = databases_.begin();
52 i != databases_.end(); ++i)
53 i->second = true;
56 bool MockBrowsingDataDatabaseHelper::AllDeleted() {
57 for (std::map<const std::string, bool>::const_iterator i = databases_.begin();
58 i != databases_.end(); ++i)
59 if (i->second)
60 return false;
61 return true;