| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Unit tests for the SafeBrowsing storage system. | 5 // Unit tests for the SafeBrowsing storage system. |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 public: | 47 public: |
| 48 virtual void SetUp() { | 48 virtual void SetUp() { |
| 49 PlatformTest::SetUp(); | 49 PlatformTest::SetUp(); |
| 50 | 50 |
| 51 // Temporary directory for the database files. | 51 // Temporary directory for the database files. |
| 52 FilePath temp_dir; | 52 FilePath temp_dir; |
| 53 ASSERT_TRUE(file_util::CreateNewTempDirectory(kFolderPrefix, &temp_dir)); | 53 ASSERT_TRUE(file_util::CreateNewTempDirectory(kFolderPrefix, &temp_dir)); |
| 54 file_deleter_.reset(new FileAutoDeleter(temp_dir)); | 54 file_deleter_.reset(new FileAutoDeleter(temp_dir)); |
| 55 | 55 |
| 56 FilePath filename(temp_dir); | 56 FilePath filename(temp_dir); |
| 57 filename.AppendASCII("SafeBrowsingTestDatabase"); | 57 filename = filename.AppendASCII("SafeBrowsingTestDatabase"); |
| 58 | 58 |
| 59 // In case it existed from a previous run. | 59 // In case it existed from a previous run. |
| 60 file_util::Delete(FilePath(filename.value() + kBloomSuffix), false); | 60 file_util::Delete(FilePath(filename.value() + kBloomSuffix), false); |
| 61 file_util::Delete(filename, false); | 61 file_util::Delete(filename, false); |
| 62 | 62 |
| 63 database_.reset(SafeBrowsingDatabase::Create()); | 63 database_.reset(SafeBrowsingDatabase::Create()); |
| 64 database_->Init(filename); | 64 database_->Init(filename); |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual void TearDown() { | 67 virtual void TearDown() { |
| (...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 TEST(SafeBrowsingDatabase, DatabaseOldLotsofDeletesIO) { | 1214 TEST(SafeBrowsingDatabase, DatabaseOldLotsofDeletesIO) { |
| 1215 std::vector<ChunksInfo> chunks; | 1215 std::vector<ChunksInfo> chunks; |
| 1216 std::vector<SBChunkDelete> deletes; | 1216 std::vector<SBChunkDelete> deletes; |
| 1217 SBChunkDelete del; | 1217 SBChunkDelete del; |
| 1218 del.is_sub_del = false; | 1218 del.is_sub_del = false; |
| 1219 del.list_name = safe_browsing_util::kMalwareList; | 1219 del.list_name = safe_browsing_util::kMalwareList; |
| 1220 del.chunk_del.push_back(ChunkRange(3539, 3579)); | 1220 del.chunk_del.push_back(ChunkRange(3539, 3579)); |
| 1221 deletes.push_back(del); | 1221 deletes.push_back(del); |
| 1222 PerformUpdate(GetOldSafeBrowsingPath(), chunks, deletes); | 1222 PerformUpdate(GetOldSafeBrowsingPath(), chunks, deletes); |
| 1223 } | 1223 } |
| OLD | NEW |