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

Unified Diff: sql/test/test_helpers.h

Issue 2424533002: Modify sync unit test to use standard sql::test:: helper. (Closed)
Patch Set: BUILD.gn merge Created 4 years, 2 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
« no previous file with comments | « components/sync/test/directory_backing_store_corruption_testing.cc ('k') | sql/test/test_helpers.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sql/test/test_helpers.h
diff --git a/sql/test/test_helpers.h b/sql/test/test_helpers.h
index 71f7c3c57513b9923a937717cdf681e0dca490a1..6ea666197bf5eaf56f7eed884eeeb2479a2c82b4 100644
--- a/sql/test/test_helpers.h
+++ b/sql/test/test_helpers.h
@@ -33,6 +33,10 @@ namespace test {
// actual file size. The resulting file will return SQLITE_CORRUPT
// for most operations unless PRAGMA writable_schema is turned ON.
//
+// This function operates on the raw database file, outstanding database
+// connections may not see the change because of the database cache. See
+// CorruptSizeInHeaderWithLock().
+//
// Returns false if any error occurs accessing the file.
bool CorruptSizeInHeader(const base::FilePath& db_path) WARN_UNUSED_RESULT;
@@ -41,6 +45,12 @@ bool CorruptSizeInHeader(const base::FilePath& db_path) WARN_UNUSED_RESULT;
// code.
void CorruptSizeInHeaderMemory(unsigned char* header, int64_t db_size);
+// Call CorruptSizeInHeader() while holding a SQLite-compatible lock
+// on the database. This can be used to corrupt a database which is
+// already open elsewhere. Blocks until a write lock can be acquired.
+bool CorruptSizeInHeaderWithLock(
+ const base::FilePath& db_path) WARN_UNUSED_RESULT;
+
// Frequently corruption is a result of failure to atomically update
// pages in different structures. For instance, if an index update
// takes effect but the corresponding table update does not. This
« no previous file with comments | « components/sync/test/directory_backing_store_corruption_testing.cc ('k') | sql/test/test_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698