blob: b7981f4570b6107d898068741fab6744b0acc8bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_HISTORY_CORE_TEST_HISTORY_BACKEND_DB_BASE_TEST_H_
#define COMPONENTS_HISTORY_CORE_TEST_HISTORY_BACKEND_DB_BASE_TEST_H_
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "components/history/core/test/history_unittest_base.h"
#include "sql/init_status.h"
namespace base {
class Time;
}
namespace history {
class BackendDelegate;
class HistoryBackend;
class HistoryDatabase;
class InMemoryHistoryBackend;
enum class DownloadState;
// This must be outside the anonymous namespace for the friend statement in
// HistoryBackend to work.
class HistoryBackendDBBaseTest : public HistoryUnitTestBase {
public:
HistoryBackendDBBaseTest();
~HistoryBackendDBBaseTest() override;
protected:
friend class BackendDelegate;
// testing::Test
void SetUp() override;
void TearDown() override;
// Creates the HistoryBackend and HistoryDatabase on the current thread,
// assigning the values to backend_ and db_.
void CreateBackendAndDatabase();
void CreateBackendAndDatabaseAllowFail();
void CreateDBVersion(int version);
void CreateArchivedDB();
void DeleteBackend();
bool AddDownload(uint32 id, DownloadState state, base::Time time);
base::ScopedTempDir temp_dir_;
base::MessageLoopForUI message_loop_;
// names of the database files
base::FilePath history_dir_;
// Created via CreateBackendAndDatabase.
scoped_refptr<HistoryBackend> backend_;
scoped_ptr<InMemoryHistoryBackend> in_mem_backend_;
HistoryDatabase* db_; // Cached reference to the backend's database.
sql::InitStatus last_profile_error_;
};
} // namespace history
#endif // COMPONENTS_HISTORY_CORE_TEST_HISTORY_BACKEND_DB_BASE_TEST_H_
|