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

Side by Side Diff: sql/test/test_helpers.h

Issue 1176653002: mandoline filesystem: add a sqlite3 vfs to proxy filesystem usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with ToT and fix the test import. Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SQL_TEST_TEST_HELPERS_H_ 5 #ifndef SQL_TEST_TEST_HELPERS_H_
6 #define SQL_TEST_TEST_HELPERS_H_ 6 #define SQL_TEST_TEST_HELPERS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 15 matching lines...) Expand all
26 // SQLite stores the database size in the header, and if the actual 26 // SQLite stores the database size in the header, and if the actual
27 // OS-derived size is smaller, the database is considered corrupt. 27 // OS-derived size is smaller, the database is considered corrupt.
28 // [This case is actually a common form of corruption in the wild.] 28 // [This case is actually a common form of corruption in the wild.]
29 // This helper sets the in-header size to one page larger than the 29 // This helper sets the in-header size to one page larger than the
30 // actual file size. The resulting file will return SQLITE_CORRUPT 30 // actual file size. The resulting file will return SQLITE_CORRUPT
31 // for most operations unless PRAGMA writable_schema is turned ON. 31 // for most operations unless PRAGMA writable_schema is turned ON.
32 // 32 //
33 // Returns false if any error occurs accessing the file. 33 // Returns false if any error occurs accessing the file.
34 bool CorruptSizeInHeader(const base::FilePath& db_path) WARN_UNUSED_RESULT; 34 bool CorruptSizeInHeader(const base::FilePath& db_path) WARN_UNUSED_RESULT;
35 35
36 // Common implementation of CorruptSizeInHeader() which operates on loaded
37 // memory. Shared between CorruptSizeInHeader() and the the mojo proxy testing
38 // code.
39 void CorruptSizeInHeaderMemory(unsigned char* header, int64_t db_size);
40
36 // Frequently corruption is a result of failure to atomically update 41 // Frequently corruption is a result of failure to atomically update
37 // pages in different structures. For instance, if an index update 42 // pages in different structures. For instance, if an index update
38 // takes effect but the corresponding table update does not. This 43 // takes effect but the corresponding table update does not. This
39 // helper restores the prior version of a b-tree root after running an 44 // helper restores the prior version of a b-tree root after running an
40 // update which changed that b-tree. The named b-tree must exist and 45 // update which changed that b-tree. The named b-tree must exist and
41 // must be a leaf node (either index or table). Returns true if the 46 // must be a leaf node (either index or table). Returns true if the
42 // on-disk file is successfully modified, and the restored page 47 // on-disk file is successfully modified, and the restored page
43 // differs from the updated page. 48 // differs from the updated page.
44 // 49 //
45 // The resulting database should be possible to open, and many 50 // The resulting database should be possible to open, and many
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 82
78 // Return the results of running "PRAGMA integrity_check" on |db|. 83 // Return the results of running "PRAGMA integrity_check" on |db|.
79 // TODO(shess): sql::Connection::IntegrityCheck() is basically the 84 // TODO(shess): sql::Connection::IntegrityCheck() is basically the
80 // same, but not as convenient for testing. Maybe combine. 85 // same, but not as convenient for testing. Maybe combine.
81 std::string IntegrityCheck(sql::Connection* db) WARN_UNUSED_RESULT; 86 std::string IntegrityCheck(sql::Connection* db) WARN_UNUSED_RESULT;
82 87
83 } // namespace test 88 } // namespace test
84 } // namespace sql 89 } // namespace sql
85 90
86 #endif // SQL_TEST_TEST_HELPERS_H_ 91 #endif // SQL_TEST_TEST_HELPERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698