| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/dom_distiller/core/fake_db.h" | 5 #include "components/dom_distiller/core/fake_db.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 | 8 |
| 9 namespace dom_distiller { | 9 namespace dom_distiller { |
| 10 namespace test { | 10 namespace test { |
| 11 | 11 |
| 12 FakeDB::FakeDB(EntryMap* db) : db_(db) {} | 12 FakeDB::FakeDB(EntryMap* db) : db_(db) {} |
| 13 | 13 |
| 14 FakeDB::~FakeDB() {} | 14 FakeDB::~FakeDB() {} |
| 15 | 15 |
| 16 void FakeDB::Init(const base::FilePath& database_dir, | 16 void FakeDB::Init(const base::FilePath& database_dir, |
| 17 DomDistillerDatabaseInterface::InitCallback callback) { | 17 DomDistillerDatabaseInterface::InitCallback callback) { |
| 18 dir_ = database_dir; | 18 dir_ = database_dir; |
| 19 init_callback_ = callback; | 19 init_callback_ = callback; |
| 20 } | 20 } |
| 21 | 21 |
| 22 void FakeDB::UpdateEntries( | 22 void FakeDB::UpdateEntries( |
| 23 scoped_ptr<EntryVector> entries_to_save, | 23 scoped_ptr<EntryVector> entries_to_save, |
| 24 scoped_ptr<EntryVector> entries_to_remove, | 24 scoped_ptr<EntryVector> entries_to_remove, |
| 25 DomDistillerDatabaseInterface::UpdateCallback callback) { | 25 DomDistillerDatabaseInterface::UpdateCallback callback) { |
| 26 for (EntryVector::iterator it = entries_to_save->begin(); | 26 for (EntryVector::iterator it = entries_to_save->begin(); |
| 27 it != entries_to_save->end(); | 27 it != entries_to_save->end(); |
| 28 ++it) { | 28 ++it) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 callback.Run(success, entries.Pass()); | 70 callback.Run(success, entries.Pass()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 // static | 73 // static |
| 74 base::FilePath FakeDB::DirectoryForTestDB() { | 74 base::FilePath FakeDB::DirectoryForTestDB() { |
| 75 return base::FilePath(FILE_PATH_LITERAL("/fake/path")); | 75 return base::FilePath(FILE_PATH_LITERAL("/fake/path")); |
| 76 } | 76 } |
| 77 | 77 |
| 78 } // namespace test | 78 } // namespace test |
| 79 } // namespace dom_distiller | 79 } // namespace dom_distiller |
| OLD | NEW |