OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "components/history/core/browser/keyword_search_term.h" | 9 #include "components/history/core/browser/keyword_search_term.h" |
10 #include "components/history/core/browser/url_database.h" | 10 #include "components/history/core/browser/url_database.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 | 40 |
41 protected: | 41 protected: |
42 // Provided for URL/VisitDatabase. | 42 // Provided for URL/VisitDatabase. |
43 sql::Connection& GetDB() override { return db_; } | 43 sql::Connection& GetDB() override { return db_; } |
44 | 44 |
45 private: | 45 private: |
46 // Test setup. | 46 // Test setup. |
47 void SetUp() override { | 47 void SetUp() override { |
48 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 48 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
49 base::FilePath db_file = temp_dir_.path().AppendASCII("URLTest.db"); | 49 base::FilePath db_file = temp_dir_.GetPath().AppendASCII("URLTest.db"); |
50 | 50 |
51 EXPECT_TRUE(db_.Open(db_file)); | 51 EXPECT_TRUE(db_.Open(db_file)); |
52 | 52 |
53 // Initialize the tables for this test. | 53 // Initialize the tables for this test. |
54 CreateURLTable(false); | 54 CreateURLTable(false); |
55 CreateMainURLIndex(); | 55 CreateMainURLIndex(); |
56 InitKeywordSearchTermsTable(); | 56 InitKeywordSearchTermsTable(); |
57 CreateKeywordSearchTermsIndices(); | 57 CreateKeywordSearchTermsIndices(); |
58 } | 58 } |
59 void TearDown() override { db_.Close(); } | 59 void TearDown() override { db_.Close(); } |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 ASSERT_EQ(1u, rows.size()); | 322 ASSERT_EQ(1u, rows.size()); |
323 EXPECT_EQ(keyword2, rows[0].term); | 323 EXPECT_EQ(keyword2, rows[0].term); |
324 EXPECT_EQ(url_id3, rows[0].url_id); | 324 EXPECT_EQ(url_id3, rows[0].url_id); |
325 rows.clear(); | 325 rows.clear(); |
326 // No row for keyword. | 326 // No row for keyword. |
327 ASSERT_TRUE(GetKeywordSearchTermRows(keyword, &rows)); | 327 ASSERT_TRUE(GetKeywordSearchTermRows(keyword, &rows)); |
328 EXPECT_TRUE(rows.empty()); | 328 EXPECT_TRUE(rows.empty()); |
329 } | 329 } |
330 | 330 |
331 } // namespace history | 331 } // namespace history |
OLD | NEW |