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 <algorithm> | 5 #include <algorithm> |
6 #include <fstream> | 6 #include <fstream> |
7 | 7 |
8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 InMemoryURLIndexCacheTest() {} | 1198 InMemoryURLIndexCacheTest() {} |
1199 | 1199 |
1200 protected: | 1200 protected: |
1201 void SetUp() override; | 1201 void SetUp() override; |
1202 void TearDown() override; | 1202 void TearDown() override; |
1203 | 1203 |
1204 // Pass-through functions to simplify our friendship with InMemoryURLIndex. | 1204 // Pass-through functions to simplify our friendship with InMemoryURLIndex. |
1205 void set_history_dir(const base::FilePath& dir_path); | 1205 void set_history_dir(const base::FilePath& dir_path); |
1206 bool GetCacheFilePath(base::FilePath* file_path) const; | 1206 bool GetCacheFilePath(base::FilePath* file_path) const; |
1207 | 1207 |
| 1208 content::TestBrowserThreadBundle thread_bundle_; |
1208 base::ScopedTempDir temp_dir_; | 1209 base::ScopedTempDir temp_dir_; |
1209 scoped_ptr<InMemoryURLIndex> url_index_; | 1210 scoped_ptr<InMemoryURLIndex> url_index_; |
1210 }; | 1211 }; |
1211 | 1212 |
1212 void InMemoryURLIndexCacheTest::SetUp() { | 1213 void InMemoryURLIndexCacheTest::SetUp() { |
1213 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 1214 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
1214 base::FilePath path(temp_dir_.path()); | 1215 base::FilePath path(temp_dir_.path()); |
1215 url_index_.reset( | 1216 url_index_.reset( |
1216 new InMemoryURLIndex(nullptr, nullptr, path, kTestLanguages)); | 1217 new InMemoryURLIndex(nullptr, nullptr, path, kTestLanguages)); |
1217 } | 1218 } |
(...skipping 23 matching lines...) Expand all Loading... |
1241 ASSERT_TRUE(GetCacheFilePath(&full_file_path)); | 1242 ASSERT_TRUE(GetCacheFilePath(&full_file_path)); |
1242 std::vector<base::FilePath::StringType> actual_parts; | 1243 std::vector<base::FilePath::StringType> actual_parts; |
1243 full_file_path.GetComponents(&actual_parts); | 1244 full_file_path.GetComponents(&actual_parts); |
1244 ASSERT_EQ(expected_parts.size(), actual_parts.size()); | 1245 ASSERT_EQ(expected_parts.size(), actual_parts.size()); |
1245 size_t count = expected_parts.size(); | 1246 size_t count = expected_parts.size(); |
1246 for (size_t i = 0; i < count; ++i) | 1247 for (size_t i = 0; i < count; ++i) |
1247 EXPECT_EQ(expected_parts[i], actual_parts[i]); | 1248 EXPECT_EQ(expected_parts[i], actual_parts[i]); |
1248 // Must clear the history_dir_ to satisfy the dtor's DCHECK. | 1249 // Must clear the history_dir_ to satisfy the dtor's DCHECK. |
1249 set_history_dir(base::FilePath()); | 1250 set_history_dir(base::FilePath()); |
1250 } | 1251 } |
OLD | NEW |