tor-browser

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

FileSystemParentTest.h (2042B)


      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_FILESYSTEMPARENTTEST_H_
      8 #define DOM_FS_TEST_GTEST_PARENT_FILESYSTEMPARENTTEST_H_
      9 
     10 #include "mozilla/dom/FileSystemHelpers.h"
     11 #include "mozilla/dom/FileSystemTypes.h"
     12 #include "mozilla/dom/quota/test/QuotaManagerDependencyFixture.h"
     13 #include "nsStringFwd.h"
     14 
     15 namespace mozilla::dom {
     16 
     17 namespace quota {
     18 
     19 class UsageInfo;
     20 
     21 }  // namespace quota
     22 
     23 namespace fs {
     24 
     25 struct FileId;
     26 
     27 namespace data {
     28 
     29 class FileSystemDataManager;
     30 
     31 }  // namespace data
     32 }  // namespace fs
     33 }  // namespace mozilla::dom
     34 
     35 namespace mozilla::dom::fs::test {
     36 
     37 class FileSystemParentTest : public quota::test::QuotaManagerDependencyFixture {
     38 protected:
     39  FileSystemParentTest();
     40 
     41  ~FileSystemParentTest();
     42 
     43  static void SetUpTestCase();
     44 
     45  static void TearDownTestCase();
     46 
     47  void TearDown() override;
     48 
     49  static void InitializeTemporaryOrigin(bool aCreateIfNonExistent = true);
     50 
     51  static void GetOriginUsage(quota::UsageInfo& aResult);
     52 
     53  static void GetCachedOriginUsage(quota::UsageInfo& aResult);
     54 
     55  static void InitializeTemporaryClient();
     56 
     57  static void GetStaticDatabaseUsage(quota::UsageInfo& aDatabaseUsage);
     58 
     59  void EnsureDataManager();
     60 
     61  void ReleaseDataManager();
     62 
     63  void LockExclusive(const EntryId& aEntryId);
     64 
     65  void UnlockExclusive(const EntryId& aEntryId);
     66 
     67  void CreateNewEmptyFile(EntryId& aEntryId);
     68 
     69  void WriteDataToFile(EntryId& aEntryId, const nsCString& aData);
     70 
     71  void RemoveFile(bool& aWasRemoved);
     72 
     73  void GetDatabaseUsage(quota::UsageInfo& aDatabaseUsage);
     74 
     75  void UpdateDatabaseUsage(const FileId& aFileId);
     76 
     77 private:
     78  Registered<data::FileSystemDataManager> mDataManager;
     79 };
     80 
     81 }  // namespace mozilla::dom::fs::test
     82 
     83 #endif  // DOM_FS_TEST_GTEST_PARENT_FILESYSTEMPARENTTEST_H_