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

Side by Side Diff: components/dom_distiller/core/fake_db.h

Issue 330833002: Extract protobuf database into a new 'leveldb_proto' component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved out of core/ Created 6 years, 6 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 2013 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 #ifndef COMPONENTS_DOM_DISTILLER_CORE_FAKE_DB_H_
6 #define COMPONENTS_DOM_DISTILLER_CORE_FAKE_DB_H_
7
8 #include <string>
9
10 #include "components/dom_distiller/core/dom_distiller_database.h"
11
12 namespace dom_distiller {
13 namespace test {
14
15 class FakeDB : public DomDistillerDatabaseInterface {
16 typedef base::Callback<void(bool)> Callback;
17
18 public:
19 typedef base::hash_map<std::string, ArticleEntry> EntryMap;
20
21 explicit FakeDB(EntryMap* db);
22 virtual ~FakeDB();
23
24 virtual void Init(const base::FilePath& database_dir,
25 DomDistillerDatabaseInterface::InitCallback callback)
26 OVERRIDE;
27
28 virtual void UpdateEntries(
29 scoped_ptr<EntryVector> entries_to_save,
30 scoped_ptr<EntryVector> entries_to_remove,
31 DomDistillerDatabaseInterface::UpdateCallback callback) OVERRIDE;
32
33 virtual void LoadEntries(DomDistillerDatabaseInterface::LoadCallback callback)
34 OVERRIDE;
35 base::FilePath& GetDirectory();
36
37 void InitCallback(bool success);
38
39 void LoadCallback(bool success);
40
41 void UpdateCallback(bool success);
42
43 static base::FilePath DirectoryForTestDB();
44
45 private:
46 static void RunLoadCallback(
47 DomDistillerDatabaseInterface::LoadCallback callback,
48 scoped_ptr<EntryVector> entries,
49 bool success);
50
51 base::FilePath dir_;
52 EntryMap* db_;
53
54 Callback init_callback_;
55 Callback load_callback_;
56 Callback update_callback_;
57 };
58
59 } // namespace test
60 } // namespace dom_distiller
61
62 #endif // COMPONENTS_DOM_DISTILLER_CORE_FAKE_DB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698