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 |