Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: chrome/browser/mock_browsing_data_database_helper.cc

Issue 10805015: Move browsing_data_helper files into a separate directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix chrome_frame build Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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/mock_browsing_data_database_helper.h"
6
7 #include "base/callback.h"
8
9 MockBrowsingDataDatabaseHelper::MockBrowsingDataDatabaseHelper(
10 Profile* profile)
11 : BrowsingDataDatabaseHelper(profile) {
12 }
13
14 MockBrowsingDataDatabaseHelper::~MockBrowsingDataDatabaseHelper() {
15 }
16
17 void MockBrowsingDataDatabaseHelper::StartFetching(
18 const base::Callback<void(const std::list<DatabaseInfo>&)>& callback) {
19 callback_ = callback;
20 }
21
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;
30 }
31
32 void MockBrowsingDataDatabaseHelper::AddDatabaseSamples() {
33 response_.push_back(BrowsingDataDatabaseHelper::DatabaseInfo(
34 "gdbhost1", "db1", "http_gdbhost1_1", "description 1",
35 "http://gdbhost1:1/", 1, base::Time()));
36 databases_["http_gdbhost1_1:db1"] = true;
37 response_.push_back(BrowsingDataDatabaseHelper::DatabaseInfo(
38 "gdbhost2", "db2", "http_gdbhost2_2", "description 2",
39 "http://gdbhost2:2/", 2, base::Time()));
40 databases_["http_gdbhost2_2:db2"] = true;
41 }
42
43 void MockBrowsingDataDatabaseHelper::Notify() {
44 CHECK_EQ(false, callback_.is_null());
45 callback_.Run(response_);
46 }
47
48 void MockBrowsingDataDatabaseHelper::Reset() {
49 for (std::map<const std::string, bool>::iterator i = databases_.begin();
50 i != databases_.end(); ++i)
51 i->second = true;
52 }
53
54 bool MockBrowsingDataDatabaseHelper::AllDeleted() {
55 for (std::map<const std::string, bool>::const_iterator i = databases_.begin();
56 i != databases_.end(); ++i)
57 if (i->second)
58 return false;
59 return true;
60 }
OLDNEW
« no previous file with comments | « chrome/browser/mock_browsing_data_database_helper.h ('k') | chrome/browser/mock_browsing_data_file_system_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698