| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/history/core/test/history_backend_db_base_test.h" | 5 #include "components/history/core/test/history_backend_db_base_test.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // Make sure we don't have any event pending that could disrupt the next | 78 // Make sure we don't have any event pending that could disrupt the next |
| 79 // test. | 79 // test. |
| 80 base::ThreadTaskRunnerHandle::Get()->PostTask( | 80 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 81 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 81 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
| 82 base::MessageLoop::current()->Run(); | 82 base::MessageLoop::current()->Run(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void HistoryBackendDBBaseTest::CreateBackendAndDatabase() { | 85 void HistoryBackendDBBaseTest::CreateBackendAndDatabase() { |
| 86 backend_ = new HistoryBackend(new BackendDelegate(this), nullptr, | 86 backend_ = new HistoryBackend(new BackendDelegate(this), nullptr, |
| 87 base::ThreadTaskRunnerHandle::Get()); | 87 base::ThreadTaskRunnerHandle::Get()); |
| 88 backend_->Init(std::string(), false, | 88 backend_->Init(false, |
| 89 TestHistoryDatabaseParamsForPath(history_dir_)); | 89 TestHistoryDatabaseParamsForPath(history_dir_)); |
| 90 db_ = backend_->db_.get(); | 90 db_ = backend_->db_.get(); |
| 91 DCHECK(in_mem_backend_) << "Mem backend should have been set by " | 91 DCHECK(in_mem_backend_) << "Mem backend should have been set by " |
| 92 "HistoryBackend::Init"; | 92 "HistoryBackend::Init"; |
| 93 } | 93 } |
| 94 | 94 |
| 95 void HistoryBackendDBBaseTest::CreateBackendAndDatabaseAllowFail() { | 95 void HistoryBackendDBBaseTest::CreateBackendAndDatabaseAllowFail() { |
| 96 backend_ = new HistoryBackend(new BackendDelegate(this), nullptr, | 96 backend_ = new HistoryBackend(new BackendDelegate(this), nullptr, |
| 97 base::ThreadTaskRunnerHandle::Get()); | 97 base::ThreadTaskRunnerHandle::Get()); |
| 98 backend_->Init(std::string(), false, | 98 backend_->Init(false, |
| 99 TestHistoryDatabaseParamsForPath(history_dir_)); | 99 TestHistoryDatabaseParamsForPath(history_dir_)); |
| 100 db_ = backend_->db_.get(); | 100 db_ = backend_->db_.get(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void HistoryBackendDBBaseTest::CreateDBVersion(int version) { | 103 void HistoryBackendDBBaseTest::CreateDBVersion(int version) { |
| 104 base::FilePath data_path; | 104 base::FilePath data_path; |
| 105 ASSERT_TRUE(GetTestDataHistoryDir(&data_path)); | 105 ASSERT_TRUE(GetTestDataHistoryDir(&data_path)); |
| 106 data_path = | 106 data_path = |
| 107 data_path.AppendASCII(base::StringPrintf("history.%d.sql", version)); | 107 data_path.AppendASCII(base::StringPrintf("history.%d.sql", version)); |
| 108 ASSERT_NO_FATAL_FAILURE( | 108 ASSERT_NO_FATAL_FAILURE( |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 std::string(), | 142 std::string(), |
| 143 id, | 143 id, |
| 144 guid, | 144 guid, |
| 145 false, | 145 false, |
| 146 "by_ext_id", | 146 "by_ext_id", |
| 147 "by_ext_name"); | 147 "by_ext_name"); |
| 148 return db_->CreateDownload(download); | 148 return db_->CreateDownload(download); |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace history | 151 } // namespace history |
| OLD | NEW |