FileSystemParentTestHelpers.h (1972B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef DOM_FS_TEST_GTEST_PARENT_FILESYSTEMPARENTTESTHELPERS_H_ 8 #define DOM_FS_TEST_GTEST_PARENT_FILESYSTEMPARENTTESTHELPERS_H_ 9 10 #include "mozilla/dom/FileSystemTypes.h" 11 12 namespace mozilla::dom { 13 14 namespace quota { 15 16 struct OriginMetadata; 17 class UsageInfo; 18 19 } // namespace quota 20 21 namespace fs { 22 23 class FileSystemChildMetadata; 24 template <class T> 25 class Registered; 26 27 namespace data { 28 29 class FileSystemDatabaseManager; 30 class FileSystemDataManager; 31 32 } // namespace data 33 } // namespace fs 34 } // namespace mozilla::dom 35 36 namespace mozilla::dom::fs::test { 37 38 int GetPageSize(); 39 40 const Name& GetTestFileName(); 41 42 uint64_t BytesOfName(const Name& aName); 43 44 const nsCString& GetTestData(); 45 46 void CreateNewEmptyFile(data::FileSystemDatabaseManager* const aDatabaseManager, 47 const FileSystemChildMetadata& aFileSlot, 48 EntryId& aEntryId); 49 50 void WriteDataToFile(const quota::OriginMetadata& aOriginMetadata, 51 data::FileSystemDatabaseManager* const aDatabaseManager, 52 const EntryId& aEntryId, const nsCString& aData); 53 54 void CreateRegisteredDataManager( 55 const quota::OriginMetadata& aOriginMetadata, 56 Registered<data::FileSystemDataManager>& aRegisteredDataManager); 57 58 void GetUsageValue(const quota::UsageInfo& aUsage, uint64_t& aValue); 59 60 void CheckUsageIsNothing(const quota::UsageInfo& aUsage); 61 62 void CheckUsageEqualTo(const quota::UsageInfo& aUsage, uint64_t aExpected); 63 64 void CheckUsageGreaterThan(const quota::UsageInfo& aUsage, uint64_t aExpected); 65 66 } // namespace mozilla::dom::fs::test 67 68 #endif // DOM_FS_TEST_GTEST_PARENT_PARENT_FILESYSTEMPARENTTESTHELPERS_H_