summaryrefslogtreecommitdiffstats
path: root/chrome/browser/safe_browsing
diff options
context:
space:
mode:
authorcsilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-11 20:00:03 +0000
committercsilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-11 20:00:03 +0000
commit5bad0103fd06ada92faaf80f5ea716d396fb2108 (patch)
tree7d438670a6c1192d1765b2c2e1c887f154364c7e /chrome/browser/safe_browsing
parent1e88c37d93e534aba9f4a29d1c131462617bde0a (diff)
downloadchromium_src-5bad0103fd06ada92faaf80f5ea716d396fb2108.zip
chromium_src-5bad0103fd06ada92faaf80f5ea716d396fb2108.tar.gz
chromium_src-5bad0103fd06ada92faaf80f5ea716d396fb2108.tar.bz2
TTF: Fix SafeBrowsingDatabase unit tests for MacOS X by disabling logging of IO
stats since those are unsupported on MacOS X (and really just informative, not critical to the function of the test.) BUG=46040 TEST=SafeBrowsingDatabase.* Review URL: http://codereview.chromium.org/2723003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49578 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing')
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_database_unittest.cc44
1 files changed, 21 insertions, 23 deletions
diff --git a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
index e402d19..51c962d 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
@@ -1050,7 +1050,10 @@ void PerformUpdate(const FilePath& initial_db,
// Getting stats only for the current process is enough, so NULL is fine.
base::ProcessMetrics::CreateProcessMetrics(handle, NULL));
#endif
- CHECK(metric->GetIOCounters(&before));
+ // Get IO stats. These are currently not supported on Mac, and may not be
+ // available for Linux, so we check the result and only show IO stats if
+ // they are available.
+ bool gotIOCounters = metric->GetIOCounters(&before);
std::vector<SBListChunkRanges> lists;
database->UpdateStarted();
@@ -1062,16 +1065,18 @@ void PerformUpdate(const FilePath& initial_db,
database->UpdateFinished(true);
lists.clear();
- CHECK(metric->GetIOCounters(&after));
-
- LOG(INFO) << StringPrintf("I/O Read Bytes: %" PRIu64,
- after.ReadTransferCount - before.ReadTransferCount);
- LOG(INFO) << StringPrintf("I/O Write Bytes: %" PRIu64,
- after.WriteTransferCount - before.WriteTransferCount);
- LOG(INFO) << StringPrintf("I/O Reads: %" PRIu64,
- after.ReadOperationCount - before.ReadOperationCount);
- LOG(INFO) << StringPrintf("I/O Writes: %" PRIu64,
- after.WriteOperationCount - before.WriteOperationCount);
+ gotIOCounters = gotIOCounters && metric->GetIOCounters(&after);
+
+ if (gotIOCounters) {
+ LOG(INFO) << StringPrintf("I/O Read Bytes: %" PRIu64,
+ after.ReadTransferCount - before.ReadTransferCount);
+ LOG(INFO) << StringPrintf("I/O Write Bytes: %" PRIu64,
+ after.WriteTransferCount - before.WriteTransferCount);
+ LOG(INFO) << StringPrintf("I/O Reads: %" PRIu64,
+ after.ReadOperationCount - before.ReadOperationCount);
+ LOG(INFO) << StringPrintf("I/O Writes: %" PRIu64,
+ after.WriteOperationCount - before.WriteOperationCount);
+ }
LOG(INFO) << StringPrintf("Finished in %" PRId64 " ms",
(Time::Now() - before_time).InMilliseconds());
@@ -1180,40 +1185,33 @@ FilePath GetOldUpdatesPath() {
} // namespace
-// Check failed: metric->GetIOCounters(&before), http://crbug.com/46040.
-#if defined(OS_MACOSX)
-#define SKIP_MACOSX(test) DISABLED_##test
-#else
-#define SKIP_MACOSX(test) test
-#endif // defined(OS_MACOSX)
-
// Counts the IO needed for the initial update of a database.
// test\data\safe_browsing\download_update.py was used to fetch the add/sub
// chunks that are read, in order to get repeatable runs.
-TEST(SafeBrowsingDatabase, SKIP_MACOSX(DatabaseInitialIO)) {
+TEST(SafeBrowsingDatabase, DatabaseInitialIO) {
UpdateDatabase(FilePath(), FilePath(), FilePath().AppendASCII("initial"));
}
// Counts the IO needed to update a month old database.
// The data files were generated by running "..\download_update.py postdata"
// in the "safe_browsing\old" directory.
-TEST(SafeBrowsingDatabase, SKIP_MACOSX(DatabaseOldIO)) {
+TEST(SafeBrowsingDatabase, DatabaseOldIO) {
UpdateDatabase(GetOldSafeBrowsingPath(), GetOldResponsePath(),
GetOldUpdatesPath());
}
// Like DatabaseOldIO but only the deletes.
-TEST(SafeBrowsingDatabase, SKIP_MACOSX(DatabaseOldDeletesIO)) {
+TEST(SafeBrowsingDatabase, DatabaseOldDeletesIO) {
UpdateDatabase(GetOldSafeBrowsingPath(), GetOldResponsePath(), FilePath());
}
// Like DatabaseOldIO but only the updates.
-TEST(SafeBrowsingDatabase, SKIP_MACOSX(DatabaseOldUpdatesIO)) {
+TEST(SafeBrowsingDatabase, DatabaseOldUpdatesIO) {
UpdateDatabase(GetOldSafeBrowsingPath(), FilePath(), GetOldUpdatesPath());
}
// Does a a lot of addel's on very large chunks.
-TEST(SafeBrowsingDatabase, SKIP_MACOSX(DatabaseOldLotsofDeletesIO)) {
+TEST(SafeBrowsingDatabase, DatabaseOldLotsofDeletesIO) {
std::vector<ChunksInfo> chunks;
std::vector<SBChunkDelete> deletes;
SBChunkDelete del;