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

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

Issue 13315: Move file enumeration to filepaths. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 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
« no previous file with comments | « chrome/browser/printing/printing_layout_uitest.cc ('k') | chrome/browser/user_data_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 void UpdateDatabase(const std::wstring& initial_db, 1107 void UpdateDatabase(const std::wstring& initial_db,
1108 const std::wstring& response_path, 1108 const std::wstring& response_path,
1109 const std::wstring& updates_path) { 1109 const std::wstring& updates_path) {
1110 // First we read the chunks from disk, so that this isn't counted in IO bytes. 1110 // First we read the chunks from disk, so that this isn't counted in IO bytes.
1111 std::vector<ChunksInfo> chunks; 1111 std::vector<ChunksInfo> chunks;
1112 1112
1113 SafeBrowsingProtocolParser parser; 1113 SafeBrowsingProtocolParser parser;
1114 if (!updates_path.empty()) { 1114 if (!updates_path.empty()) {
1115 std::wstring data_dir = GetFullSBDataPath(updates_path); 1115 std::wstring data_dir = GetFullSBDataPath(updates_path);
1116 file_util::FileEnumerator file_enum( 1116 file_util::FileEnumerator file_enum(
1117 data_dir, false, file_util::FileEnumerator::FILES); 1117 FilePath::FromWStringHack(data_dir), false,
1118 file_util::FileEnumerator::FILES);
1118 while (true) { 1119 while (true) {
1119 std::wstring file = file_enum.Next(); 1120 std::wstring file = file_enum.Next().ToWStringHack();
1120 if (file.empty()) 1121 if (file.empty())
1121 break; 1122 break;
1122 1123
1123 int64 size64; 1124 int64 size64;
1124 bool result = file_util::GetFileSize(file, &size64); 1125 bool result = file_util::GetFileSize(file, &size64);
1125 CHECK(result); 1126 CHECK(result);
1126 1127
1127 int size = static_cast<int>(size64); 1128 int size = static_cast<int>(size64);
1128 scoped_array<char> data(new char[size]); 1129 scoped_array<char> data(new char[size]);
1129 file_util::ReadFile(file, data.get(), size); 1130 file_util::ReadFile(file, data.get(), size);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 TEST(SafeBrowsingDatabase, DISABLED_DatabaseOldLotsofDeletesIO) { 1234 TEST(SafeBrowsingDatabase, DISABLED_DatabaseOldLotsofDeletesIO) {
1234 std::vector<ChunksInfo> chunks; 1235 std::vector<ChunksInfo> chunks;
1235 std::vector<SBChunkDelete>* deletes = new std::vector<SBChunkDelete>; 1236 std::vector<SBChunkDelete>* deletes = new std::vector<SBChunkDelete>;
1236 SBChunkDelete del; 1237 SBChunkDelete del;
1237 del.is_sub_del = false; 1238 del.is_sub_del = false;
1238 del.list_name = safe_browsing_util::kMalwareList; 1239 del.list_name = safe_browsing_util::kMalwareList;
1239 del.chunk_del.push_back(ChunkRange(3539, 3579)); 1240 del.chunk_del.push_back(ChunkRange(3539, 3579));
1240 deletes->push_back(del); 1241 deletes->push_back(del);
1241 PeformUpdate(GetOldSafeBrowsingPath(), chunks, deletes); 1242 PeformUpdate(GetOldSafeBrowsingPath(), chunks, deletes);
1242 } 1243 }
OLDNEW
« no previous file with comments | « chrome/browser/printing/printing_layout_uitest.cc ('k') | chrome/browser/user_data_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698