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