OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" |
8 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
9 #include "base/scoped_temp_dir.h" | |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "chrome/browser/history/text_database.h" | 12 #include "chrome/browser/history/text_database.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "testing/platform_test.h" | 14 #include "testing/platform_test.h" |
15 | 15 |
16 using base::Time; | 16 using base::Time; |
17 | 17 |
18 namespace history { | 18 namespace history { |
19 | 19 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 file_util::Delete(db->file_name(), false); | 111 file_util::Delete(db->file_name(), false); |
112 | 112 |
113 if (!db->Init()) { | 113 if (!db->Init()) { |
114 delete db; | 114 delete db; |
115 return NULL; | 115 return NULL; |
116 } | 116 } |
117 return db; | 117 return db; |
118 } | 118 } |
119 | 119 |
120 // Directory containing the databases. | 120 // Directory containing the databases. |
121 ScopedTempDir temp_dir_; | 121 base::ScopedTempDir temp_dir_; |
122 | 122 |
123 // Name of the main database file. | 123 // Name of the main database file. |
124 FilePath file_name_; | 124 FilePath file_name_; |
125 }; | 125 }; |
126 | 126 |
127 TEST_F(TextDatabaseTest, AttachDetach) { | 127 TEST_F(TextDatabaseTest, AttachDetach) { |
128 // First database with one page. | 128 // First database with one page. |
129 const int kIdee1 = 200801; | 129 const int kIdee1 = 200801; |
130 scoped_ptr<TextDatabase> db1(CreateDB(kIdee1, true, true)); | 130 scoped_ptr<TextDatabase> db1(CreateDB(kIdee1, true, true)); |
131 ASSERT_TRUE(!!db1.get()); | 131 ASSERT_TRUE(!!db1.get()); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 311 |
312 // There should be one result, the most recent one. | 312 // There should be one result, the most recent one. |
313 EXPECT_EQ(1U, results.size()); | 313 EXPECT_EQ(1U, results.size()); |
314 EXPECT_TRUE(ResultsHaveURL(results, kURL2)); | 314 EXPECT_TRUE(ResultsHaveURL(results, kURL2)); |
315 | 315 |
316 // The max time considered should be the date of the returned item. | 316 // The max time considered should be the date of the returned item. |
317 EXPECT_EQ(kTime2, first_time_searched.ToInternalValue()); | 317 EXPECT_EQ(kTime2, first_time_searched.ToInternalValue()); |
318 } | 318 } |
319 | 319 |
320 } // namespace history | 320 } // namespace history |
OLD | NEW |