| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 backend_->Init(std::string(), false); | 123 backend_->Init(std::string(), false); |
| 124 db_ = backend_->db_.get(); | 124 db_ = backend_->db_.get(); |
| 125 DCHECK(in_mem_backend_.get()) << "Mem backend should have been set by " | 125 DCHECK(in_mem_backend_.get()) << "Mem backend should have been set by " |
| 126 "HistoryBackend::Init"; | 126 "HistoryBackend::Init"; |
| 127 } | 127 } |
| 128 | 128 |
| 129 void CreateDBVersion(int version) { | 129 void CreateDBVersion(int version) { |
| 130 base::FilePath data_path; | 130 base::FilePath data_path; |
| 131 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); | 131 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); |
| 132 data_path = data_path.AppendASCII("History"); | 132 data_path = data_path.AppendASCII("History"); |
| 133 data_path = data_path.AppendASCII(StringPrintf("history.%d.sql", version)); | 133 data_path = |
| 134 data_path.AppendASCII(base::StringPrintf("history.%d.sql", version)); |
| 134 ASSERT_NO_FATAL_FAILURE( | 135 ASSERT_NO_FATAL_FAILURE( |
| 135 ExecuteSQLScript(data_path, history_dir_.Append( | 136 ExecuteSQLScript(data_path, history_dir_.Append( |
| 136 chrome::kHistoryFilename))); | 137 chrome::kHistoryFilename))); |
| 137 } | 138 } |
| 138 | 139 |
| 139 // testing::Test | 140 // testing::Test |
| 140 virtual void SetUp() { | 141 virtual void SetUp() { |
| 141 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 142 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 142 history_dir_ = temp_dir_.path().AppendASCII("HistoryBackendDBTest"); | 143 history_dir_ = temp_dir_.path().AppendASCII("HistoryBackendDBTest"); |
| 143 ASSERT_TRUE(file_util::CreateDirectory(history_dir_)); | 144 ASSERT_TRUE(file_util::CreateDirectory(history_dir_)); |
| (...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1576 ASSERT_EQ(1u, results.size()); | 1577 ASSERT_EQ(1u, results.size()); |
| 1577 EXPECT_EQ(url, results[0]->GetURL()); | 1578 EXPECT_EQ(url, results[0]->GetURL()); |
| 1578 EXPECT_EQ(segment_id, results[0]->GetID()); | 1579 EXPECT_EQ(segment_id, results[0]->GetID()); |
| 1579 EXPECT_EQ(title, results[0]->GetTitle()); | 1580 EXPECT_EQ(title, results[0]->GetTitle()); |
| 1580 STLDeleteElements(&results); | 1581 STLDeleteElements(&results); |
| 1581 } | 1582 } |
| 1582 | 1583 |
| 1583 } // namespace | 1584 } // namespace |
| 1584 | 1585 |
| 1585 } // namespace history | 1586 } // namespace history |
| OLD | NEW |