Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(451)

Side by Side Diff: chrome/browser/history/android/urls_sql_handler_unittest.cc

Issue 849323002: Componentize HistoryDatabase (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android compilation Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/browser/history/history_database.h"
12 #include "chrome/common/chrome_constants.h" 11 #include "chrome/common/chrome_constants.h"
13 #include "components/history/core/android/urls_sql_handler.h" 12 #include "components/history/core/browser/android/urls_sql_handler.h"
14 #include "components/history/core/android/visit_sql_handler.h" 13 #include "components/history/core/browser/android/visit_sql_handler.h"
15 #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"
16 #include "components/history/core/test/test_history_database.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 UrlsSQLHandlerTest : public testing::Test { 24 class UrlsSQLHandlerTest : public testing::Test {
24 public: 25 public:
25 UrlsSQLHandlerTest() 26 UrlsSQLHandlerTest()
26 : urls_sql_handler_(&history_db_), 27 : urls_sql_handler_(&history_db_),
27 visit_sql_handler_(&history_db_, &history_db_) {} 28 visit_sql_handler_(&history_db_, &history_db_) {}
28 virtual ~UrlsSQLHandlerTest() {} 29 virtual ~UrlsSQLHandlerTest() {}
29 30
30 protected: 31 protected:
31 virtual void SetUp() { 32 virtual void SetUp() {
32 // Get a temporary directory for the test DB files. 33 // Get a temporary directory for the test DB files.
33 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 34 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
34 base::FilePath history_db_name = 35 base::FilePath history_db_name =
35 temp_dir_.path().AppendASCII(kHistoryFilename); 36 temp_dir_.path().AppendASCII(kHistoryFilename);
36 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name)); 37 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name));
37 } 38 }
38 39
39 virtual void TearDown() { 40 virtual void TearDown() {
40 } 41 }
41 42
42 HistoryDatabase history_db_; 43 TestHistoryDatabase history_db_;
43 base::ScopedTempDir temp_dir_; 44 base::ScopedTempDir temp_dir_;
44 UrlsSQLHandler urls_sql_handler_; 45 UrlsSQLHandler urls_sql_handler_;
45 VisitSQLHandler visit_sql_handler_; 46 VisitSQLHandler visit_sql_handler_;
46 47
47 private: 48 private:
48 DISALLOW_COPY_AND_ASSIGN(UrlsSQLHandlerTest); 49 DISALLOW_COPY_AND_ASSIGN(UrlsSQLHandlerTest);
49 }; 50 };
50 51
51 // Insert a row only has URL to verify the visit count and last visit time 52 // Insert a row only has URL to verify the visit count and last visit time
52 // are also set by UrlsSQLHandler. 53 // are also set by UrlsSQLHandler.
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 334
334 TableIDRow id; 335 TableIDRow id;
335 id.url_id = url_row.id(); 336 id.url_id = url_row.id();
336 TableIDRows ids; 337 TableIDRows ids;
337 ids.push_back(id); 338 ids.push_back(id);
338 ASSERT_TRUE(urls_sql_handler_.Delete(ids)); 339 ASSERT_TRUE(urls_sql_handler_.Delete(ids));
339 EXPECT_FALSE(history_db_.GetURLRow(row.url_id(), &url_row)); 340 EXPECT_FALSE(history_db_.GetURLRow(row.url_id(), &url_row));
340 } 341 }
341 342
342 } // namespace history 343 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/android/sqlite_cursor_unittest.cc ('k') | chrome/browser/history/android/visit_sql_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698