| 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/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
| 12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/browser/history/android/urls_sql_handler.h" | 14 #include "chrome/browser/history/android/urls_sql_handler.h" |
| 15 #include "chrome/browser/history/history_database.h" | 15 #include "chrome/browser/history/history_database.h" |
| 16 #include "chrome/common/chrome_constants.h" | 16 #include "chrome/common/chrome_constants.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 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 36 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 36 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 37 FilePath history_db_name = temp_dir_.path().AppendASCII( | 37 FilePath history_db_name = temp_dir_.path().AppendASCII( |
| 38 chrome::kHistoryFilename); | 38 chrome::kHistoryFilename); |
| 39 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name, NULL)); | 39 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name, NULL)); |
| 40 } | 40 } |
| 41 | 41 |
| 42 virtual void TearDown() { | 42 virtual void TearDown() { |
| 43 } | 43 } |
| 44 | 44 |
| 45 HistoryDatabase history_db_; | 45 HistoryDatabase history_db_; |
| 46 ScopedTempDir temp_dir_; | 46 base::ScopedTempDir temp_dir_; |
| 47 UrlsSQLHandler urls_sql_handler_; | 47 UrlsSQLHandler urls_sql_handler_; |
| 48 VisitSQLHandler visit_sql_handler_; | 48 VisitSQLHandler visit_sql_handler_; |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 DISALLOW_COPY_AND_ASSIGN(VisitSQLHandlerTest); | 51 DISALLOW_COPY_AND_ASSIGN(VisitSQLHandlerTest); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 // Insert a url with only url set to verify no visit was inserted in visit | 54 // Insert a url with only url set to verify no visit was inserted in visit |
| 55 // table. | 55 // table. |
| 56 TEST_F(VisitSQLHandlerTest, InsertURL) { | 56 TEST_F(VisitSQLHandlerTest, InsertURL) { |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 296 |
| 297 TableIDRow id; | 297 TableIDRow id; |
| 298 id.url_id = url_row.id(); | 298 id.url_id = url_row.id(); |
| 299 TableIDRows ids; | 299 TableIDRows ids; |
| 300 ids.push_back(id); | 300 ids.push_back(id); |
| 301 ASSERT_TRUE(urls_sql_handler_.Delete(ids)); | 301 ASSERT_TRUE(urls_sql_handler_.Delete(ids)); |
| 302 EXPECT_FALSE(history_db_.GetURLRow(row.url_id(), &url_row)); | 302 EXPECT_FALSE(history_db_.GetURLRow(row.url_id(), &url_row)); |
| 303 } | 303 } |
| 304 | 304 |
| 305 } // namespace history | 305 } // namespace history |
| OLD | NEW |