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.
5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_FAKE_DB_H_
6 #define COMPONENTS_DOM_DISTILLER_CORE_FAKE_DB_H_
10 #include "components/dom_distiller/core/dom_distiller_database.h"
12 namespace dom_distiller
{
15 class FakeDB
: public DomDistillerDatabaseInterface
{
16 typedef base::Callback
<void(bool)> Callback
;
19 typedef base::hash_map
<std::string
, ArticleEntry
> EntryMap
;
21 explicit FakeDB(EntryMap
* db
);
24 virtual void Init(const base::FilePath
& database_dir
,
25 DomDistillerDatabaseInterface::InitCallback callback
)
28 virtual void UpdateEntries(
29 scoped_ptr
<EntryVector
> entries_to_save
,
30 scoped_ptr
<EntryVector
> entries_to_remove
,
31 DomDistillerDatabaseInterface::UpdateCallback callback
) OVERRIDE
;
33 virtual void LoadEntries(DomDistillerDatabaseInterface::LoadCallback callback
)
35 base::FilePath
& GetDirectory();
37 void InitCallback(bool success
);
39 void LoadCallback(bool success
);
41 void UpdateCallback(bool success
);
43 static base::FilePath
DirectoryForTestDB();
46 static void RunLoadCallback(
47 DomDistillerDatabaseInterface::LoadCallback callback
,
48 scoped_ptr
<EntryVector
> entries
,
54 Callback init_callback_
;
55 Callback load_callback_
;
56 Callback update_callback_
;
60 } // namespace dom_distiller
62 #endif // COMPONENTS_DOM_DISTILLER_CORE_FAKE_DB_H_