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

Unified Diff: sql/test/test_helpers.cc

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 | « sql/test/test_helpers.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sql/test/test_helpers.cc
diff --git a/sql/test/test_helpers.cc b/sql/test/test_helpers.cc
index 77a05d8255a00d6572fa2a1fe886ac357ec064d3..7c21aea9fa6926db843c3e7ebfeae3bfd6e32e3b 100644
--- a/sql/test/test_helpers.cc
+++ b/sql/test/test_helpers.cc
@@ -99,6 +99,19 @@ bool CorruptSizeInHeader(const base::FilePath& db_path) {
return true;
}
+bool CorruptSizeInHeaderWithLock(const base::FilePath& db_path) {
+ sql::Connection db;
+ if (!db.Open(db_path))
+ return false;
+
+ // Prevent anyone else from using the database. The transaction is
+ // rolled back when |db| is destroyed.
+ if (!db.Execute("BEGIN EXCLUSIVE"))
+ return false;
+
+ return CorruptSizeInHeader(db_path);
+}
+
void CorruptSizeInHeaderMemory(unsigned char* header, int64_t db_size) {
const size_t kPageSizeOffset = 16;
const size_t kFileChangeCountOffset = 24;
« no previous file with comments | « sql/test/test_helpers.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698