| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // History unit tests come in two flavors: | 5 // History unit tests come in two flavors: |
| 6 // | 6 // |
| 7 // 1. The more complicated style is that the unit test creates a full history | 7 // 1. The more complicated style is that the unit test creates a full history |
| 8 // service. This spawns a background thread for the history backend, and | 8 // service. This spawns a background thread for the history backend, and |
| 9 // all communication is asynchronous. This is useful for testing more | 9 // all communication is asynchronous. This is useful for testing more |
| 10 // complicated things or end-to-end behavior. | 10 // complicated things or end-to-end behavior. |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 129 } |
| 130 | 130 |
| 131 ~HistoryBackendDBTest() override {} | 131 ~HistoryBackendDBTest() override {} |
| 132 | 132 |
| 133 protected: | 133 protected: |
| 134 friend class BackendDelegate; | 134 friend class BackendDelegate; |
| 135 | 135 |
| 136 // Creates the HistoryBackend and HistoryDatabase on the current thread, | 136 // Creates the HistoryBackend and HistoryDatabase on the current thread, |
| 137 // assigning the values to backend_ and db_. | 137 // assigning the values to backend_ and db_. |
| 138 void CreateBackendAndDatabase() { | 138 void CreateBackendAndDatabase() { |
| 139 backend_ = | 139 backend_ = new HistoryBackend(new BackendDelegate(this), nullptr); |
| 140 new HistoryBackend(history_dir_, new BackendDelegate(this), NULL); | |
| 141 backend_->Init(std::string(), false, | 140 backend_->Init(std::string(), false, |
| 142 HistoryDatabaseParamsForPath(history_dir_)); | 141 HistoryDatabaseParamsForPath(history_dir_)); |
| 143 db_ = backend_->db_.get(); | 142 db_ = backend_->db_.get(); |
| 144 DCHECK(in_mem_backend_) << "Mem backend should have been set by " | 143 DCHECK(in_mem_backend_) << "Mem backend should have been set by " |
| 145 "HistoryBackend::Init"; | 144 "HistoryBackend::Init"; |
| 146 } | 145 } |
| 147 | 146 |
| 148 void CreateDBVersion(int version) { | 147 void CreateDBVersion(int version) { |
| 149 base::FilePath data_path; | 148 base::FilePath data_path; |
| 150 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); | 149 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); |
| (...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1866 std::vector<PageUsageData*> results; | 1865 std::vector<PageUsageData*> results; |
| 1867 db_->QuerySegmentUsage(segment_time, 10, &results); | 1866 db_->QuerySegmentUsage(segment_time, 10, &results); |
| 1868 ASSERT_EQ(1u, results.size()); | 1867 ASSERT_EQ(1u, results.size()); |
| 1869 EXPECT_EQ(url, results[0]->GetURL()); | 1868 EXPECT_EQ(url, results[0]->GetURL()); |
| 1870 EXPECT_EQ(segment_id, results[0]->GetID()); | 1869 EXPECT_EQ(segment_id, results[0]->GetID()); |
| 1871 EXPECT_EQ(title, results[0]->GetTitle()); | 1870 EXPECT_EQ(title, results[0]->GetTitle()); |
| 1872 STLDeleteElements(&results); | 1871 STLDeleteElements(&results); |
| 1873 } | 1872 } |
| 1874 | 1873 |
| 1875 } // namespace history | 1874 } // namespace history |
| OLD | NEW |