| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 history_dir_ = temp_dir_.path().AppendASCII("HistoryBackendDBBaseTest"); | 71 history_dir_ = temp_dir_.path().AppendASCII("HistoryBackendDBBaseTest"); |
| 72 ASSERT_TRUE(base::CreateDirectory(history_dir_)); | 72 ASSERT_TRUE(base::CreateDirectory(history_dir_)); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void HistoryBackendDBBaseTest::TearDown() { | 75 void HistoryBackendDBBaseTest::TearDown() { |
| 76 DeleteBackend(); | 76 DeleteBackend(); |
| 77 | 77 |
| 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::QuitClosure()); | 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(std::string(), 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 " |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 DownloadDangerType::NOT_DANGEROUS, | 138 DownloadDangerType::NOT_DANGEROUS, |
| 139 kTestDownloadInterruptReasonNone, | 139 kTestDownloadInterruptReasonNone, |
| 140 id, | 140 id, |
| 141 false, | 141 false, |
| 142 "by_ext_id", | 142 "by_ext_id", |
| 143 "by_ext_name"); | 143 "by_ext_name"); |
| 144 return db_->CreateDownload(download); | 144 return db_->CreateDownload(download); |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace history | 147 } // namespace history |
| OLD | NEW |