| 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 // 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/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1651 database_.reset(new SafeBrowsingDatabaseNew); | 1651 database_.reset(new SafeBrowsingDatabaseNew); |
| 1652 database_->Init(database_filename_); | 1652 database_->Init(database_filename_); |
| 1653 EXPECT_TRUE(database_->ContainsBrowseUrl( | 1653 EXPECT_TRUE(database_->ContainsBrowseUrl( |
| 1654 GURL("http://www.evil.com/malware.html"), | 1654 GURL("http://www.evil.com/malware.html"), |
| 1655 &matching_list, &prefix_hits, &full_hashes, now)); | 1655 &matching_list, &prefix_hits, &full_hashes, now)); |
| 1656 EXPECT_FALSE(database_->ContainsBrowseUrl( | 1656 EXPECT_FALSE(database_->ContainsBrowseUrl( |
| 1657 GURL("http://www.good.com/goodware.html"), | 1657 GURL("http://www.good.com/goodware.html"), |
| 1658 &matching_list, &prefix_hits, &full_hashes, now)); | 1658 &matching_list, &prefix_hits, &full_hashes, now)); |
| 1659 | 1659 |
| 1660 // If there is no filter file, the database cannot find malware urls. | 1660 // If there is no filter file, the database cannot find malware urls. |
| 1661 base::Delete(filter_file, false); | 1661 base::DeleteFile(filter_file, false); |
| 1662 ASSERT_FALSE(base::PathExists(filter_file)); | 1662 ASSERT_FALSE(base::PathExists(filter_file)); |
| 1663 database_.reset(new SafeBrowsingDatabaseNew); | 1663 database_.reset(new SafeBrowsingDatabaseNew); |
| 1664 database_->Init(database_filename_); | 1664 database_->Init(database_filename_); |
| 1665 EXPECT_FALSE(database_->ContainsBrowseUrl( | 1665 EXPECT_FALSE(database_->ContainsBrowseUrl( |
| 1666 GURL("http://www.evil.com/malware.html"), | 1666 GURL("http://www.evil.com/malware.html"), |
| 1667 &matching_list, &prefix_hits, &full_hashes, now)); | 1667 &matching_list, &prefix_hits, &full_hashes, now)); |
| 1668 EXPECT_FALSE(database_->ContainsBrowseUrl( | 1668 EXPECT_FALSE(database_->ContainsBrowseUrl( |
| 1669 GURL("http://www.good.com/goodware.html"), | 1669 GURL("http://www.good.com/goodware.html"), |
| 1670 &matching_list, &prefix_hits, &full_hashes, now)); | 1670 &matching_list, &prefix_hits, &full_hashes, now)); |
| 1671 } | 1671 } |
| OLD | NEW |