| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| 11 #include "base/sha2.h" | 11 #include "base/sha2.h" |
| 12 #include "base/stats_counters.h" | 12 #include "base/stats_counters.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "chrome/browser/safe_browsing/protocol_parser.h" | 15 #include "chrome/browser/safe_browsing/protocol_parser.h" |
| 16 #include "chrome/browser/safe_browsing/safe_browsing_database.h" | 16 #include "chrome/browser/safe_browsing/safe_browsing_database.h" |
| 17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 19 |
| 20 using base::Time; |
| 21 |
| 20 static const wchar_t kSafeBrowsingTestDatabase[] = L"SafeBrowsingTestDatabase"; | 22 static const wchar_t kSafeBrowsingTestDatabase[] = L"SafeBrowsingTestDatabase"; |
| 21 | 23 |
| 22 namespace { | 24 namespace { |
| 23 SBPrefix Sha256Prefix(const std::string& str) { | 25 SBPrefix Sha256Prefix(const std::string& str) { |
| 24 SBPrefix hash; | 26 SBPrefix hash; |
| 25 base::SHA256HashString(str, &hash, sizeof(hash)); | 27 base::SHA256HashString(str, &hash, sizeof(hash)); |
| 26 return hash; | 28 return hash; |
| 27 } | 29 } |
| 28 | 30 |
| 29 // Helper function to do an AddDel or SubDel command. | 31 // Helper function to do an AddDel or SubDel command. |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 TEST(SafeBrowsingDatabase, DISABLED_DatabaseOldLotsofDeletesIO) { | 679 TEST(SafeBrowsingDatabase, DISABLED_DatabaseOldLotsofDeletesIO) { |
| 678 std::vector<ChunksInfo> chunks; | 680 std::vector<ChunksInfo> chunks; |
| 679 std::vector<SBChunkDelete>* deletes = new std::vector<SBChunkDelete>; | 681 std::vector<SBChunkDelete>* deletes = new std::vector<SBChunkDelete>; |
| 680 SBChunkDelete del; | 682 SBChunkDelete del; |
| 681 del.is_sub_del = false; | 683 del.is_sub_del = false; |
| 682 del.list_name = "goog-malware-shavar"; | 684 del.list_name = "goog-malware-shavar"; |
| 683 del.chunk_del.push_back(ChunkRange(3539, 3579)); | 685 del.chunk_del.push_back(ChunkRange(3539, 3579)); |
| 684 deletes->push_back(del); | 686 deletes->push_back(del); |
| 685 PeformUpdate(GetOldSafeBrowsingPath(), chunks, deletes); | 687 PeformUpdate(GetOldSafeBrowsingPath(), chunks, deletes); |
| 686 } | 688 } |
| OLD | NEW |