| 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" |
| 9 #include "base/single_thread_task_runner.h" |
| 8 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 9 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
| 10 #include "components/history/core/browser/download_constants.h" | 12 #include "components/history/core/browser/download_constants.h" |
| 11 #include "components/history/core/browser/download_row.h" | 13 #include "components/history/core/browser/download_row.h" |
| 12 #include "components/history/core/browser/history_backend.h" | 14 #include "components/history/core/browser/history_backend.h" |
| 13 #include "components/history/core/browser/history_constants.h" | 15 #include "components/history/core/browser/history_constants.h" |
| 14 #include "components/history/core/browser/history_database_params.h" | 16 #include "components/history/core/browser/history_database_params.h" |
| 15 #include "components/history/core/browser/in_memory_history_backend.h" | 17 #include "components/history/core/browser/in_memory_history_backend.h" |
| 16 #include "components/history/core/test/database_test_utils.h" | 18 #include "components/history/core/test/database_test_utils.h" |
| 17 #include "components/history/core/test/test_history_database.h" | 19 #include "components/history/core/test/test_history_database.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 64 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 63 history_dir_ = temp_dir_.path().AppendASCII("HistoryBackendDBBaseTest"); | 65 history_dir_ = temp_dir_.path().AppendASCII("HistoryBackendDBBaseTest"); |
| 64 ASSERT_TRUE(base::CreateDirectory(history_dir_)); | 66 ASSERT_TRUE(base::CreateDirectory(history_dir_)); |
| 65 } | 67 } |
| 66 | 68 |
| 67 void HistoryBackendDBBaseTest::TearDown() { | 69 void HistoryBackendDBBaseTest::TearDown() { |
| 68 DeleteBackend(); | 70 DeleteBackend(); |
| 69 | 71 |
| 70 // Make sure we don't have any event pending that could disrupt the next | 72 // Make sure we don't have any event pending that could disrupt the next |
| 71 // test. | 73 // test. |
| 72 base::MessageLoop::current()->PostTask(FROM_HERE, | 74 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 73 base::MessageLoop::QuitClosure()); | 75 FROM_HERE, base::MessageLoop::QuitClosure()); |
| 74 base::MessageLoop::current()->Run(); | 76 base::MessageLoop::current()->Run(); |
| 75 } | 77 } |
| 76 | 78 |
| 77 void HistoryBackendDBBaseTest::CreateBackendAndDatabase() { | 79 void HistoryBackendDBBaseTest::CreateBackendAndDatabase() { |
| 78 backend_ = new HistoryBackend(new BackendDelegate(this), nullptr, | 80 backend_ = new HistoryBackend(new BackendDelegate(this), nullptr, |
| 79 base::ThreadTaskRunnerHandle::Get()); | 81 base::ThreadTaskRunnerHandle::Get()); |
| 80 backend_->Init(std::string(), false, | 82 backend_->Init(std::string(), false, |
| 81 TestHistoryDatabaseParamsForPath(history_dir_)); | 83 TestHistoryDatabaseParamsForPath(history_dir_)); |
| 82 db_ = backend_->db_.get(); | 84 db_ = backend_->db_.get(); |
| 83 DCHECK(in_mem_backend_) << "Mem backend should have been set by " | 85 DCHECK(in_mem_backend_) << "Mem backend should have been set by " |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 DownloadDangerType::NOT_DANGEROUS, | 132 DownloadDangerType::NOT_DANGEROUS, |
| 131 kTestDownloadInterruptReasonNone, | 133 kTestDownloadInterruptReasonNone, |
| 132 id, | 134 id, |
| 133 false, | 135 false, |
| 134 "by_ext_id", | 136 "by_ext_id", |
| 135 "by_ext_name"); | 137 "by_ext_name"); |
| 136 return db_->CreateDownload(download); | 138 return db_->CreateDownload(download); |
| 137 } | 139 } |
| 138 | 140 |
| 139 } // namespace history | 141 } // namespace history |
| OLD | NEW |