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

Unified Diff: sync/test/directory_backing_store_corruption_testing.cc

Issue 1104423005: Revert of [Sync] Erase sync DB when corrupted (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: sync/test/directory_backing_store_corruption_testing.cc
diff --git a/sync/test/directory_backing_store_corruption_testing.cc b/sync/test/directory_backing_store_corruption_testing.cc
deleted file mode 100644
index 9767e5619126a6d395a81416276352228648e749..0000000000000000000000000000000000000000
--- a/sync/test/directory_backing_store_corruption_testing.cc
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "sync/test/directory_backing_store_corruption_testing.h"
-
-#include "base/files/file_util.h"
-#include "base/files/scoped_file.h"
-
-namespace syncer {
-namespace syncable {
-namespace corruption_testing {
-
-// This value needs to be large enough to force the underlying DB to be read
-// from disk before writing. The value *may* depend on the underlying DB page
-// size as well as the DB's cache_size PRAGMA.
-const int kNumEntriesRequiredForCorruption = 4000;
-
-bool CorruptDatabase(const base::FilePath& backing_file_path) {
- // Corrupt the DB by write a bunch of zeros at the beginning.
- //
- // Because the file may already open for writing, it's important that we open
- // it in a sharing-compatible way for platforms that have the concept of
- // shared/exclusive file access (e.g. Windows).
- base::ScopedFILE db_file(base::OpenFile(backing_file_path, "wb"));
- if (!db_file.get())
- return false;
- const std::string zeros(4096, '\0');
- const int num_written = fwrite(zeros.data(), zeros.size(), 1, db_file.get());
- return num_written == 1U;
-}
-
-} // namespace corruption_util
-} // namespace syncable
-} // namespace syncer
« no previous file with comments | « sync/test/directory_backing_store_corruption_testing.h ('k') | sync/util/mock_unrecoverable_error_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698