Make sure webrtc::VideoSource is released when WebRtcVideoTrackAdapter is destroyed.
[chromium-blink-merge.git] / components / dom_distiller / core / fake_db.h
blob8d03d982d828f4a30ab3f79faf8196c9c225aff5
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_
8 #include <string>
10 #include "components/dom_distiller/core/dom_distiller_database.h"
12 namespace dom_distiller {
13 namespace test {
15 class FakeDB : public DomDistillerDatabaseInterface {
16 typedef base::Callback<void(bool)> Callback;
18 public:
19 typedef base::hash_map<std::string, ArticleEntry> EntryMap;
21 explicit FakeDB(EntryMap* db);
22 virtual ~FakeDB();
24 virtual void Init(const base::FilePath& database_dir,
25 DomDistillerDatabaseInterface::InitCallback callback)
26 OVERRIDE;
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)
34 OVERRIDE;
35 base::FilePath& GetDirectory();
37 void InitCallback(bool success);
39 void LoadCallback(bool success);
41 void UpdateCallback(bool success);
43 static base::FilePath DirectoryForTestDB();
45 private:
46 static void RunLoadCallback(
47 DomDistillerDatabaseInterface::LoadCallback callback,
48 scoped_ptr<EntryVector> entries,
49 bool success);
51 base::FilePath dir_;
52 EntryMap* db_;
54 Callback init_callback_;
55 Callback load_callback_;
56 Callback update_callback_;
59 } // namespace test
60 } // namespace dom_distiller
62 #endif // COMPONENTS_DOM_DISTILLER_CORE_FAKE_DB_H_