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

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

Issue 105823009: Revert 239280 "Move more file_util functions to base namespace." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 host.entry->SetPrefixAt(0, Sha256Prefix("www.subbed.com/notevil1.html")); 1145 host.entry->SetPrefixAt(0, Sha256Prefix("www.subbed.com/notevil1.html"));
1146 chunk.chunk_number = 7; 1146 chunk.chunk_number = 7;
1147 chunk.is_add = false; 1147 chunk.is_add = false;
1148 chunk.hosts.clear(); 1148 chunk.hosts.clear();
1149 chunk.hosts.push_back(host); 1149 chunk.hosts.push_back(host);
1150 chunks.clear(); 1150 chunks.clear();
1151 chunks.push_back(chunk); 1151 chunks.push_back(chunk);
1152 1152
1153 // Corrupt the file by corrupting the checksum, which is not checked 1153 // Corrupt the file by corrupting the checksum, which is not checked
1154 // until the entire table is read in |UpdateFinished()|. 1154 // until the entire table is read in |UpdateFinished()|.
1155 FILE* fp = base::OpenFile(database_filename_, "r+"); 1155 FILE* fp = file_util::OpenFile(database_filename_, "r+");
1156 ASSERT_TRUE(fp); 1156 ASSERT_TRUE(fp);
1157 ASSERT_NE(-1, fseek(fp, -8, SEEK_END)); 1157 ASSERT_NE(-1, fseek(fp, -8, SEEK_END));
1158 for (size_t i = 0; i < 8; ++i) { 1158 for (size_t i = 0; i < 8; ++i) {
1159 fputc('!', fp); 1159 fputc('!', fp);
1160 } 1160 }
1161 fclose(fp); 1161 fclose(fp);
1162 1162
1163 { 1163 {
1164 // The following code will cause DCHECKs, so suppress the crashes. 1164 // The following code will cause DCHECKs, so suppress the crashes.
1165 ScopedLogMessageIgnorer ignorer; 1165 ScopedLogMessageIgnorer ignorer;
(...skipping 659 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

Powered by Google App Engine
This is Rietveld 408576698