michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ : michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "storage_test_harness.h" michael@0: #include "nsIFile.h" michael@0: #include "prio.h" michael@0: michael@0: /** michael@0: * This file tests that the file permissions of the sqlite files match what michael@0: * we request they be michael@0: */ michael@0: michael@0: void michael@0: test_file_perms() michael@0: { michael@0: nsCOMPtr db(getDatabase()); michael@0: nsCOMPtr dbFile; michael@0: do_check_success(db->GetDatabaseFile(getter_AddRefs(dbFile))); michael@0: michael@0: uint32_t perms = 0; michael@0: do_check_success(dbFile->GetPermissions(&perms)); michael@0: michael@0: // This reflexts the permissions defined by SQLITE_DEFAULT_FILE_PERMISSIONS in michael@0: // db/sqlite3/src/Makefile.in and must be kept in sync with that michael@0: #ifdef ANDROID michael@0: do_check_true(perms == (PR_IRUSR | PR_IWUSR)); michael@0: #elif defined(XP_WIN) michael@0: do_check_true(perms == (PR_IRUSR | PR_IWUSR | PR_IRGRP | PR_IWGRP | PR_IROTH | PR_IWOTH)); michael@0: #else michael@0: do_check_true(perms == (PR_IRUSR | PR_IWUSR | PR_IRGRP | PR_IROTH)); michael@0: #endif michael@0: } michael@0: michael@0: void (*gTests[])(void) = { michael@0: test_file_perms, michael@0: }; michael@0: michael@0: const char *file = __FILE__; michael@0: #define TEST_NAME "file perms" michael@0: #define TEST_FILE file michael@0: #include "storage_test_harness_tail.h"