diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /storage/test/unit/test_page_size_is_32k.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'storage/test/unit/test_page_size_is_32k.js')
-rw-r--r-- | storage/test/unit/test_page_size_is_32k.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/storage/test/unit/test_page_size_is_32k.js b/storage/test/unit/test_page_size_is_32k.js new file mode 100644 index 0000000000..4a91d13fdc --- /dev/null +++ b/storage/test/unit/test_page_size_is_32k.js @@ -0,0 +1,31 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +// This file tests that dbs are using 32k pagesize + +const kExpectedPageSize = 32768; // 32K +const kExpectedCacheSize = -2048; // 2MiB + +function check_size(db) { + var stmt = db.createStatement("PRAGMA page_size"); + stmt.executeStep(); + Assert.equal(stmt.getInt32(0), kExpectedPageSize); + stmt.finalize(); + stmt = db.createStatement("PRAGMA cache_size"); + stmt.executeStep(); + Assert.equal(stmt.getInt32(0), kExpectedCacheSize); + stmt.finalize(); +} + +function new_file(name) { + var file = Services.dirsvc.get("ProfD", Ci.nsIFile); + file.append(name + ".sqlite"); + Assert.ok(!file.exists()); + return file; +} + +function run_test() { + check_size(getDatabase(new_file("shared32k"))); + check_size(Services.storage.openUnsharedDatabase(new_file("unshared32k"))); +} |