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

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

Issue 500118: Fix cpu/memory measurements on OS X. (Closed)
Patch Set: foobar Created 11 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
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/file_util.h" 7 #include "base/file_util.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 FilePath full_initial_db = GetFullSBDataPath(initial_db); 1071 FilePath full_initial_db = GetFullSBDataPath(initial_db);
1072 ASSERT_TRUE(file_util::CopyFile(full_initial_db, path)); 1072 ASSERT_TRUE(file_util::CopyFile(full_initial_db, path));
1073 } 1073 }
1074 1074
1075 SafeBrowsingDatabase* database = SafeBrowsingDatabase::Create(); 1075 SafeBrowsingDatabase* database = SafeBrowsingDatabase::Create();
1076 database->Init(path, NULL); 1076 database->Init(path, NULL);
1077 1077
1078 Time before_time = Time::Now(); 1078 Time before_time = Time::Now();
1079 base::ProcessHandle handle = base::Process::Current().handle(); 1079 base::ProcessHandle handle = base::Process::Current().handle();
1080 scoped_ptr<base::ProcessMetrics> metric( 1080 scoped_ptr<base::ProcessMetrics> metric(
1081 #if !defined(OS_MACOSX)
1081 base::ProcessMetrics::CreateProcessMetrics(handle)); 1082 base::ProcessMetrics::CreateProcessMetrics(handle));
1083 #else
1084 // Getting stats only for the current process is enough, so NULL is fine.
1085 base::ProcessMetrics::CreateProcessMetrics(handle, NULL));
1086 #endif
1082 CHECK(metric->GetIOCounters(&before)); 1087 CHECK(metric->GetIOCounters(&before));
1083 1088
1084 std::vector<SBListChunkRanges> lists; 1089 std::vector<SBListChunkRanges> lists;
1085 database->UpdateStarted(); 1090 database->UpdateStarted();
1086 database->GetListsInfo(&lists); 1091 database->GetListsInfo(&lists);
1087 database->DeleteChunks(deletes); 1092 database->DeleteChunks(deletes);
1088 for (size_t i = 0; i < chunks.size(); ++i) 1093 for (size_t i = 0; i < chunks.size(); ++i)
1089 database->InsertChunks(chunks[i].listname, chunks[i].chunks); 1094 database->InsertChunks(chunks[i].listname, chunks[i].chunks);
1090 1095
1091 database->UpdateFinished(true); 1096 database->UpdateFinished(true);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 TEST(SafeBrowsingDatabase, DISABLED_DatabaseOldLotsofDeletesIO) { 1251 TEST(SafeBrowsingDatabase, DISABLED_DatabaseOldLotsofDeletesIO) {
1247 std::vector<ChunksInfo> chunks; 1252 std::vector<ChunksInfo> chunks;
1248 std::vector<SBChunkDelete>* deletes = new std::vector<SBChunkDelete>; 1253 std::vector<SBChunkDelete>* deletes = new std::vector<SBChunkDelete>;
1249 SBChunkDelete del; 1254 SBChunkDelete del;
1250 del.is_sub_del = false; 1255 del.is_sub_del = false;
1251 del.list_name = safe_browsing_util::kMalwareList; 1256 del.list_name = safe_browsing_util::kMalwareList;
1252 del.chunk_del.push_back(ChunkRange(3539, 3579)); 1257 del.chunk_del.push_back(ChunkRange(3539, 3579));
1253 deletes->push_back(del); 1258 deletes->push_back(del);
1254 PeformUpdate(GetOldSafeBrowsingPath(), chunks, deletes); 1259 PeformUpdate(GetOldSafeBrowsingPath(), chunks, deletes);
1255 } 1260 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698