Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(465)

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_database_unittest.cc

Issue 101143006: Convert base::file_util to use File instead of PlatformFile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove base:: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 1628
1629 InsertAddChunkHostPrefixUrl(&chunk, 1, "www.evil.com/", 1629 InsertAddChunkHostPrefixUrl(&chunk, 1, "www.evil.com/",
1630 "www.evil.com/malware.html"); 1630 "www.evil.com/malware.html");
1631 chunks.clear(); 1631 chunks.clear();
1632 chunks.push_back(chunk); 1632 chunks.push_back(chunk);
1633 database_->InsertChunks(safe_browsing_util::kMalwareList, chunks); 1633 database_->InsertChunks(safe_browsing_util::kMalwareList, chunks);
1634 database_->UpdateFinished(true); 1634 database_->UpdateFinished(true);
1635 1635
1636 // Get an older time to reset the lastmod time for detecting whether 1636 // Get an older time to reset the lastmod time for detecting whether
1637 // the file has been updated. 1637 // the file has been updated.
1638 base::PlatformFileInfo before_info, after_info; 1638 base::File::Info before_info, after_info;
1639 ASSERT_TRUE(base::GetFileInfo(filename, &before_info)); 1639 ASSERT_TRUE(base::GetFileInfo(filename, &before_info));
1640 const base::Time old_last_modified = 1640 const base::Time old_last_modified =
1641 before_info.last_modified - base::TimeDelta::FromSeconds(10); 1641 before_info.last_modified - base::TimeDelta::FromSeconds(10);
1642 1642
1643 // Inserting another chunk updates the database file. The sleep is 1643 // Inserting another chunk updates the database file. The sleep is
1644 // needed because otherwise the entire test can finish w/in the 1644 // needed because otherwise the entire test can finish w/in the
1645 // resolution of the lastmod time. 1645 // resolution of the lastmod time.
1646 ASSERT_TRUE(base::TouchFile(filename, old_last_modified, old_last_modified)); 1646 ASSERT_TRUE(base::TouchFile(filename, old_last_modified, old_last_modified));
1647 ASSERT_TRUE(base::GetFileInfo(filename, &before_info)); 1647 ASSERT_TRUE(base::GetFileInfo(filename, &before_info));
1648 EXPECT_TRUE(database_->UpdateStarted(&lists)); 1648 EXPECT_TRUE(database_->UpdateStarted(&lists));
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 EXPECT_FALSE(database_->ContainsMalwareIP("192.1.124.0")); 1825 EXPECT_FALSE(database_->ContainsMalwareIP("192.1.124.0"));
1826 1826
1827 EXPECT_FALSE(database_->ContainsMalwareIP("192.1.127.255")); 1827 EXPECT_FALSE(database_->ContainsMalwareIP("192.1.127.255"));
1828 EXPECT_TRUE(database_->ContainsMalwareIP("192.1.128.0")); 1828 EXPECT_TRUE(database_->ContainsMalwareIP("192.1.128.0"));
1829 EXPECT_TRUE(database_->ContainsMalwareIP("::ffff:192.1.128.1")); 1829 EXPECT_TRUE(database_->ContainsMalwareIP("::ffff:192.1.128.1"));
1830 EXPECT_TRUE(database_->ContainsMalwareIP("192.1.128.255")); 1830 EXPECT_TRUE(database_->ContainsMalwareIP("192.1.128.255"));
1831 EXPECT_TRUE(database_->ContainsMalwareIP("192.1.255.0")); 1831 EXPECT_TRUE(database_->ContainsMalwareIP("192.1.255.0"));
1832 EXPECT_TRUE(database_->ContainsMalwareIP("192.1.255.255")); 1832 EXPECT_TRUE(database_->ContainsMalwareIP("192.1.255.255"));
1833 EXPECT_FALSE(database_->ContainsMalwareIP("192.2.0.0")); 1833 EXPECT_FALSE(database_->ContainsMalwareIP("192.2.0.0"));
1834 } 1834 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_database.cc ('k') | chrome/installer/util/duplicate_tree_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698