tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_page_size_is_32k.js (879B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/
      3 */
      4 
      5 // This file tests that dbs are using 32k pagesize
      6 
      7 const kExpectedPageSize = 32768; // 32K
      8 const kExpectedCacheSize = -2048; // 2MiB
      9 
     10 function check_size(db) {
     11  var stmt = db.createStatement("PRAGMA page_size");
     12  stmt.executeStep();
     13  Assert.equal(stmt.getInt32(0), kExpectedPageSize);
     14  stmt.finalize();
     15  stmt = db.createStatement("PRAGMA cache_size");
     16  stmt.executeStep();
     17  Assert.equal(stmt.getInt32(0), kExpectedCacheSize);
     18  stmt.finalize();
     19 }
     20 
     21 function new_file(name) {
     22  var file = Services.dirsvc.get("ProfD", Ci.nsIFile);
     23  file.append(name + ".sqlite");
     24  Assert.ok(!file.exists());
     25  return file;
     26 }
     27 
     28 function run_test() {
     29  check_size(getDatabase(new_file("shared32k")));
     30  check_size(Services.storage.openUnsharedDatabase(new_file("unshared32k")));
     31 }