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 #include <vector> | 5 #include <vector> |
6 | 6 |
7 #include "chrome/browser/history/android/visit_sql_handler.h" | 7 #include "chrome/browser/history/android/visit_sql_handler.h" |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "chrome/browser/history/android/urls_sql_handler.h" | 13 #include "chrome/browser/history/android/urls_sql_handler.h" |
14 #include "chrome/browser/history/history_database.h" | 14 #include "chrome/browser/history/history_database.h" |
15 #include "chrome/common/chrome_constants.h" | 15 #include "chrome/common/chrome_constants.h" |
| 16 #include "components/history/core/browser/history_constants.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 | 18 |
18 using base::Time; | 19 using base::Time; |
19 using base::TimeDelta; | 20 using base::TimeDelta; |
20 | 21 |
21 namespace history { | 22 namespace history { |
22 | 23 |
23 class VisitSQLHandlerTest : public testing::Test { | 24 class VisitSQLHandlerTest : public testing::Test { |
24 public: | 25 public: |
25 VisitSQLHandlerTest() | 26 VisitSQLHandlerTest() |
26 : urls_sql_handler_(&history_db_), | 27 : urls_sql_handler_(&history_db_), |
27 visit_sql_handler_(&history_db_) { | 28 visit_sql_handler_(&history_db_) { |
28 } | 29 } |
29 virtual ~VisitSQLHandlerTest() {} | 30 virtual ~VisitSQLHandlerTest() {} |
30 | 31 |
31 protected: | 32 protected: |
32 virtual void SetUp() { | 33 virtual void SetUp() { |
33 // Get a temporary directory for the test DB files. | 34 // Get a temporary directory for the test DB files. |
34 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 35 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
35 base::FilePath history_db_name = temp_dir_.path().AppendASCII( | 36 base::FilePath history_db_name = |
36 chrome::kHistoryFilename); | 37 temp_dir_.path().AppendASCII(kHistoryFilename); |
37 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name)); | 38 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name)); |
38 } | 39 } |
39 | 40 |
40 virtual void TearDown() { | 41 virtual void TearDown() { |
41 } | 42 } |
42 | 43 |
43 HistoryDatabase history_db_; | 44 HistoryDatabase history_db_; |
44 base::ScopedTempDir temp_dir_; | 45 base::ScopedTempDir temp_dir_; |
45 UrlsSQLHandler urls_sql_handler_; | 46 UrlsSQLHandler urls_sql_handler_; |
46 VisitSQLHandler visit_sql_handler_; | 47 VisitSQLHandler visit_sql_handler_; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 295 |
295 TableIDRow id; | 296 TableIDRow id; |
296 id.url_id = url_row.id(); | 297 id.url_id = url_row.id(); |
297 TableIDRows ids; | 298 TableIDRows ids; |
298 ids.push_back(id); | 299 ids.push_back(id); |
299 ASSERT_TRUE(urls_sql_handler_.Delete(ids)); | 300 ASSERT_TRUE(urls_sql_handler_.Delete(ids)); |
300 EXPECT_FALSE(history_db_.GetURLRow(row.url_id(), &url_row)); | 301 EXPECT_FALSE(history_db_.GetURLRow(row.url_id(), &url_row)); |
301 } | 302 } |
302 | 303 |
303 } // namespace history | 304 } // namespace history |
OLD | NEW |