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

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

Issue 10870029: Remove legacy migration code that coupled history and bookmarks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More android fixes. Created 8 years, 3 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 | Annotate | Revision Log
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 "base/file_path.h" 5 #include "base/file_path.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/scoped_temp_dir.h" 7 #include "base/scoped_temp_dir.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/history/android/android_cache_database.h" 9 #include "chrome/browser/history/android/android_cache_database.h"
10 #include "chrome/browser/history/android/android_time.h" 10 #include "chrome/browser/history/android/android_time.h"
(...skipping 13 matching lines...) Expand all
24 ~AndroidCacheDatabaseTest() { 24 ~AndroidCacheDatabaseTest() {
25 } 25 }
26 26
27 protected: 27 protected:
28 virtual void SetUp() { 28 virtual void SetUp() {
29 // Get a temporary directory for the test DB files. 29 // Get a temporary directory for the test DB files.
30 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 30 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
31 FilePath history_db_name_ = temp_dir_.path().AppendASCII("history.db"); 31 FilePath history_db_name_ = temp_dir_.path().AppendASCII("history.db");
32 android_cache_db_name_ = temp_dir_.path().AppendASCII( 32 android_cache_db_name_ = temp_dir_.path().AppendASCII(
33 "TestAndroidCache.db"); 33 "TestAndroidCache.db");
34 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_, 34 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_));
35 temp_dir_.path()));
36 ASSERT_EQ(sql::INIT_OK, 35 ASSERT_EQ(sql::INIT_OK,
37 history_db_.InitAndroidCacheDatabase(android_cache_db_name_)); 36 history_db_.InitAndroidCacheDatabase(android_cache_db_name_));
38 } 37 }
39 38
40 ScopedTempDir temp_dir_; 39 ScopedTempDir temp_dir_;
41 FilePath android_cache_db_name_; 40 FilePath android_cache_db_name_;
42 HistoryDatabase history_db_; 41 HistoryDatabase history_db_;
43 }; 42 };
44 43
45 TEST(AndroidCacheDatabaseAttachTest, AttachDatabaseInTransactionNesting) { 44 TEST(AndroidCacheDatabaseAttachTest, AttachDatabaseInTransactionNesting) {
46 ScopedTempDir temp_dir; 45 ScopedTempDir temp_dir;
47 FilePath android_cache_db_name; 46 FilePath android_cache_db_name;
48 HistoryDatabase history_db; 47 HistoryDatabase history_db;
49 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 48 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
50 FilePath history_db_name = temp_dir.path().AppendASCII("history.db"); 49 FilePath history_db_name = temp_dir.path().AppendASCII("history.db");
51 android_cache_db_name = temp_dir.path().AppendASCII( 50 android_cache_db_name = temp_dir.path().AppendASCII(
52 "TestAndroidCache.db"); 51 "TestAndroidCache.db");
53 ASSERT_EQ(sql::INIT_OK, history_db.Init(history_db_name, temp_dir.path())); 52 ASSERT_EQ(sql::INIT_OK, history_db.Init(history_db_name));
54 // Create nested transactions. 53 // Create nested transactions.
55 history_db.BeginTransaction(); 54 history_db.BeginTransaction();
56 history_db.BeginTransaction(); 55 history_db.BeginTransaction();
57 history_db.BeginTransaction(); 56 history_db.BeginTransaction();
58 int transaction_nesting = history_db.transaction_nesting(); 57 int transaction_nesting = history_db.transaction_nesting();
59 ASSERT_EQ(sql::INIT_OK, 58 ASSERT_EQ(sql::INIT_OK,
60 history_db.InitAndroidCacheDatabase(android_cache_db_name)); 59 history_db.InitAndroidCacheDatabase(android_cache_db_name));
61 // The count of nested transaction is still same. 60 // The count of nested transaction is still same.
62 EXPECT_EQ(transaction_nesting, history_db.transaction_nesting()); 61 EXPECT_EQ(transaction_nesting, history_db.transaction_nesting());
63 } 62 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 EXPECT_FALSE(history_db_.GetSearchTerm(update_row1.term, NULL)); 106 EXPECT_FALSE(history_db_.GetSearchTerm(update_row1.term, NULL));
108 // The search_term2 should still in the table. 107 // The search_term2 should still in the table.
109 ASSERT_EQ(id2, history_db_.GetSearchTerm(search_term2, &row1)); 108 ASSERT_EQ(id2, history_db_.GetSearchTerm(search_term2, &row1));
110 EXPECT_EQ(id2, row1.id); 109 EXPECT_EQ(id2, row1.id);
111 EXPECT_EQ(ToDatabaseTime(search_time2), 110 EXPECT_EQ(ToDatabaseTime(search_time2),
112 ToDatabaseTime(row1.last_visit_time)); 111 ToDatabaseTime(row1.last_visit_time));
113 EXPECT_EQ(search_term2, row1.term); 112 EXPECT_EQ(search_term2, row1.term);
114 } 113 }
115 114
116 } // namespace history 115 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/DEPS ('k') | chrome/browser/history/android/android_provider_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698