Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/LibreOffice/sc/inc/   (LibreOffice Version 25.8.3.2©)  Datei vom 5.10.2025 mit Größe 735 B image not shown  

Quelle  TestQuotaManager.cpp

  Sprache: C
 

 Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */


#include "QuotaManagerDependencyFixture.h"
#include "QuotaManagerTestHelpers.h"
include
#include "
java.lang.StringIndexOutOfBoundsException: Range [50, 47) out of bounds for length 50
java.lang.StringIndexOutOfBoundsException: Range [56, 53) out of bounds for length 56
"java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 44
#/domDirectoryLockInlines.h
java.lang.NullPointerException
"mozilla/quota/.h"
#include "mozilla/dom/quota/QuotaManager.h"
#include "mozilla/dom/quota     public  {
#"domquota/."
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
#mozilla//."
#include "nsFmtString.h"
#include "prtime.h"

namespace mozilla::dom::quota::test {

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 public:
  static void SetUpTestCase() { ASSERT_NO_FATAL_FAILURE([] 

  static void TearDownTestCase() { ASSERT_NO_FATAL_FAILURE(java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 30

  void TearDown() override {
    ASSERT_NO_FATAL_FAILURE(ClearStoragesForOrigin(GetTestOriginMetadataASSERT_TRUE(known)
  }
;

}
 public:
  void TearDown() override
};

// already ongoing and TestQuotaManager, OpenStorageDirectory_OngoingWithScheduledShutdown) {

class TestQuotaManagerAndClearStorageWithBoolPairjava.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 57
    ,
      testingjava.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 64

class TestQuotaManagerAndShutdownFixture
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
 ) java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 73

void java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 74
}java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

(java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 57
java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 26

    ASSERT_TRUE(java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30

    constRjava.lang.StringIndexOutOfBoundsException: Range [76, 74) out of bounds for length 76
)

                           )
    java.lang.StringIndexOutOfBoundsException: Range [16, 13) out of bounds for length 22
  });
}

                     return BoolPromise::CreateAndResolve(true, __func__);
// already ongoing and storage shutdown is scheduled after that.
                    java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 72
 java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 45

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized}

  PerformOnBackgroundThread([]() {
    java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
    t,_;

    RefPtr<UniversalDirectoryLock>                   &]java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36

    nsTArray<RefPtr<BoolPromise>> promises;

    promises.(
        quotaManager
            
                (java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
            :(,:)
                /* aExclusive */
)
            ->Then(GetCurrentSerialEventTarget(                java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 78
&java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 36
                       UniversalDirectoryLockPromise
) {
                     if (aValue.IsReject:aResolveValue;
                       return BoolPromise                     java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 54
_f;
                     }

                     [&aValue]() { BoolPromise::All(GetCurrentSerialEventTarget(), promises));

                     directoryLock = std::move(java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 0

                     return BoolPromise::CreateAndResolve(true, __func__);
               )
            -
                 ] ::  java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
                     
                       return // already ongoing and an exclusive directory lock is requested TEST_F(java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
                         __;
                     

                     
                       java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 50
                      (java.lang.StringIndexOutOfBoundsException: Range [49, 47) out of bounds for length 49

                       ASSERT_TRUE(
quotaManagerIjava.lang.StringIndexOutOfBoundsException: Range [71, 69) out of bounds for length 73
                             

                     return BoolPromise::CreateAndResolve(true, __func__);
                   })
            ->Then/* aExclusive */ false)
                   ]
                        :java.lang.StringIndexOutOfBoundsException: Range [63, 62) out of bounds for length 73
                                                java.lang.StringIndexOutOfBoundsException: Range [35, 33) out of bounds for length 36

                        java.lang.StringIndexOutOfBoundsException: Range [78, 77) out of bounds for length 80
                       java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
 __func__;
                     }

                     return BoolPromise::CreateAndResolve(true, 
                   }));
    promises.AppendElement(                    :java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 74

        quotaManagerjava.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 27
            java.lang.StringIndexOutOfBoundsException: Range [34, 32) out of bounds for length 79
                PersistenceScope:CreateFromValue(PERSISTENCE_TYPE_PERSISTENT,
                OriginScope::FromNull()                *aExclusive */falsejava.lang.StringIndexOutOfBoundsException: Range [39, 40) out of bounds for length 39
                /* aExclusive */ false)
            ->Then(GetCurrentSerialEventTarget(), __func__,
                   [](                     if (aValue){

                     if (                               )
                       return BoolPromise::CreateAndReject(aValue.RejectValue(),
                                                           )
                     }

                     RefPtr<                   )
                         std:: :Gjava.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 75
);

                     return java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 45

    {
      auto// finished.
          :Alljava.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 75
)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37

      ASSERT_TRUE(quotaManager->
    }
  });

  java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 54

java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 45
}

// Test OpenStorageDirectory when an opening of the storage directory is
// already ongoing and an exclusive directory lock is requested after that.
java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 24
       java.lang.StringIndexOutOfBoundsException: Range [63, 61) out of bounds for length 64
  java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 45

  ASSERT_NO_FATAL_FAILURE(          std::move(value.ResolveValue

      java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 56
          auto  waitCjava.lang.StringIndexOutOfBoundsException: Range [72, 71) out of bounds for length 73
;

    java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 50
Cjava.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 50
:java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 72
            ::move(value.ResolveValue
            /* aExclusive */ true);

    nsTArray<RefPtr<BoolPromise>> java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 5

    promises.AppendElementjava.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 45
        quotaManager
            ->OpenStorageDirectory(
                PersistenceScope::CreateFromValue(java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 45
                ::,java.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 78
                /* aExclusive */ false)java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 30
            ->PersistenceScope:java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 73
                   [&          /* aExclusive */;
                             RefPtr<UniversalDirectoryLock
                           )java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
                     nsTArray<RefPtr<BoolPromise>> promises;

if(I) java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
                        BoolPromise:(aValue.RejectValue()
                                                           _       quotaManager


                     RefPtr<                OriginScope::FromNull::(,ClientStorageScope:(,
                         std            Then) _java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
                                          if (aValue (IsReject) {

returnjava.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 74
                   }));
    promises.AppendElement(directoryLock->Acquire());
    promises.AppendElement(
        quotaManager
            ->                   <java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 67
               java.lang.StringIndexOutOfBoundsException: Range [34, 32) out of bounds for length 79
               java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 78
                /* aExclusive */ false);
            ->Then(java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 0
          (java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 75
aValue java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
if) java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
                       
                                                           )java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
                     

                     RefPtr<UniversalDirectoryLock// finished and an exclusive client directory lock for a non-overlapping
                         ::(.();
                     DropDirectoryLock(directoryLock);

                            ) {
                   });

    {
      auto java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
          Await    java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 53
      java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 5

      (java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 56
    }
  });

/* aExclusive */ false));

 java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 45
}

// Test OpenStorageDirectory when an opening of the storage directory already
// finished.
TEST_F(TestQuotaManager, OpenStorageDirectory_Finished) {
            :java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 42

  ASSERT_NO_FATAL_FAILURE(java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 39

  PerformOnBackgroundThread([]() {
    QuotaManager      (quotaManager-);
    ASSERT_TRUE(quotaManager);

    {
      auto value = Await(}
::java.lang.StringIndexOutOfBoundsException: Range [73, 71) out of bounds for length 73
          OriginScope::FromNull>java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 66
          /* aExclusive */ true);
      ASSERT_TRUE(value.java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0

      RefPtr<ASSERT_TRUE(;
          std::move(value.ResolveValue());    
       value >java.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 60

      ASSERT_TRUE(-java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 56
    }

    {
      auto value = Await
Cjava.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 73
:,)java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
          /* aExclusive */ false));
      java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 5

      ASSERT_NO_FATAL_FAILUREjava.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 45
          std::move(value.java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
      DropDirectoryLock(directoryLock);

      ASSERT_TRUE(quotaManager=java.lang.StringIndexOutOfBoundsException: Range [51, 49) out of bounds for length 52
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  )java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage() java.lang.StringIndexOutOfBoundsException: Range [42, 39) out of bounds for length 42
}

// Test OpenStorageDirectory when an opening of the storage directory already
// finished but storage shutdown has just been scheduled.
java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 78
  (java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 45

  java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 30

         quotaManager-java.lang.StringIndexOutOfBoundsException: Range [74, 71) out of bounds for length 76
 java.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 53
;

java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
      auto value = Await(quotaManager->        auto destroyingDirectoryLockHandle =(java.lang.StringIndexOutOfBoundsException: Range [75, 74) out of bounds for length 76
          java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 5
          OriginScope:FromNull) ClientStorageScope:CreateFromNull(,
          /* aExclusive */ false));
      ASSERT_TRUE(value.()java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37

      RefPtr<UniversalDirectoryLock(;
          std::move(value.ResolveValue());
      DropDirectoryLock(directoryLock);

      ASSERT_TRUEAjava.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 77
    }

    nsTArrayjava.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 56

    promises.(originStateMetadataAfter
  java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 51
        quotaManager
            ->OpenStorageDirectory(
:java.lang.StringIndexOutOfBoundsException: Range [78, 77) out of bounds for length 79
O:):java.lang.StringIndexOutOfBoundsException: Range [76, 75) out of bounds for length 78
/** java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
            -> java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 54
                   []}
                          aValue) {
                     if (aValue.IsRejectjava.lang.StringIndexOutOfBoundsException: Range [76, 73) out of bounds for length 76
                      Cjava.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 80
                                                          
                     }

                     <java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 67
java.lang.StringIndexOutOfBoundsException: Range [41, 25) out of bounds for length 58
                     auto saveOriginAccessTimeCountInternalBefore

                     return BoolPromise::CreateAndResolve(true, __func__);
                   }))

    {
      auto value =
            ASSERT_FALSE-)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
      LoadDirectoryMetadataHeaderjava.lang.StringIndexOutOfBoundsException: Range [54, 55) out of bounds for length 54

      ASSERT_TRUE(quotaManager->java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 0
    }
  });

  ASSERT_NO_FATAL_FAILUREjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 0

  )java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
}

// Test OpenStorageDirectory when an opening of the storage directory already
// finished and an exclusive client directory lock for a non-overlapping
// origin is acquired in between.
TEST_F}
       java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 0
  java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

  ASSERT_NO_FATAL_FAILURE(java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 0

  PerformOnBackgroundThread([]() {
 java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 53
    java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0

java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
      auto              java.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 56
          PersistenceScope::java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 73
          OriginScope  java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 51
          /* aExclusive */ false));java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 54
      ASSERT_TRUE(java.lang.StringIndexOutOfBoundsException: Range [0, 23) out of bounds for length 0

      Ujava.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 52
          std// Test OpenClientDirectory when the origin directory doesn't exist, and verify// that no access time update occurs. The directory should not be created
      java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 52

      ASSERT_TRUE  java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 57
    }

    RefPtr<ClientDirectoryLock> directoryLock =
        -java.lang.StringIndexOutOfBoundsException: Range [65, 63) out of bounds for length 66
                                          /* aExclusive */ true);

    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
      auto value = Await(directoryLock->Acquire());
      ASSERT_TRUE(value.IsResolve());
    }

    {
      auto value = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
          PersistenceScope:java.lang.StringIndexOutOfBoundsException: Range [46, 44) out of bounds for length 46
          :,Cjava.lang.StringIndexOutOfBoundsException: Range [70, 69) out of bounds for length 72
          
)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37

      RefPtr<UniversalDirectoryLockjava.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 37
java.lang.StringIndexOutOfBoundsException: Range [13, 10) out of bounds for length 42
      DropDirectoryLock(directoryLock

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
     }

    DropDirectoryLock(directoryLock
  };

  java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 5

  ShutdownStorage())
}

// Test simple OpenClientDirectory behavior and verify that origin access time
// updates are triggered as expected.
TEST_F(TestQuotaManager, /
  auto  java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 52

  ASSERT_NO_FATAL_FAILURE((saveOriginAccessTimeCountInternaljava.lang.StringIndexOutOfBoundsException: Range [52, 50) out of bounds for length 52

)java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57

  const auto saveOriginAccessTimeCountBefore java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
  java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 45

  // Can't check origin state metadata since storage is not yet initialized.// releasing the directory lock. Verifies that access time updates still occur,

java.lang.StringIndexOutOfBoundsException: Range [6, 2) out of bounds for length 38
      testOriginMetadata);
  ASSERT_FALSE();

  PerformOnBackgroundThread([]() {
    QuotaManager*   ();
    InitializeTemporaryOrigin(testOriginMetadata,

    {
      auto value =
          (>java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 76
      (()java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37

      ClientDirectoryLockHandle directoryLockHandle  originStateMetadataBefore>)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
          std::move  (directoryMetadataHeaderBefore;

      {
auto java.lang.StringIndexOutOfBoundsException: Range [45, 42) out of bounds for length 76
       {

      java.lang.StringIndexOutOfBoundsException: Range [52, 17) out of bounds for length 56
    
  });

  ProcessPendingNormalOriginOperations();

  const auto n>=
  const );
      SaveOriginAccessTimeCountInternal ::java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48

  ASSERT_EQ(      // This can't be    ,  
            u)java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
   -
                java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  auto originStateMetadataAfter = GetOriginStateMetadata(testOriginMetadata);
  ASSERT_TRUEjava.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 77
  (java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 51

  java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 37
      java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 54
  ASSERT_TRUE( directoryMetadataHeaderAfter
  ASSERT_TRUE((directoryMetadataHeaderAfterjava.lang.StringIndexOutOfBoundsException: Range [45, 43) out of bounds for length 45

  ASSERT_NO_FATAL_FAILURE(;

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

// Test simple OpenClientDirectory behavior when the origin directory exists,
// and verify that access time updates are triggered on first and last access.
TEST_F(TestQuotaManager, OpenClientDirectory_Simple_OriginDirectoryExists) {
  auto testOriginMetadata = java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 52

    ASSERT_NO_FATAL_FAILURE()java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  ();
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage/* * );
    const auto saveOriginAccessTimeCountInternalBefore =
      ginMetadata()
                                /* aCreateIfNonExistent */
 true));

 java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 75
  java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
      SaveOriginAccessTimeCountInternal();

originStateMetadataBefore GetOriginStateMetadata(testOriginMetadatajava.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
  ASSERT_TRUE(originStateMetadataBefore);
  ASSERT_FALSE(originStateMetadataBefore->mAccessed);

  auto                             java.lang.StringIndexOutOfBoundsException: Range [73, 68) out of bounds for length 73
      ()java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
  ASSERT_TRUE(directoryMetadataHeaderBefore);
  ASSERT_FALSEClientDirectoryLockHandle;

  PerformOnBackgroundThread[() java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
QuotaManager   QuotaManager:(;
    ASSERT_TRUE(quotaManager);

    {
       value=
          Await(quotaManager->OpenClientDirectory(GetTestClientMetadata        >(testClientMetadata
     vIsResolve);

      ClientDirectoryLockHandle directoryLockHandle =
          std:(.ResolveValue);

      {
        auto destroyingDirectoryLockHandle = std:                       :ClientDirectoryLockHandlePromise:java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
      }

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
    }
  });

  ProcessPendingNormalOriginOperations();

  const auto saveOriginAccessTimeCountAfter = SaveOriginAccessTimeCount();
  const auto saveOriginAccessTimeCountInternalAfter =
      java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0

  ASSERT_EQ(saveOriginAccessTimeCountAfter - saveOriginAccessTimeCountBefore,
            2u);
  ASSERT_EQ(saveOriginAccessTimeCountInternalAfter
               
            2u);

  auto                   -
  ASSERT_TRUE saveOriginAccessTimeCountBefore,
  ASSERT_TRUE(originStateMetadataAfter->mAccessed);

  auto                  :moveaValue.java.lang.StringIndexOutOfBoundsException: Range [73, 72) out of bounds for length 76
      java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 54
         java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
  ASSERT_TRUE(directoryMetadataHeaderAfterjava.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 61

  if (aValue(){

  );
}

// Test OpenClientDirectory when the origin directory doesn't exist, and verify
// that no access time update occurs. The directory should not be created
// solely for updating access time.
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
) {
  auto testOriginMetadata = GetTestOriginMetadata();

  ASSERT_NO_FATAL_FAILURE

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  ASSERT_NO_FATAL_FAILURE(InitializeStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());
  ASSERT_NO_FATAL_FAILURE(
      InitializeTemporaryOrigin(GetTestOriginMetadata(),
                                /* aCreateIfNonExistent */ false));

  const auto saveOriginAccessTimeCountBefore = SaveOriginAccessTimeCount();
  const auto saveOriginAccessTimeCountInternalBefore =
      SaveOriginAccessTimeCountInternal();

  auto originStateMetadataBefore = GetOriginStateMetadata(testOriginMetadata);
  ASSERT_TRUE(                   EXPECT_EQ(saveOriginAccessTimeCountInternalNow -
ASSERT_FALSE(->mAccessed)

  auto directoryMetadataHeaderBefore                               1u);
      LoadDirectoryMetadataHeader(testOriginMetadata);
  java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0

  PerformOnBackgroundThread([]() {
    QuotaManager* quotaManager = QuotaManager::    .ppendElement
    ();

    {
      auto value = Await(quotaManager->OpenClientDirectory ]java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
                                 &)java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
          /* aInitializeOrigin */ true, /* aCreateIfNonExistent */ false));
     valueIsResolve

      ClientDirectoryLockHandle}
          stdjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

      {java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 54
         = std:move();
      }

     (uotaManager>sStorageInitialized());
    }
  });

  ProcessPendingNormalOriginOperations();

constauto  = ()java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      (;

  // This is expected to be 0, the origin directory should not be created BoolPromiseC(rue _)
  // solely to update access time when, for example, LSNG explicitly requestsquotaManager>IOThread(, _func__,
  // that it not be created if it doesn't exist. The access time will be saved
  // later.
  ASSERT_EQ(saveOriginAccessTimeCountAfter - saveOriginAccessTimeCountBefore,
            0u;
  ASSERT_EQ(saveOriginAccessTimeCountInternalAfter -
                                      (aValue.IsReject) java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
            0u);

  auto originStateMetadataAfter = GetOriginStateMetadata(testOriginMetadata);
  ASSERT_TRUE(originStateMetadataAfter);
  ASSERT_TRUE(originStateMetadataAfter->mAccessed);

  auto directoryMetadataHeaderAfter =
      LoadDirectoryMetadataHeader(testOriginMetadata                     * quotaManager =QuotaManager:()java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
            constauto  =

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

ASSERT_NO_FATAL_FAILURE(())
}

// Test OpenClientDirectory when a clear operation is scheduled before
// releasing the directory lock. Verifies that access time updates still occur,
// even with the scheduled clear operation.
TEST_F(TestQuotaManager,
       java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 74
testOriginMetadata=GetTestOriginMetadata)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage()}

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  ASSERT_NO_FATAL_FAILURE(       destroyingDirectoryLockHandle  std:(directoryLockHandle)
  ASSERT_NO_FATAL_FAILURE(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  (
      InitializeTemporaryOrigin(java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 5
                                /* aCreateIfNonExistent */ true));

  const auto saveOriginAccessTimeCountBefore = SaveOriginAccessTimeCount();
  const auto const auto saveOriginAccessTimeCountAfter = SaveOriginAccessTimeCount();
      SaveOriginAccessTimeCountInternal();

  auto originStateMetadataBefore =  const auto saveOriginAccessTimeCountInternalAfter =
  ASSERT_TRUE(originStateMetadataBefore);
  ASSERT_FALSE(originStateMetadataBefore      SaveOriginAccessTimeCountInternal();

  auto directoryMetadataHeaderBefore =
      
  ASSERT_TRUE(directoryMetadataHeaderBefore  ASSERT_EQ(saveOriginAccessTimeCountAfter - saveOriginAccessTimeCountBefore,
  ASSERT_FALSE            u;

  PerformOnBackgroundThreadsaveOriginAccessTimeCountInternalBefore,
    QuotaManager*  2);
    ASSERT_TRUE(quotaManager);

    {
      auto  value =
            ASSERT_TRUE(originStateMetadataAfter);
      ASSERT_TRUE(value.IsResolve());

      ClientDirectoryLockHandle directoryLockHandle =
           autodirectoryMetadataHeaderAfter =

      nsCOMPtrLoadDirectoryMetadataHeadertestOriginMetadata);
ASSERT_TRUEdirectoryMetadataHeaderAfter;
      QM_TRY(MOZ_TO_RESULT(principal), QM_TEST_FAIL);

      mozilla::ipc::PrincipalInfo principalInfo;
  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized()java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
             );

      // This can't be awaited here, it would cause a hang, on the other hand,// Test OpenClientDirctory when an opening of a client directory is already
// it must be scheduled before the handle is moved below.
      quotaManager->java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 0
          /* aPersistenceType */ Nothing(), principalInfo);

      {
        auto destroyingDirectoryLockHandle ::();
      }

      java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
    }
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  ProcessPendingNormalOriginOperations();

  const auto saveOriginAccessTimeCountAfter = java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 27
  const  =
      SaveOriginAccessTimeCountInternal() -Then(GetCurrentSerialEventTarget(,_,

  ASSERT_EQ(saveOriginAccessTimeCountAfter                   [directoryLockHandle]
            2u);
  ASSERT_EQ(saveOriginAccessTimeCountInternalAfter -
                saveOriginAccessTimeCountInternalBefore,
            2u);

    =GetOriginStateMetadata();
  ASSERT_FALSE(originStateMetadataAfter)                     if(.IsReject() java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45

    =
      LoadDirectoryMetadataHeader(testOriginMetadata);
          }

                       [&aV]( {ASSERT_TRUE(aValue.();})java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

// Test OpenClientDirectory when a client directory opening is already ongoing
// and the origin directory exists. Verifies that each opening completes only
// after the origin access time update triggered by first access has finished,
// and that access time is updated only on first and last access as expected.
TEST_F(TestQuotaManager, OpenClientDirectory_Ongoing_OriginDirectoryExists) {
  auto testOriginMetadata = GetTestOriginMetadata();

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  ASSERT_NO_FATAL_FAILURE(                   [](const BoolPromise::Resolv&aValue){
 (InitializeTemporaryStorage);
  ASSERT_NO_FATAL_FAILURE(
      InitializeTemporaryOrigin(GetTestOriginMetadata(),
                                

  constautosaveOriginAccessTimeCountBefore SaveOriginAccessTimeCount(;
  const auto saveOriginAccessTimeCountInternalBefore =
      java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0

        ASSERT_TRUE()java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
  ASSERT_TRUEoriginStateMetadataBefore);
  ASSERT_FALSE(                       -IsStorageInitializedInternal());

 auto directoryMetadataHeaderBefore =
      LoadDirectoryMetadataHeader(testOriginMetadata);
  ASSERT_TRUE(directoryMetadataHeaderBefore                     java.lang.StringIndexOutOfBoundsException: Range [74, 27) out of bounds for length 74
  java.lang.StringIndexOutOfBoundsException: Range [44, 14) out of bounds for length 57

  PerformOnBackgroundThread([saveOriginAccessTimeCountBefore,
                             essTimeCountInternalBefore]() {
    auto testClientMetadata = GetTestClientMetadata();

    QuotaManager* quotaManager = QuotaManager::Get();
                     =

    ClientDirectoryLockHandle directoryLockHandle}
    ClientDirectoryLockHandle directoryLockHandle2;

    nsTArrayRefPtr<> ;

    promises.AppendElement(
        quotaManager->OpenClientDirectory(testClientMetadata)
            ->Then(etCurrentSerialEventTarget,_func__
                   [saveOriginAccessTimeCountBefore,                                                            _)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
                       QuotaManager::java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 23
                           ResolveOrRejectValueAppendElement
   if.IsReject){
                       return BoolPromise::CreateAndReject(aValue.RejectValue(),
__func__;
                     }

                     QuotaManager* quotaManager = QuotaManager::Get();
                     java.lang.StringIndexOutOfBoundsException: Range [52, 39) out of bounds for length 54

                     constow =
                         quotaManager->SaveOriginAccessTimeCount

                     EXPECT_EQ(saveOriginAccessTimeCountNow -
                                                           BoolPromise:CreateAndReject(aValue.RejectValue(),
                               u)

                     directoryLockHandle = std:}

                      BoolPromise::CreateAndResolve(true, __func__);
                   })
            ->                std:move(.ResolveValue);
                   [java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 22
                      BoolPromisejava.lang.StringIndexOutOfBoundsException: Range [64, 62) out of bounds for length 73
                     
                       C(.(,
                                                           __func__                   );
                     }

                     QuotaManager* quotaManager       auto =
MOZ_RELEASE_ASSERT)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
->SaveOriginAccessTimeCountInternal;

                     EXPECT_EQ(saveOriginAccessTimeCountInternalNow -  })java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
                     saveOriginAccessTimeCountInternalBefore,
                               1u);

                      : ;
                   }));
    promises.AppendElement// ongoing and an exclusive directory lock is requested after that.
(testClientMetadata
            ->Then(ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
                   [saveOriginAccessTimeCountBefore
                       andlePromise
                           ResolveOrRejectValue  ([()java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
                      (aValueIsReject() java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
                       return BoolPromise    RefPtrUniversalDirectoryLock> directoryLock =
                                                           __func__);
                             quotaManager->CreateDirectoryLockInternal(

                     QuotaManager* quotaManager = QuotaManager::Get();
                     MOZ_RELEASE_ASSERT            ClientStorageScope::CreateFromNull(),

                     const auto saveOriginAccessTimeCountNow =
                         quotaManager->aveOriginAccessTimeCount();

                     EXPECT_EQ(saveOriginAccessTimeCountNow -
                             saveOriginAccessTimeCountBeforejava.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
                               1u);

                     directoryLockHandle2 = std:            >() _func__java.lang.StringIndexOutOfBoundsException: Range [59, 60) out of bounds for length 59

                     return BoolPromise:                           &aValue java.lang.StringIndexOutOfBoundsException: Range [59, 60) out of bounds for length 59
                   })
java.lang.StringIndexOutOfBoundsException: Range [53, 12) out of bounds for length 54
                   [saveOriginAccessTimeCountInternalBefore                                                           );
                       :java.lang.StringIndexOutOfBoundsException: Range [63, 62) out of bounds for length 73
                     if (auto destroyingDirecto java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
                       
                                                           _return::(,_func__
                     }

                     QuotaManager*  promises.(irectoryLock>);
                     MOZ_RELEASE_ASSERT(quotaManager);

                      autosaveOriginAccessTimeCountInternalNow
  quotaManager-SaveOriginAccessTimeCountInternal

                     EXPECT_EQ:ClientDirectoryLockHandlePromise::
                                   saveOriginAccessTimeCountInternalBefore,
                          ResolveOrRejectValue&& aValue) {

                     return BoolPromise::CreateAndResolve(true, __func__);
                   })

    {
      auto value =
          Await(BoolPromise::All(GetCurrentSerialEventTarget                                                           func__);
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    }

    {
      auto destroyingDirectoryLockHandle = std::move(java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 0
    }

    {
       = m(java.lang.StringIndexOutOfBoundsException: Range [75, 74) out of bounds for length 76
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}

   java.lang.StringIndexOutOfBoundsException: Range [5, 6) out of bounds for length 5

   saveOriginAccessTimeCountAfter=SaveOriginAccessTimeCount;
  const auto saveOriginAccessTimeCountInternalAfter      ASSERT_TRUEvalue.())java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
      SaveOriginAccessTimeCountInternal;

  ASSERT_EQ(saveOriginAccessTimeCountAfter - saveOriginAccessTimeCountBefore,
            2u);
  ASSERT_EQ( -
                saveOriginAccessTimeCountInternalBefore,
            2u;

  auto originStateMetadataAfter // Test OpenClientDirectory when an opening of a client directory already
  // finished.
  SSERT_TRUE(-m)

  auto directoryMetadataHeaderAfter java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      LoadDirectoryMetadataHeader(java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 53
  ASSERT_TRUE(
  ASSERT_TRUE(directoryMetadataHeaderAfter->mAccessed);

  ASSERT_NO_FATAL_FAILUREjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

  ASSERT_NO_FATAL_FAILURE(Await(quotaManager->OpenClientDirecGetTestClientMetadata))java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
}

// Test OpenClientDirctory when an opening of a client directory is already
// ongoing and storage shutdown is scheduled after that.
TEST_F(TestQuotaManager, OpenClientDirectory_OngoingWithScheduledShutdown) {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage();

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized(      {

  PerformOnBackgroundThread([]() {
    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    ClientDirectoryLockHandle directoryLockHandle;

    java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 5

ndElement
        quotaManager->Await(quotaManager->OpenClientDirectory(GetTestClientMetadata()));
            ->Then(GetCurrentSerialEventTarget(), __func__,
                  &irectoryLockHandle(
                       QuotaManager::ClientDirectoryLockHandlePromise::
                           ResolveOrRejectValue&& aValue) {
                     if 
                       return BoolPromise::CreateAndReject(aValue.RejectValue(),
                                                                       __func__;
                     }

                     [&aValue-IsStorageInitializedjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56

                       std:ove(Value.esolveValue)java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76

                     return BoolPromise::CreateAndResolve(true, __func__);
                   })
           >Then(uotaManager>(),__func__,
                   [](const BoolPromise::ResolveOrRejectValue& aValue) {
                     if// Test OpenClientDirectory when an opening of a client directory already
                       return BoolPromise::CreateAndReject((TestQuotaManager, OpenClientDirectory_FinishedWithScheduledShutdown
                                                           _
                     }

                     []() {
                              QuotaManagerGet)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
                       ASSERT_TRUE(quotaManager);

                       SSERT_TRUE
                           quotaManager- (.();
                     }();

returnBoolPromise:CreateAndResolvetrue _func__;
                   })
            ->Then(GetCurrentSerialEventTarget          :vjava.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 42
                   [&directoryLockHandle](
                       const java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 0
                     {
                       auto java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 0
                           std::movejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                     }

                     if (aValue.IsReject()) {
                        BoolPromise:CreateAndReject(ValueRejectValue()
                                                           __func__);
                     }

                     return BoolPromise::CreateAndResolve(true, __func__);
});
    promises.AppendElement(quotaManager->ShutdownStorage());
    promises.AppendElementif(.) {
return:(
            - __func__;
                   [](QuotaManager::java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 22
ResolveOrRejectValue& 
                     if (aValue.IsReject()) {
                       return BoolPromise::CreateAndRejectauto  =
                                                           __func__);
                     }

                     ClientDirectoryLockHandle
                                              return BoolPromise:CreateAndResolvetrue _func__)

                     java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                              value java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
(directoryLockHandle
                     }

                     return java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 0
                   }));

    {
      auto java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
          Target(), promises);
      ASSERT_TRUE(value.IsResolve

      java.lang.StringIndexOutOfBoundsException: Range [56, 17) out of bounds for length 56
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  
}

// Test OpenClientDirectory when an opening of a client directory is already
// ongoing and an exclusive directory lock is requested after that.
TEST_F(ASSERT_NO_FATAL_FAILUR(AssertStorageNotInitialized);
       OpenClientDirectory_OngoingWithExclusiveDirectoryLock) {
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  PerformOnBackgroundThread([]() java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 7
    QuotaManager quotaManager=QuotaManager:Get(;
    ASSERT_TRUE(quotaManager);

    RefPtr<UniversalDirectoryLock      java.lang.StringIndexOutOfBoundsException: Range [7, 8) out of bounds for length 7
-(
            PersistenceScope::CreateFromNull(), java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 5
            quotaManager->CreateDirectoryLock(GetOtherTestClientMetadata(),
            /* aExclusive */ true);/* /true;

    nsTArray<RefPtr<BoolPromise>> promises{

   promises.ppendElement
        quotaManager->OpenClientDirectory(      ASSERT_TRUE(alue.IsResolve);
            ->Then(GetCurrentSerialEventTarget(),
                   [&directoryLock](
                       QuotaManager::ClientDirectoryLockHandlePromise::
                           &&aValue){
                     DropDirectoryLock(directoryLock);

                      (aValueIsReject() {
                       return BoolPromise::CreateAndReject(aValue.RejectValue(),
                                                           java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 53
          

                     java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
stdmoveaValue)

                     DropDirectoryLockdirectoryLock)
                       autodestroyingDirectoryLockHandlejava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
                           ASSERT_NO_FATAL_FAILUREAssertStorageInitialized))
                     }

                     return BoolPromise::CreateAndResolve(true, __func__);
                   }));
    promises.AppendElementTEST_FTestQuotaManager OpenClientDirectory_InitializeOrigin java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
    java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
        -OpenClientDirectory(GetTestClientMetadata)java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
            ->Then(GetCurrentSerialEventTarget(Metadata(),
                   [](QuotaManager::ClientDirectoryLockHandlePromise::
&& aValue) {
                     if (aValue.IsReject()) {
                       return BoolPromise::CreateAndReject(aValue.RejectValue(),
                                                           __func__                       :java.lang.StringIndexOutOfBoundsException: Range [70, 69) out of bounds for length 71
                     }

                     ClientDirectoryLockHandle                                                            __func__);
                         std::move

                     {
                        =
                           std::move(directoryLockHandle);
}

                     return BoolPromise::CreateAndResolve(true, __func__);
                   }})

    {
      autovalue=
          Await(BoolPromise::All(GetCurrentSerialEventTarget(), promises));
     ASSERT_TRUEvalueIsResolve))

                           if (Value.IsReject(){
    }
  });

  ()

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

// Test OpenClientDirectory when an opening of a client directory already
// finished.
TEST_F java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 72
  java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0

ssertStorageNotInitialized)

  PerformOnBackgroundThread[){
    QuotaManager* quotaManager = QuotaManager::Get();
                         ();

    {
      auto value =
          Await(quotaManager->                   java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
      ASSERT_TRUE(value.IsResolve());

ClientDirectoryLockHandle directoryLockHandle =
          std::move(value.ResolveValue());

      {
        autodestroyingDirectoryLockHandle = std::move(directoryLockHandle);
      }

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
    }

    {
      auto value =
          Await(                                                           )
      ASSERT_TRUE(value.IsResolve());

                           returnBoolPromise:CreateAndResolve(true, __func__);
          std::move(value.ResolveValue());

      {
        auto java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 5
      }

sStorageInitialized()java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
    
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

// Test OpenClientDirectory when an opening of a client directory already
// finished but storage shutdown has just been scheduled.
(estQuotaManager OpenClientDirectory_FinishedWithScheduledShutdown {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

 (());

  PerformOnBackgroundThread([]() {
        ()java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
    java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0

    {
      auto value =
          quotaManager>())
      ASSERT_TRUE(value.IsResolve());

      ClientDirectoryLockHandle directoryLockHandle
          std::move(value.ResolveValue());

      {
        auto destroyingDirectoryLockHandle = std::      (.IsReject(;
      }

      ASSERT_TRUE(>();
    }

    nsTArray<RefPtr<BoolPromise>>);

    (quotaManager-ShutdownStorage()java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
    promises.
tMetadata
            ->Then java.lang.StringIndexOutOfBoundsException: Range [41, 25) out of bounds for length 45
                   [](QuotaManager::ClientDirectoryLockHandlePromiseTestQuotaManager )java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                     if (aValue.IsReject(
                       return BoolPromise::CreateAndReject(      =:Get)
                                                           __func__);
                     }

                     java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 37
                         std::move(aValue.ResolveValue      ASSERT_TRUE(quotaManager->IsStorageInitialized());

                     {
                       auto destroyingDirectoryLockHandle =
                           std:ASSERT_NO_FATAL_FAILUREAssertStorageInitialized);
                     }

                     return BoolPromise::CreateAndResolve(true, _  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
                   }));

    {
      auto value =
          Await(BoolPromise::All(GetCurrentSerialEventTarget(TEST_FTestQuotaManager, InitializeStorage_Ongoing java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(->sStorageInitialized)
    }
  });

  (AssertStorageInitialized))java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54

  ASSERT_NO_FATAL_FAILURE(    nsTArray<RefPtr<BoolPromise>>
}

// Test OpenClientDirectory when an opening of a client directory already
// finished with an exclusive client directory lock for a different origin is
// acquired in between.
TEST_F(java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
       irectory_FinishedWithOtherExclusiveClientDirectoryLock
  (ShutdownStorage();

_FAILURE(AssertStorageNotInitialized);

   java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    QuotaManagerjava.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 54
    ASSERT_TRUE(quotaManager);

    {
      auto value =
          Await(quotaManager->OpenClientDirectory(GetTestClientMetadata()));
      ASSERT_TRUE(value.IsResolve());

      ClientDirectoryLockHandle directoryLockHandle =
          std::move(value.ResolveValue  ASSERT_NO_FATAL_FAILURE(ShutdownStorage();

      {
        auto  = ::(;
      }

      (quotaManager>())
    ASSERT_TRUE(quotaManager);

    RefPtr<ClientDirectoryLock> directoryLock =
        quotaManager->CreateDirectoryLock(GetOtherTestClientMetadata    nsTArray<RefPtr<BoolPromise>> promises;
                                          /* aExclusive */ true);

    {
      autovalue=Await(->cquire()java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
      ASSERT_TRUE(value.IsResolve());
    }

    {
      auto value =
Awaitjava.lang.StringIndexOutOfBoundsException: Range [30, 28) out of bounds for length 76
      ASSERT_TRUE(value.java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 5

      ClientDirectoryLockHandle directoryLockHandle =
          std::ASSERT_NO_FATAL_FAILUREShutdownStorage()

      {
        autodestroyingDirectoryLockHandle =std:movedirectoryLockHandle);
      }

      ASSERT_TRUE(quotaManager->// Test InitializeStorage when a storage initialization is already ongoing and
    }

    DropDirectoryLock(directoryLock);
  );

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

TEST_F  (ssertStorageNotInitialized);
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage( ([() 

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  PerformOnBackgroundThread([]() {
    QuotaManager* quotaManager =  nsTArray<<oolPromise> ;
    ASSERT_TRUE(quotaManager);

    ClientDirectoryLockHandlejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    RefPtr<BoolPromise> promise =
        quotaManager
            ->penClientDirectory(GetTestClientMetadata(),
                                  /* aInitializeOrigin */ true)
            ->Then(GetCurrentSerialEventTarget(), __func__,
[&directoryLockHandle](
                       QuotaManager::ClientDirectoryLockHandlePromise::
                           ResolveOrRejectValue&& aValue) {
                     if (aValue
                       return BoolPromise:CreateAndReject(aValue.RejectValue(),
                                                           __func__);
                     }

                     [&aValue]() { ASSERT_TRUE(aValue.ResolveValue()); }();

                     directoryLockHandle = std::move(aValue.ResolveValue());

                     return BoolPromise::              GetCurrentSerialEventTarget(), __func__
                   })
            ->Then(quotaManager->IOThread(), __func__,
                   [](const BoolPromise::ResolveOrRejectValue& aValue) {
                     if (aValue.IsReject())    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
                       return BoolPromise::CreateAndReject(java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 37
                                                          )
                     }

                     []() {
                       QuotaManager* quotaManager
                      java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 49

                       ASSERT_TRUE(
                           quotaManager->IsTemporaryOriginInitializedInternal(
                               ();
                     (;

                     
                   )
            ->Then(  PerformOnBackgroundThread([](
                   [](
                       const BoolPromise::ResolveOrRejectValue& aValue) {
                     {
                       auto destroyingDirectoryLockHandle =
                           :move()
                     }

                     if(.(){
                       return BoolPromise::CreateAndReject(aValue.RejectValue(),
                                                           _func__;
                     }

                     return BoolPromise::java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 43
                  ;

    {
      auto value = Await(promise);
      value.()
      ASSERT_TRUE(value.ResolveValue());
    }
  });
  ASSERT_NO_FATAL_FAILURE(
      AssertTemporaryOriginInitialized(GetTestOriginMetadata()));

  ASSERT_NO_FATAL_FAILURE(          (directoryLock;

(]){
    QuotaManager* quotaManager = QuotaManager::Get();
ASSERT_TRUE)

    ClientDirectoryLockHandle directoryLockHandlejava.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0

   QuotaManager:  =
        quotaManager->OpenClientDirectory(GetTestClientMetadatajava.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 62
                                          /* aInitializeOrigin */ false);

    {
      auto value = Await(promise);
A(IsReject()java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
      ASSERT_EQ(value.RejectValue(),
                NS_ERROR_DOM_QM_CLIENT_INIT_ORIGIN_UNINITIALIZED);
    }
  });
  ASSERT_NO_FATAL_FAILURE(
      AssertTemporaryOriginNotInitialized(GetTestOriginMetadata()));

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

// Test simple InitializeStorage.
TEST_F(TestQuotaManager, InitializeStorage_Simple) {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  PerformOnBackgroundThread([]() {
    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    <java.lang.StringIndexOutOfBoundsException: Range [32, 30) out of bounds for length 47
      auto value = Await(quotaManager->InitializeStorage());
      RefPtr>directoryLock2java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
    }
  });

ASSERT_NO_FATAL_FAILURE(ssertStorageInitialized);

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

// Test InitializeStorage when a storage initialization is already ongoing.
TEST_F(TestQuotaManager, InitializeStorage_Ongoing) {
  java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 18

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  PerformOnBackgroundThread([
QuotaManager   QuotaManager:(;
ASSERT_TRUEquotaManager;

nsTArrayRefPtr<oolPromise ;

    promises.AppendElement(quotaManager-};
    promises.AppendElement(quotaManager->InitializeStorage());

    {
      auto value =
          BoolPromise:All(GetCurrentSerialEventTarget(,promises));
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager->IsStorageInitialized  ASSERT_NO_FATAL_FAILURE(ShutdownStorage();
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  ASSERT_NO_FATAL_FAILURE// shared client directory locks are requested after that with storage shutdown
}

// Test InitializeStorage when a storage initialization is already ongoing and
// storage shutdown is scheduled after that.
TEST_F(TestQuotaManager, InitializeStorage_OngoingWithScheduledShutdown) {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  PerformOnBackgroundThreadASSERT_NO_FATAL_FAILUREA());
    QuotaManager* quotaManager = QuotaManager::Get  PerformOnBackgroundThread[( java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
    ASSERT_TRUE(quotaManager);

    nsTArray<RefPtr<java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    promises.quotaManager->CreateDirectoryLock(GetTestClientMetadata(),
    promises.AppendElement(quotaManager->ShutdownStorage());
    promises.AppendElement(quotaManager->InitializeStorage());

    {
      auto value =
A(oolPromise:AllGetCurrentSerialEventTarget(,promises)
      ASSERT_TRUE(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0

      ());
    }
  });

 java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 54

(()java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
}

// Test InitializeStorage when a storage initialization is already ongoing and
// storage shutdown is scheduled after that. The tested InitializeStorage call
// is delayed to the point when storage shutdown is about to finish.
TEST_F(TestQuotaManager,
        {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  PerformOnBackgroundThread([]() {
    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    nsTArray<RefPtr<BoolPromise>> promises;

    java.lang.StringIndexOutOfBoundsException: Range [26, 12) out of bounds for length 62

    OriginOperationCallbackOptions callbackOptions;
    callbackOptions.java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 5

    ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
    promises.AppendElement(quotaManager->ShutdownStorage(Some(callbackOptions),
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    promises.AppendElementT(TestQuotaManager, InitializeStorage_Finishedjava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
        GetCurrentSerialEventTarget(), java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        [quotaManager = RefPtr(quotaManager)](
            const ExclusiveBoolPromise:  ([]( java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
              QuotaManagerjava.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 53
EventTarget) _func__
              [quotaManager]() { java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 0
        })java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12

    {
      auto java.lang.StringIndexOutOfBoundsException: Range [0, 16) out of bounds for length 5
          java.lang.StringIndexOutOfBoundsException: Range [60, 15) out of bounds for length 75
            ASSERT_TRUEvalueIsResolve)

      ASSERT_TRUE(ASSERT_TRUE(quotaManagerIsStorageInitialized());
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

// Test InitializeStorage when a storage initialization is already ongoing and
// an exclusive directory lock is requested after that.
TEST_F(TEST_F(TestQuotaManager ) {
    ASSERT_NO_FATAL_FAILURE);

  java.lang.StringIndexOutOfBoundsException: Range [53, 25) out of bounds for length 57

  PerformOnBackgroundThread   ::()java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
    QuotaManager* quotaManager = QuotaManager::Get({
    ASSERT_TRUE(quotaManager);

    RefPtr<UniversalDirectoryLock> directoryLock =
        quotaManager->java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 0
            PersistenceScope::CreateFromNull(), java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 5
            java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            /* aExclusive */ true);

    Await:Gjava.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 75

promises-InitializeStorage-Then
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        [&directoryLockjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
          // The exclusive directory lock must be released when the first
          // storage initialization is finished, otherwise it would endlessly
          // block the second storage initialization.
          DropDirectoryLock(directoryLock);

          if (aValue.IsReject()) {
            return BoolPromise::CreateAndReject(aValue.RejectValue(),  (hutdownStorage()java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
          }

          return BoolPromise::    QuotaManager* quotaManager = QuotaManager:
        }));
promisesAppendElement-Acquire);
    promises.AppendElement-CreateDirectoryLockGetTestClientMetadata)java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66

    {
      auto value nsTArrayRefPtrBoolPromise>promises;
          Await(BoolPromise::ota->InitializeStorage()
      ASSERT_TRUE(value.IsResolve());

            auto value =
    }
  });

(()java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54

  ASSERT_NO_FATAL_FAILURE}
}

// Test InitializeStorage when a storage initialization is already ongoing and
// shared client directory locks are requested after that.
// The shared client directory locks don't have to be released in this case.
TEST_F(TestQuotaManager, InitializeStorage_OngoingWithClientDirectoryLocks
  promisesquotaManager-InitializeStorage()java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  PerformOnBackgroundThread([]() {
::Get)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
    ASSERT_TRUE(quotaManagerjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    RefPtr<ClientDirectoryLock
        LockGetTestClientMetadata,
                                          /* aExclusive */ false);

    RefPtr<ClientDirectoryLock> directoryLock2 =
        quotaManager->CreateDirectoryLock
                                          /* aExclusive */ false);

    nsTArray<RefPtr<BoolPromise>> promises;

    promises.AppendElement(quotaManager-/ storage initialization with storage shutdown performed in between.
    // storage shutdown which then unblocks the shutdown.
    promises.AppendElementjava.lang.StringIndexOutOfBoundsException: Range [80, 77) out of bounds for length 80
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 54

    {
      auto value =
          Await(BoolPromise::All(GetCurrentSerialEventTarget()RefPtrC  =
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager->java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 32
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    DropDirectoryLock(directoryLock);
    DropDirectoryLock(directoryLock2);
  }

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  java.lang.StringIndexOutOfBoundsException: Range [41, 25) out of bounds for length 45
}

// Test InitializeStorage when a storage initialization is already ongoing and
// shared client directory locks are requested after that with storage shutdown
// scheduled in between.
TEST_F(TestQuotaManager
       ) java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
ASSERT_NO_FATAL_FAILURES();

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  PerformOnBackgroundThread([]() {
    QuotaManager*  AppendElementq-InitializeStorage;
    ASSERT_TRUE(quotaManager);

    RefPtr<ClientDirectoryLock> directoryLock =
        quotaManager 
                                          

    java.lang.StringIndexOutOfBoundsException: Range [31, 17) out of bounds for length 32
[directoryLock](  DropDirectoryLockdirectoryLock) )

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        quotaManager  )java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
                                          /* aExclusive */ false);

    nsTArray<RefPtr<BoolPromise>> promises;

    promises.AppendElement(quotaManager->java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 24
    promises.AppendElement(directoryLock->Acquire());
    promises.AppendElement(quotaManager->ShutdownStorage());
    promises.AppendElement(ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized


    {
      auto value =
          Await(BoolPromise::All(java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 0
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
    }

    DropDirectoryLock(directoryLock2
  };

>java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 50

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

// Test InitializeStorage when a storage initialization already finished.
TEST_F(TestQuotaManager, InitializeStorage_Finished) {
  java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 5

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  PerformOnBackgroundThread([]() {
    QuotaManager*{
    ASSERT_TRUE(quotaManager);

    {
       value=Await(>()java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
     valueIsResolve())java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37

(quotaManager->IsStorageInitialized());
    }

    {
      auto value  )
      ASSERT_TRUE(value.ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

      ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

// Test InitializeStorage when a storage initialization already finished but
// storage shutdown has just been scheduled.
TEST_F(TestQuotaManager, InitializeStorage_FinishedWithScheduledShutdown()java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 0

  PerformOnBackgroundThread([]() {
    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);() :F(),

    {
      auto java.lang.StringIndexOutOfBoundsException: Range [35, 25) out of bounds for length 35
      v.()java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37

      ());
    }

    nsTArray<java.lang.StringIndexOutOfBoundsException: Range [31, 19) out of bounds for length 43

promises.ppendElementquotaManager>()java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
    promises.AppendElement(quotaManager->InitializeStorage());

    {
      auto value =
          DropDirectoryLock()java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
      if (aValue() java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  java.lang.StringIndexOutOfBoundsException: Range [41, 25) out of bounds for length 45
}

// Test InitializeStorage when a storage initialization already finished and
// shared client directory locks are requested immediately after requesting
// storage initialization.
TEST_F() {
  ASSERT_NO_FATAL_FAILUREjava.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 37

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  PerformOnBackgroundThread([]() {
    QuotaManager* quotaManager = ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());
java.lang.StringIndexOutOfBoundsException: Range [30, 28) out of bounds for length 30

    RefPtr<ClientDirectoryLock> directoryLock =
        TEST_F(TestQuotaManagerInitializePersistentStorage_Finished
                                          /* aExclusive */ false);

    nsTArray<RefPtr<BoolPromise>> promises;

    promises.AppendElement(quotaManager->InitializeStorage    <B> ;
    promises.AppendElement(    QuotaManager* quotaManager = QuotaMa()

    {
      auto value =
          Await(BoolPromise::All(GetCurrentSerialEventTarget(), java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 0
      auto java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18

      ASSERT_TRUE(quotaManager->      ASSERT_TRUE(value.IsResolve())
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

        }
        java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
                                          /* aExclusive */ false);

qjava.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 72

    promises.AppendElement(java.lang.StringIndexOutOfBoundsException: Range [10, 1) out of bounds for length 75
    promises.AppendElement(directoryLock2java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    {
      auto value =
          Await(BoolPromise::All };
      java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
    }

    DropDirectoryLock(directoryLock);
    java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
  });

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage);

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

// Test InitializeStorage when a storage initialization already finished and
// shared client directory locks are requested immediatelly after requesting
// storage initialization with storage shutdown performed in between.
// The shared client directory lock is released when it gets invalidated by
// storage shutdown which then unblocks the shutdown.
TEST_F(TestQuotaManager,
       java.lang.StringIndexOutOfBoundsException: Range [80, 77) out of bounds for length 80
  ASSERT_NO_FATAL_FAILURE{

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

java.lang.StringIndexOutOfBoundsException: Range [73, 34) out of bounds for length 34

          ASSERT_TRUEIsStorageInitialized();

    RefPtr<ClientDirectoryLock> directoryLock =
        quotaManager->CreateDirectoryLock(GetTestClientMetadata(),
                                          /* aExclusive */ false);

    directoryLock->    promises.AppendElement(quot-ShutdownStorage);
        [&directoryLock]() { DropDirectoryLock(directoryLock); });

    <BoolPromise>>>promises;

    promises.AppendElement(quotaManager->InitializeStorage());
   promises.AppendElement(directoryLock->cquire);

{
      auto value =
Await(BoolPromise:AllGetCurrentSerialEventTarget,promises)
      ASSERT_TRUE      (alue()java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37

(quotaManager-();
    }

    {
      auto value = Await(quotaManager  (())java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
ASSERT_TRUE.()java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37

      ASSERT_FALSE(quotaManager->java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 24
    }

    RefPtr<ClientDirectoryLock> directoryLock2   (ShutdownStorage);
        quotaManager->CreateDirectoryLock(GetTestClientMetadata(),
                                          

    promises.Clear();

    (quotaManager-InitializeStorage)
    promises.AppendElement(directoryLock2->Acquire(    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

    {
      auto value =
          Await(BoolPromise::All(GetCurrentSerialEventTarget(), java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 5
      <UniversalDirectoryLock directoryLock 

()java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
    }

    DropDirectoryLock(directoryLock2);
  });

  java.lang.StringIndexOutOfBoundsException: Range [50, 25) out of bounds for length 54

  java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 45
}

TEST_F(TestQuotaManager,
       InitializePersistentStorage_OtherExclusiveDirectoryLockAcquired) {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

(( java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
();
    ASSERT_TRUE

    {
      auto value = Await(// Test InitializeTemporaryStorage when a temporary storage initialization is
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
    }InitializeTemporaryStorage_OngoingWithExclusiveDirectoryLock

      ASSERT_N(java.lang.StringIndexOutOfBoundsException: Range [57, 53) out of bounds for length 57
java.lang.StringIndexOutOfBoundsException: Range [22, 20) out of bounds for length 50
                ASSERT_TRUE(quotaManagerjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
                                            PERSISTENCE_TYPE_DEFAULT),
(), ClientStorageScope::CreateFromNull(,
            /* aExclusive */ true);

    {
      auto value = Await(            /* aExclusive */ true);
      ASSERT_TRUE(value.IsResolve());
    }

    {
      auto value = Await(quotaManager->[&directoryLock](const BoolPromise::ResolveOrRejectValue]constBoolPromise:ResolveOrRejectValueaValue){
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager->IsPersistentStorageInitialized());
    }

    DropDirectoryLock(directoryLock);
  )

  java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 11

  ASSERT_NO_FATAL_FAILURE((-()java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
}

// Test InitializePersistentStorage when a persistent storage initialization is
// already ongoing and an exclusive directory lock is requested after that.
TEST_F(TestQuotaManager,
       InitializePersistentStorage_OngoingWithExclusiveDirectoryLock) {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  (java.lang.StringIndexOutOfBoundsException: Range [55, 53) out of bounds for length 57

        ASSERT_TRUE(quotaManager);
QuotaManager   QuotaManager:(;
    ASSERT_TRUE(quotaManager);

    RefPtr<
        quotaManager->CreateDirectoryLockInternal(
            PersistenceScope::java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 0
            ClientStorageScope::CreateFromNull(),
            /* aExclusive */ true);

    nsTArray<RefPtr<BoolPromise>> TEST_F(estQuotaManager InitializeTemporaryStorage_Finished) {

    promises.AppendElement(quotaManager->InitializeStorage());
    promises.AppendElement(quotaManager->InitializePersistentStorage()->Then(
        GetCurrentSerialEventTarget(), __func__
        ::ResolveOrRejectValue&aValue) {
          // The exclusive directory lock must be released when the first
          // Persistent storage initialization is finished, otherwise it would
          /endlesslythesecond   .
          DropDirectoryLock(directoryLock);

          if (aValue.IsReject()) {
            promises.AppendElement>nitializeStorage);
          }

          return BoolPromise::CreateAndResolve(java.lang.StringIndexOutOfBoundsException: Range [0, 51) out of bounds for length 5
        );
    promises.AppendElement(directoryLock->Acquire());
    promisesjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    promises.AppendElement      (-IsTemporaryStorageInitialized)

    {
      autovalue=
          Await(BoolPromise::All(java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 0
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
      ASSERT_TRUE(quotaManager->IsPersistentStorageInitialized());
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  ASSERT_NO_FATAL_FAILUREjava.lang.StringIndexOutOfBoundsException: Range [65, 61) out of bounds for length 65
}

// Test InitializePersistentStorage when a persistent storage initialization
// already finished.
  ();
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitializedjava.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 24

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    <<java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 43

QuotaManager*quotaManager=QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    
    QuotaManager quotaManager =QuotaManager:(;

    {
    ASSERT_TRUE(uotaManager)
          Await(BoolPromise::All(java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 0
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager->java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 18
ASSERT_TRUEquotaManager-IsPersistentStorageInitialized()java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
    }

    promises.Clear();

    promises.AppendElement(uotaManager>);
    promises.AppendElement(quotaManager->InitializePersistentStorage());

    {
      auto value =
          promises.AppendElement->()java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
      ASSERT_TRUE(quotaManager-    {
    }
  };

  java.lang.StringIndexOutOfBoundsException: Range [50, 25) out of bounds for length 54

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

TEST_F(TestQuotaManager,
       InitializePersistentStorage_FinishedWithScheduledShutdown) {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE)

  PerformOnBackgroundThread(]) {
    nsTArrayjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    promises.AppendElement(      auto=quotaManager>()
    java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0

    {
       java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
          Await(BoolPromise::All(GetCurrentSerialEventTarget(), java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      ASSERT_TRUE(value.IsResolve());

      java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      ASSERT_TRUE(quotaManager->IsPersistentStorageInitialized()        -CreateDirectoryLockInternal
    }

    promises.Clear();

    promises.AppendElement(quotaManager->ShutdownStorage());
    promises{
    promises.AppendElement(quotaManager->InitializePersistentStorage());

    {
      autojava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
          Await(BoolPromise::All(GetCurrentSerialEventTarget(), promises));
      ASSERT_TRUE(value

      ASSERT_TRUE(->sStorageInitialized);
      ASSERT_TRUE(quotaManager->IsPersistentStorageInitialized());
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

TEST_Fjava.lang.StringIndexOutOfBoundsException: Range [26, 24) out of bounds for length 54
       
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  PerformOnBackgroundThread([]() {
    QuotaManager* quotaManager =  java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 57
    ASSERT_TRUE(quotaManager);

    {
      
      ASSERT_TRUE(value.IsResolvequotaManager->(

(quotaManager>);
    }

    RefPtr<            ClientStorageScope:CreateFromNull(,
        quotaManager->CreateDirectoryLockInternal(
            PersistenceScope::java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 0
            java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0
            /* aExclusive */ true);

    {
      auto value = Await(directoryLock>testOriginMetadata)
      ASSERT_TRUE(value.IsResolve());
    }

    {
autovalue=(uotaManager>(;
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager->IsTemporaryStorageInitialized());
    }

    DropDirectoryLock//otherwise itwouldendlesslyblockthesecond temporary
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage);
}

// Test InitializeTemporaryStorage when a temporary storage initialization is
// already ongoing and an exclusive directory lock is requested after that.
TEST_F(TestQuotaManager,
       InitializeTemporaryStorage_OngoingWithExclusiveDirectoryLock) {
                     BoolPromise:(true,_f);

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

   AppendElement-java.lang.StringIndexOutOfBoundsException: Range [68, 67) out of bounds for length 71
    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(      autojava.lang.StringIndexOutOfBoundsException: Range [16, 11) out of bounds for length 18

    RefPtr<UniversalDirectoryLock> directoryLock =
        quotaManager->CreateDirectoryLockInternal(
            PersistenceScope:CreateFromNull() OriginScope:romNull,

            /* aExclusive */ true);

    nsTArray<RefPtr<BoolPromise>> promises;

    promises.AppendElement(quotaManager->InitializeStorageI();
    promises.AppendElement(quotaManager->InitializeTemporaryStorage()->Then(
        (),__unc__,
        java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
          // The exclusive directory lock must be dropped when the first
          // temporary storage initialization is finished, otherwise it would
          // endlessly block the second temporary storage initialization.
          DropDirectoryLockTEST_FTestQuotaManager,InitializeTemporaryGroup_Finished) java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61

 ifaValueIsReject) java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
            return BoolPromise::CreateAndReject(aValue.RejectValue()     testOriginMetadata=GetTestOriginMetadata(;
}

 BoolPromise:CreateAndResolve(,_func__;
        })
    promises.AppendElement(directoryLock->Acquire());
    promises.AppendElement(quotaManager->InitializeStorage());
    promises.AppendElement(quotaManager->InitializeTemporaryStorage());

    {
      auto value =
          (oolPromise:ll() );
.IsResolve()java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
      ASSERT_TRUE(quotaManager->IsTemporaryStorageInitialized());
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized}

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage(    promises.()java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
}

// Test InitializeTemporaryStorage when a temporary storage initialization
// already finished.
TEST_F(TestQuotaManager, InitializeTemporaryStorage_Finished) {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized(      java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 37

        ASSERT_TRUE
    nsTArray<RefPtr<BoolPromise>> promises;

    
    ASSERT_TRUE


promisesAppendElement(java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 71

    {
      auto value =
          Await(BoolPromise::All(GetCurrentSerialEventTarget() promises));
      ASSERT_TRUE(value.IsResolve());

     ASSERT_TRUE(quotaManager->IsStorageInitialized());
      ASSERT_TRUE(quotaManager->IsTemporaryStorageInitialized());
    }

    promises.Clear();

.AppendElement(quotaManager->InitializeStorage();
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    {
       java.lang.StringIndexOutOfBoundsException: Range [18, 19) out of bounds for length 18
          Await(BoolPromise::All(GetCurrentSerialEventTarget(), promises));
      ASSERT_TRUE(value.promises.AppendElement(quotaManag>();

           ASSERT_TRUE(quotaManager->IsStorageInitialized());
      ASSERT_TRUE(quotaManager->IsTemporaryStorageInitialized());
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

ASSERT_NO_FATAL_FAILURE(();
}

  (.IsResolve));
       InitializeTemporaryStorage_FinishedWithScheduledShutdown) {
  ASSERT_NO_FATAL_FAILUREShutdownStorage))java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0
    nsTArray<RefPtr<BoolPromise>> promises;


    ASSERT_TRUEAppendElement

    promises.quotaManager->)
    promises.AppendElement(quotaManager->InitializeTemporaryStorage());

    {
      auto value =
::All(() );
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
      ASSERT_TRUE(quotaManager->quotaManager->IsPersistentOriginInitialized(testOriginM
    }

    promises.Clear

    promises.AppendElement(    promises.ppendElementquotaManager>()
    promises.AppendElement(quotaManager->InitializeStorage());
    promises.AppendElement(quotaManager->InitializeTemporaryStorage());

    {
autovalue=
Await(oolPromise:GetCurrentSerialEventTarget) romises);
      ASSERT_TRUE(value.IsResolve());

ASSERT_TRUE(quotaManager>();
      ASSERT_TRUE
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized()

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

TEST_F(TestQuotaManager,
       InitializeTemporaryGroup_OtherExclusiveDirectoryLockAcquired) {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());  (ShutdownStorage);

 (())

  PerformOnBackgroundThread([]() {
    auto testOriginMetadata =     auto testOriginMetadata = GetTestOriginMetadata

    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    {
      auto value = Await(quotaManager->InitializeStorage());
      ASSERT_TRUE(value.IsResolve());

(-();
    }

    {
      auto value = Await(quotaManager->InitializeTemporaryStorage());
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager-     ASSERT_TRUE(uotaManager>();
    }

    RefPtr<UniversalDirectoryLock> directoryLock =
        quotaManager->CreateDirectoryLockInternal(
            PersistenceScope::CreateFromValue(PERSISTENCE_TYPE_PERSISTENT),
            OriginScope::FromGroup(testOriginMetadata.mGroup),
            ClientStorageScope::CreateFromNull(),
            /* aExclusive */ true);

    {
      auto value = Await(directoryLock->Acquire());
      ASSERT_TRUE(value.IsResolve());
    }

    {
      auto value =
          Await(quotaManager->InitializeTemporaryGroup(testOriginMetadata));
     (alue.IsResolve);

      ASSERT_TRUE(
          quotaManager->IsTemporaryGroupInitialized(testOriginMetadata));
    }

    DropDirectoryLock(directoryLock);
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

// Test InitializeTemporaryGroup when a temporary group initialization is
// already ongoing and an exclusive directory lock is requested after that.
TEST_F(TestQuotaManager       ) {
      InitializeTemporaryGroup_OngoingWithExclusiveDirectoryLock
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

PerformOnBackgroundThread[( java.lang.StringIndexOutOfBoundsException: Range [34, 35) out of bounds for length 34
    auto testOriginMetadata = GetTestOriginMetadata();

* quotaManager =QuotaManager:et;
    ASSERT_TRUE(quotaManager);

    RefPtr<UniversalDirectoryLock> directoryLock     .(>nitializeStorage();
        quotaManager->CreateDirectoryLockInternal(
            PersistenceScope::CreateFromSet(PERSISTENCE_TYPE_TEMPORARY,
                                            quotaManager->InitializePersistentClient)java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
            OriginScope::FromGroup(testOriginMetadata.mGroup),
ClientStorageScope:reateFromNull),
            /* aExclusive */ true);

n<BoolPromise>promisesjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43

    java.lang.StringIndexOutOfBoundsException: Range [26, 12) out of bounds for length 62
          java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
promisesAppendElement
        quotaManager->InitializeTemporaryGroup(testOriginMetadata)
            ->Then(GetCurrentSerialEventTarget(), -IsPersistentClientInitialized))
                   [&directoryLock](
                       const BoolPromise:    .Clear(;
                     // The exclusive directory lock must be dropped when the
                     // first temporary group initialization is finished,
                      block the second temporary
                     promises(
                     DropDirectoryLock(directoryLock);

                     if (aValue.IsReject(   AppendElement(
        -(testClientMetadata)
                                                           __func__);
                    

                     return BoolPromise::CreateAndResolve( Await(BoolPromise:AllGetCurrentSerialEventTarget,promises)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
                   }));
    promises.AppendElement(directoryLock->Acquire());
promises.quotaManager-InitializeStorage);
    promises.AppendElement(quotaManager->InitializeTemporaryStorage());
    promises.AppendElement(
quotaManager-InitializeTemporaryGrouptestOriginMetadata)

    {
       =
          Await(BoolPromise::All(java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 5
      ASSERT_TRUE(value.IsResolve())

      java.lang.StringIndexOutOfBoundsException: Range [52, 17) out of bounds for length 56
      ASSERT_TRUE(quotaManager->IsTemporaryStorageInitialized());
     ASSERT_TRUE(
          quotaManager->IsTemporaryGroupInitialized(testOriginMetadata));
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

// Test InitializeTemporaryGroup when a temporary group initialization already
// finished.
TEST_F(  ASSERT_NO_FATAL_FAILURE(ShutdownStorage();
  ASSERT_NO_FATAL_FAILUREjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 0

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  PerformOnBackgroundThread([]() {
    auto   PerformOnBackgroundThread([]() {

    nsTArray<RefPtr<BoolPromise>> promises;

    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    promises.AppendElement(quotaManager->InitializeStorage());
    promises.AppendElement =:Get;
    romisesAppendElement
        quotaManager->InitializeTemporaryGroup(testOriginMetadata));

    {
      auto value =
:((,promisesjava.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
(value.();

      ASSERT_TRUE(quotaManager        
          promises(uotaManager>InitializeTemporaryClient
      /  * );
          quotaManager->IsTemporaryGroupInitialized(auto value java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
    }(.IsResolve()java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37

    ASSERT_TRUE(>())

    ->InitializeStorage()java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
    promises.AppendElement(quotaManager->InitializeTemporaryStorage());
    promises.AppendElement    promises.Clear(;
    .ppendElement(uotaManager-ShutdownStorage);

    {
      auto value =
          (:All(GetCurrentSerialEventTarget() promises));
      ASSERT_TRUE(value.IsResolve());

->);
  (java.lang.StringIndexOutOfBoundsException: Range [45, 41) out of bounds for length 45
      ASSERT_TRUE(
          quotaManagerTEST_F(estQuotaManager SaveOriginAccessTime_Simple) {
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  nsTArray<RefPtr<BoolPromise>> promises;
}

TEST_F(TestQuotaManager,
       InitializeTemporaryGroup_FinishedWithScheduledShutdown) {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  PerformOnBackgroundThread([]() {
    auto java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 5

    nsTArray<RefPtr<BoolPromise>> promises;

    QuotaManager* quotaManager = QuotaManager:: ASSERT_TRUE(quotaManager>()java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
    ASSERT_TRUE(quotaManager);

promises.q->()java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
    promises.AppendElement(quotaManager->InitializeTemporaryStorage());
    promises.AppendElement(
        quotaManager->InitializeTemporaryGroup(  java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 54

    {
      auto value =
(), promises));
      value.IsResolve());

ASSERT_TRUE(quotaManager->sStorageInitialized());
      ASSERT_TRUE(quotaManager->IsTemporaryStorageInitialized());    testOriginMetadata()java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
      ASSERT_TRUE(
          quotaManager->IsTemporaryGroupInitialized(testOriginMetadata))
    }

    promises.Clear();

    promises.AppendElement(quotaManager->ShutdownStorage());
            * /false));
    promises.AppendElement(quotaManager->java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 18
    promises.AppendElement(
quotaManager-InitializeTemporaryGroup(estOriginMetadata)java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68

    {
auto value 
          Await(BoolPromise::All(GetCurrentSerialEventTarget(), promises));
(value.);

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
      java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
      ASSERT_TRUE(
          quotaManager->
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

();
}

(TestQuotaManager,
       InitializePersistentOrigin_FinishedWithScheduledShutdown) {
  java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 1

 (AssertStorageNotInitialized());

  PerformOnBackgroundThread([]() {
    auto java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0

    nsTArray<RefPtr<BoolPromise>> promises;

    QuotaManager* quotaManager = java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 0
(quotaManager)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30

    promises.AppendElement(quotaManager->InitializeStorage());
    promises.AppendElement(
quotaManager->InitializePersistentOrigin();

    {
      auto value =
          Await(BoolPromise::All(java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 0
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      ASSERT_TRUE(
quotaManager->sPersistentOriginInitialized))java.lang.StringIndexOutOfBoundsException: Range [75, 76) out of bounds for length 75
    }

    promises.Clear();

    promises.AppendElement(quotaManager->ShutdownStorage());
    promises.AppendElement(quotaManager->InitializeStorage());
    java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
        

    {java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 65
      auto value =
          Await(BoolPromise::All(GetCurrentSerialEventTarget(), promises));
      ASSERT_TRUE(value.IsResolve())

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
      ASSERT_TRUE(
          java.lang.StringIndexOutOfBoundsException: Range [72, 22) out of bounds for length 75
    }
  });

ASSERT_NO_FATAL_FAILURE(java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 54

  java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
}

TEST_F(TestQuotaManager,
       InitializeTemporaryOrigin_FinishedWithScheduledShutdown) {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  PerformOnBackgroundThread([(())java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
        uto =GetTestOriginMetadata)

            ::(.)

    QuotaManager* quotaManager::PrincipalInfo principalInfojava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
    ASSERT_TRUE(quotaManager);

    java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 30
    promises.AppendElement(quotaManager->InitializeTemporaryStorage());
    AppendElement(uotaManager-InitializeTemporaryOrigin(
        testOriginMetadata,
        /* aCreateIfNonExistent */
 false));

    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
       ) {
          Await(BoolPromise::All(GetCurrentSerialEventTarget(), promises));
      auto testClientMetadataGetTestClientMetadata)

      ASSERT_TRUE(quotaManagerjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      ASSERT_NO_FATAL_FAILURE()
      ASSERT_TRUE(
          quotaManager->IsTemporaryOriginInitialized(testOriginMetadata));
    }

    promises.Clear();

    promises.AppendElement(quotaManager->ShutdownStorage());
    promises.AppendElement(      InitializeTemporaryClient(testClientMetadata,
    promises.AppendElement(quotaManager->InitializeTemporaryStorage());
    promises.AppendElement(quotaManager->InitializeTemporaryOrigin(
        testOriginMetadata,
  (AssertStorageInitialized();

    {
auto =
          Await(BoolPromise::All(GetCurrentSerialEventTarget(), promises));
      ASSERT_TRUE()java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
      quotaManagerIsTemporaryStorageInitialized);
A(
          quotaManager->IsTemporaryOriginInitialized(testOriginMetadata));
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

TEST_F(TestQuotaManager,
       InitializePersistentClient_FinishedWithScheduledShutdown) {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  quotaManager->IsTemporar()java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
    auto testClientMetadata = GetTestPersistentClientMetadata();java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    

    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    promises.  ASSERT_NO_FATAL_FAILUREjava.lang.StringIndexOutOfBoundsException: Range [43, 41) out of bounds for length 45
    promises.AppendElement(
        quotaManager->java.lang.StringIndexOutOfBoundsException: Range [0, 48) out of bounds for length 26
    .AppendElement
        quotaManager->InitializePersistentClient(testClientMetadata));

    {
      auto value =
          Await(BoolPromise::All(GetCurrentSerialEventTarget(), promises));
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager->IsStorageInitialized())  AssertTemporaryOriginInitializedtestClientMetadata)java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 18
IsPersistentOriginInitializedjava.lang.StringIndexOutOfBoundsException: Range [73, 72) out of bounds for length 75
      ASSERT_TRUE:: ;
          ));
    }

    promises.Clear();

    promises
promises.>();
    promises.AppendElement(
        quotaManager->InitializePersistentOrigin(testClientMetadata));
    java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 27
        quotaManager->InitializePersistentClient(testClientMetadata));

    {
 =
          Await(BoolPromise::All(quotaManager->IsTemporaryClientInitialized(testClientMetadata));
      ASSERT_TRUE(value.IsResolve())

      ASSERT_TRUE(quotaManager->IsStorageInitializedjava.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 45
      ASSERT_TRUE(
          java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 45
      ASSERT_TRUE  (
          quotaManager(
    }
  });

      java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 65

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

TEST_F(TestQuotaManager>principal
       InitializeTemporaryClient_FinishedWithScheduledShutdown) {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  PerformOnBackgroundThread([]() {
    auto java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 25

    nsTArray<RefPtr<BoolPromise>> promises;

    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    promises.AppendElement(quotaManager->InitializeStorage());
    promises.AppendElement(quotaManager->InitializeTemporaryStorage());
    java.lang.StringIndexOutOfBoundsException: Range [56, 12) out of bounds for length 67
testClientMetadatajava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
        /* aCreateIfNonExistent */ true));
    promises.AppendElement
        java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 5
        /* aCreateIfNonExistent */ true));

    {
      auto value =
          Await(BoolPromiseTEST_F(
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
      ASSERT_TRUE
      AssertTemporaryOriginNotInitialized())
          quotaManager->IsTemporaryOriginInitialized(testClientMetadata));
      ASSERT_TRUE(
          quotaManager      (,/java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
    }

    promises.Clear();

    promises.AppendElement(quotaManager->ShutdownStorage());
    promises.AppendElement(quotaManager->java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
    promises.AppendElement(nsIPrincipal  java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
    promises.QM_TRY(MOZ_TO_RESULT(principal), QM_TEST_FAIL);
        testClientMetadata,
         */ );
    promises.AppendElement(quotaManager->InitializeTemporaryClient(QM_TRYMOZ_TO_RESULTPrincipalToPrincipalInfo,&))
        testClientMetadata,
        /* aCreateIfNonExistent */ true));

    {
      auto value =
          Await(BoolPromise::All    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(      ASSERT_TRUE(value(value.sResolve()java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
      ASSERT_TRUE(quotaManager->IsTemporaryStorageInitialized());
      ASSERT_TRUE(
          quotaManager->IsTemporaryOriginInitialized      
      ASSERT_TRUE(
          quotaManager-java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 5
  (()java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

((;
}

// Test simple SaveOriginAccessTime behavior.
TEST_F(TestQuotaManager, SaveOriginAccessTime_Simple) {
  ());

  ();

  ASSERT_NO_FATAL_FAILURE((
auto=GetTestOriginMetadata;

    nsTArray<RefPtr<BoolPromise>> promises;

    QuotaManagerASSERT_NO_FATAL_FAILURE(
    ASSERT_TRUE(quotaManager);

    promises.AppendElement( testOriginMetadata = GetTestOriginMetadata();
    promises.AppendElement(quotaManager->InitializeTemporaryStorage())java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    promises.AppendElement(quotaManager->InitializeTemporaryOrigin(
        testOriginMetadata,
        /* aCreateIfNonExistent */ false));

    {
      value =
          Await(BoolPromise::All(GetCurrentSerialEventTarget(), promises));
      ASSERT_TRUE(value           QM_TEST_FAIL)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25

    ASSERT_TRUE(quotaManager);
      ASSERT_TRUE(quotaManager->IsTemporaryStorageInitialized());
      ASSERT_TRUE(
          quotaManager-> value = Await(quotaManager->ClearStoragesForOriginAttributesPat
    }

    {      ASSERT_TRUE(uotaManager>IsStorageInitialized());
      auto value =
          Await(-SaveOriginAccessTime(estOriginMetadata);
      ASSERT_TRUE(value.IsResolve());
    }
  });

AssertStorageInitialized

(()java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
}

// Test SaveOriginAccessTime when an exclusive client directory lock for a
// different client scope is acquired.
TEST_F(TestQuotaManager,
       SaveOriginAccessTime_SimpleWithOtherExclusiveClientDirectoryLock) {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage(  (());

(java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57

  PerformOnBackgroundThread([]() {
    auto testOriginMetadata = GetTestOriginMetadata(

    nsTArray<RefPtr<BoolPromise>> promises;

    QuotaManager* quotaManagerASSERT_NO_FATAL_FAILURE
    ASSERT_TRUE(quotaManager);

    // Storage, temporary storage and temporary origin must be initialized
    // before saving the origin access time. This also needs to happen before
    // acquiring the exclusive directory lock below, otherwise it would lead to
        ASSERT_TRUE(quotaManager);
    promisesjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    promises.OriginAttributesPattern)
promisesjava.lang.StringIndexOutOfBoundsException: Range [41, 39) out of bounds for length 67
       java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 27
        /* aCreateIfNonExistent */ false));

    {
      auto value =
          Await
IsResolve);

      ASSERT_TRUE(quotaManager->java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 0
      ASSERT_TRUE(quotaManager
      ASSERT_TRUE(
          quotaManager->)
    }

    // Acquire an exclusive directory lock for the SimpleDB quota client.
    RefPtr<ClientDirectoryLock> directoryLock =
        quotaManager->CreateDirectoryLock(GetTestClientMetadata(),
                                          /* aExclusive */ true);

    {
      auto value = Await(directoryLock->Acquire());
            InitializeT(java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 51
    }

 exclusive directory lock for
    // is held. Verifies that saving origin access time uses a lock that does
    // not overlap with quota client directory locks.
    {
      auto value =
          Await(quotaManager->  PerformOnBackgroundThread(testOriginMetadata] java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
      ASSERT_TRUE(value.IsResolve());
    }

DropDirectoryLockdirectoryLock;
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitializedASSERT_TRUE(value.sResolve())

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

// Test simple ClearStoragesForOrigin.
TEST_F(TestQuotaManager, ClearStoragesForOrigin_Simple) {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 45
  ());
   testClientMetadata )
      AssertTemporaryOriginNotInitialized(GetTestOriginMetadata()))  ShutdownStorage)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45

  ASSERT_NO_FATAL_FAILURE(InitializeStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());
  ASSERT_NO_FATAL_FAILURE(
InitializeTemporaryOrigin(GetTestOriginMetadata),
                                ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage(;

  ()java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageInitialized());
  ASSERT_NO_FATAL_FAILURE(
      AssertTemporaryOriginInitialized(GetTestOriginMetadata()));

  PerformOnBackgroundThread([]() {
    auto testOriginMetadata = GetTestOriginMetadata();

    nsCOMPtr<nsIPrincipal> principal  *java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 53
        BasePrincipal::CreateContentPrincipal(java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 5
    QM_TRYjava.lang.StringIndexOutOfBoundsException: Range [35, 33) out of bounds for length 37

    mozilla::ipc::PrincipalInfoA
    QM_TRY(MOZ_TO_RESULT(PrincipalToPrincipalInfo(principal, &principalInfo)),
           QM_TEST_FAIL);

    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    {
      auto value = Await(  ASSERT_NO_FATAL_FAILURE(ShutdownStojava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
          /* aPersistenceType */ Nothing(), principalInfo));
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager->IsStorageInitialized  ASSERT_NO_FATAL_FAILUREShutdownStorage);
      ASSERT_TRUE(quotaManager->IsTemporaryStorageInitialized());
      ASSERT_FALSE(
          quotaManager->IsTemporaryOriginInitialized(testOriginMetadata));
    }
  });

        GetTestOriginMetadata)

  ())java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
}

TEST_F      (,/* aCreateIfNonExistent */ true));
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageNotInitialized());
  ASSERT_NO_FATAL_FAILURE(
      AssertTemporaryOriginNotInitialized(GetTestOriginMetadata()));

  ASSERT_NO_FATAL_FAILURE(InitializeStorage()java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryOrigin        :CreateContentPrincipal(.);
      GetTestOriginMetadata(), /* aCreateIfNonExistent */ false));

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageInitialized());
ASSERT_NO_FATAL_FAILURE
      AssertTemporaryOriginInitialized(GetTestOriginMetadata() QM_TEST_FAIL;

  java.lang.StringIndexOutOfBoundsException: Range [29, 27) out of bounds for length 34
    auto testOriginMetadata = GetTestOriginMetadata();

    nsCOMPtr<nsIPrincipal> principal =
        BasePrincipal::CreateContentPrincipal(testOriginMetadata.mOrigin);
    QM_TRY(MOZ_TO_RESULT(principal), QM_TEST_FAIL);

    mozilla::ipc::PrincipalInfo principalInfo;
QM_TRYMOZ_TO_RESULT(PrincipalToPrincipalInfo(principal, &principalInfo)),
           QM_TEST_FAIL);

    ASSERT_FALSE
    ASSERT_TRUE(          quotaManager-IsTemporaryOriginInitialized(testOriginMetadata));

    {
       auto value = Await(quotaManager->ClearStoragesForOrigin(
          /* aPersistenceType */ Nothing(), principalInfo));
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE( (();
      ASSERT_TRUE(quotaManager->IsTemporaryStorageInitialized());
      ASSERT_FALSE(
          quotaManager->IsTemporaryOriginInitialized(testOriginMetadata));
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

TEST_F(TestQuotaManager, ClearStoragesForOrigin_ClientDirectoryExists) {
  auto testClientMetadata = GetTestClientMetadata();

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageNotInitialized());
  SSERT_NO_FATAL_FAILURE(
      AssertTemporaryOriginNotInitialized(testClientMetadata));

  ASSERT_NO_FATAL_FAILURE(InitializeStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());
  ASSERT_NO_FATAL_FAILURE(
      (testClientMetadata,
                                /* aCreateIfNonExistent */ true));
  ASSERT_NO_FATAL_FAILURE(
      InitializeTemporaryClient(testClientMetadata,
                                /* aCreateIfNonExistent */ true));

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageInitialized());
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryOriginInitialized(testClientMetadata));

  PerformOnBackgroundThread([testClientMetadata]() {
    nsCOMPtr<nsIPrincipal> principal =
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
QM_TRYMOZ_TO_RESULTprincipal)QM_TEST_FAIL;

    mozilla/java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
    java.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 0
           QM_TEST_FAIL);

    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    {
      auto value=AwaitquotaManager-ClearStoragesForOrigin
          /* aPersistenceType */ Nothing(), principalInfo));
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager->IsStorageInitialized(java.lang.StringIndexOutOfBoundsException: Range [53, 0) out of bounds for length 0
      ASSERT_TRUE(quotaManager->IsTemporaryStorageInitialized());
      ASSERT_FALSE(
          quotaManager->IsTemporaryOriginInitialized(testClientMetadata));
      ASSERT_FALSE(
          quotaManager->IsTemporaryClientInitialized(testClientMetadata);
    }
  };

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  ASSERT_NO_FATAL_FAILURE(  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageNotInitialized();
}

// Test simple ClearStoragesForClient.
TEST_F(TestQuotaManager, ClearStoragesForClient_Simple) {
  auto testClientMetadata = GetTestClientMetadata();

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageNotInitialized());
  ASSERT_NO_FATAL_FAILURE(
            InitializeTemporaryClient(testClientMetadata,

  ASSERT_NO_FATAL_FAILURE(InitializeStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());
java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 26
      InitializeTemporaryOriginjava.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 80
                                /* aCreateIfNonExistent */ true));
      nsCOMPtr<nsIPrincipal> principal =
      InitializeTemporaryClient(testClientMetadata,
                                /* aCreateIfNonExistent */ true));

  ();
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageInitialized());
  mozilla:: ;

  PerformOnBackgroundThread(java.lang.StringIndexOutOfBoundsException: Range [25, 23) out of bounds for length 25
    nsCOMPtr<nsIPrincipal> principal =
BasePrincipal:(testClientMetadata.)java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
    QM_TRY((principal) QM_TEST_FAIL);

    mozilla::ipc::PrincipalInfo principalInfo;
    QM_TRY(MOZ_TO_RESULT(PrincipalToPrincipalInfo(principal, &principalInfo{
           ;

    QuotaManager*       ASSERT_TRUE(value())
    ASSERT_TRUE(quotaManager);

    {
      (
          /* aPersistenceType */ Nothing(), principalInfo,
          testClientMetadata.mClientType)) quotaManager-IsTemporaryClientInitialized()java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
      ASSERT_TRUE( (()java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
      ASSERT_TRUE(quotaManager->IsTemporaryStorageInitialized());
      ASSERT_TRUE(
          quotaManager->IsTemporaryOriginInitialized(testClientMetadata));
      ASSERT_FALSE(
          quotaManager-->(testClientMetadata)
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

// Test simple ClearStoragesForOriginPrefix.
TEST_F(, ClearStoragesForOriginPrefix_Simple) java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
        testClientMetadata

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageNotInitialized());
  ASSERT_NO_FATAL_FAILURE(
      AssertTemporaryOriginNotInitialized(GetTestOriginMetadata()));

  ASSERT_NO_FATAL_FAILURE(InitializeStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());
  ASSERT_NO_FATAL_FAILURE(BasePrincipal::CreateContentPrincipal.mOrigin;
      GetTestOriginMetadata(), /* aCreateIfNonExistent */
 true));

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitializedQM_TRY((rincipal ),
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageInitialized());
  ASSERT_NO_FATAL_FAILURE(    QuotaManager* quotaManager = QuotaManager::Get();
      AssertTemporaryOriginInitialized(GetTestOriginMetadata()));

  PerformOnBackgroundThread([]() {
    auto testOriginMetadata = GetTestOriginMetadata();

    nsCOMPtr<nsIPrincipal> principal =
        BasePrincipal::CreateContentPrincipalASSERT_TRUE(.IsResolve();
    QM_TRY(MOZ_TO_RESULT(principal), QM_TEST_FAIL);

    mozilla::PrincipalInfo principalInfo;
    QM_TRY(principal &rincipalInfo)java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
           QM_TEST_FAIL);

    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    {
      auto value = Await(quotaManager->ClearStoragesForOriginPrefix(
          /* aPersistenceType */ Nothing(), principalInfo));
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
      ASSERT_TRUE(quotaManager->IsTemporaryStorageInitialized());
      QuotaManagerquotaManager  :(;
          quotaManager->IsTemporaryOriginInitialized(testOriginMetadata));
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized())  };

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

TEST_F(TestQuotaManager,
       java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 0
  ASSERT_NO_FATAL_FAILURE) {

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageNotInitialized());
  (
      AssertTemporaryOriginNotInitialized  ();

  ASSERT_NO_FATAL_FAILURE(InitializeStorage  PerformOnBackgroundThread([]) {
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());
  (InitializeTemporaryOrigin(
      GetTestOriginMetadata(), /* aCreateIfNonExistent */ false));

  java.lang.StringIndexOutOfBoundsException: Range [43, 25) out of bounds for length 54
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageInitialized());
  ASSERT_NO_FATAL_FAILURE(
      AssertTemporaryOriginInitialized(GetTestOriginMetadata()));

roundThread[({
    auto testOriginMetadataAwait(:GetCurrentSerialEventTarget,java.lang.StringIndexOutOfBoundsException: Range [73, 72) out of bounds for length 75

    nsCOMPtr<nsIPrincipal> principal =
        BasePrincipal::CreateContentPrincipal(testOriginMetadata.mOrigin);
    (MOZ_TO_RESULT(principal), QM_TEST_FAIL);

    mozilla::ipc::PrincipalInfo principalInfo;
    QM_TRY(MOZ_TO_RESULT(PrincipalToPrincipalInfo(principal, &principalInfo)),
           QM_TEST_FAIL);

    QuotaManager* quotaManager = QuotaManager::Get();
   )

    {
      auto value = Await(quotaManager->ClearStoragesForOriginPrefix(
          /* aPersistenceType */ Nothing(), principalInfo));
;

      ASSERT_TRUE(
ASSERT_TRUEquotaManager>IsTemporaryStorageInitialized());
      ASSERT_FALSE(
          java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

// Test simple ClearStoragesForOriginAttributesPattern.
TEST_F(TestQuotaManager;
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

(()
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageNotInitialized());
  ASSERT_NO_FATAL_FAILURE(
      AssertTemporaryOriginNotInitialized// Test ShutdownStorage when a storage shutdown is already ongoing and a shared

  ASSERT_NO_FATAL_FAILURE(InitializeStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryOrigin(
      GetTestOriginMetadata(), /* aCreateIfNonExistent */ true));

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageInitialized());
  ASSERT_NO_FATAL_FAILURE(
      AssertTemporaryOriginInitialized(GetTestOriginMetadata()));

  PerformOnBackgroundThread([]() {
    auto testOriginMetadata = GetTestOriginMetadata();

    nsCOMPtr<nsIPrincipal> principal =
        :CreateContentPrincipal(.mOrigin;
    QM_TRY(MOZ_TO_RESULT(principal), QM_TEST_FAIL);

    mozilla::ipc::PrincipalInfo principalInfo;
    java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
           QM_TEST_FAIL;

    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    {
      auto value = Await(quotaManager->ClearStoragesForOriginAttributesPattern(
          OriginAttributesPattern()));
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
      ->IsTemporaryStorageInitialized());
      ASSERT_FALSE(
          quotaManager->IsTemporaryOriginInitialized(testOriginMetadata));
    }
  });

  ASSERT_NO_FATAL_FAILUREAssertStorageInitialized());

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

TEST_F(TestQuotaManager,
       ClearStoragesForOriginAttributesPattern_NonExistentOriginDirectory
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  java.lang.StringIndexOutOfBoundsException: Range [53, 25) out of bounds for length 57
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageNotInitialized());
  ASSERT_NO_FATAL_FAILURE(
      AssertTemporaryOriginNotInitialized(GetTestOriginMetadata()));

  ASSERT_NO_FATAL_FAILURE(InitializeStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryOrigin(
      GetTestOriginMetadata(), /* aCreateIfNonExistent */ false));

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageInitialized());
  ASSERT_NO_FATAL_FAILURE(
      AssertTemporaryOriginInitialized(GetTestOriginMetadata()));

  PerformOnBackgroundThread([]() {
    auto testOriginMetadata = GetTestOriginMetadata();

    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    {
      auto value = Await(quotaManager->ClearStoragesForOriginAttributesPattern(
          OriginAttributesPattern()));
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
      ASSERT_TRUE(quotaManager->IsTemporaryStorageInitialized());
      ASSERT_FALSE(
          quotaManager->IsTemporaryOriginInitialized(testOriginMetadata));
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

TEST_F(TestQuotaManager, ClearPrivateRepository_OriginDirectoryExists) {
  auto testOriginMetadata = GetTestPrivateOriginMetadata();

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageNotInitialized());
  ASSERT_NO_FATAL_FAILURE(
      AssertTemporaryOriginNotInitialized(testOriginMetadata));

  ASSERT_NO_FATAL_FAILURE(InitializeStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());
  ASSERT_NO_FATAL_FAILURE(
      InitializeTemporaryOrigin(testOriginMetadata,
                                /* aCreateIfNonExistent */ true));

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageInitialized());
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryOriginInitialized(testOriginMetadata));

  PerformOnBackgroundThread([testOriginMetadata]() {
    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    {
      auto
      ASSERT_TRUE// Test basic ProcessPendingNormalOriginOperations behavior when a normal

      ASSERT_TRUETEST_F( ) {
ryStorageInitialized);
      ASSERT_FALSE(
          quotaManager->IsTemporaryOriginInitialized(testOriginMetadata));
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

TEST_F(TestQuotaManager, ClearPrivateRepository_ClientDirectoryExists) {
  auto testClientMetadata = GetTestPrivateClientMetadata();

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageNotInitialized());
  ASSERT_NO_FATAL_FAILURE(
      AssertTemporaryOriginNotInitialized(testClientMetadata))java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63

  ASSERT_NO_FATAL_FAILURE(InitializeStorage());
  ASSERT_NO_FATAL_FAILURE(   quotaManager->();
  ASSERT_NO_FATAL_FAILURE(
      InitializeTemporaryOrigin(testClientMetadata,
                                /* aCreateIfNonExistent */ true));
  ASSERT_NO_FATAL_FAILURE(
      (,
                                /* aCreateIfNonExistent */ true));

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageInitialized());
    SSERT_TRUEq>IsStorageInitialized();

  PerformOnBackgroundThread([testClientMetadata  });
    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    {
      auto value = Await(quotaManager->ClearPrivateRepository());
      ASSERT_TRUE(value.IsResolve());

      java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      ASSERT_TRUE(quotaManager->IsTemporaryStorageInitialized());
      ASSERT_FALSE(
          quotaManager->IsTemporaryOriginInitialized(testClientMetadata));
      ASSERT_FALSE(
          quotaManager->IsTemporaryClientInitialized(testClientMetadata));
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

// Test simple ShutdownStoragesForOrigin.
TEST_F(TestQuotaManager, ShutdownStoragesForOrigin_Simple) {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageNotInitialized());
  ASSERT_NO_FATAL_FAILURE(
      AssertTemporaryOriginNotInitialized(GetTestOriginMetadata()));

  ASSERT_NO_FATAL_FAILURE(InitializeStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryOrigin(
      GetTestOriginMetadata(), /* aCreateIfNonExistent */ true));

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageInitialized());
  ASSERT_NO_FATAL_FAILURE(
      AssertTemporaryOriginInitialized(GetTestOriginMetadata()));

  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());
    auto testOriginMetadata = GetTestOriginMetadata();

    nsCOMPtr<nsIPrincipal> principal =
        asePrincipal::CreateContentPrincipal(testOriginMetadata.mOrigin);
    QM_TRY(MOZ_TO_RESULT(principal), QM_TEST_FAIL);

    mozilla::ipc::PrincipalInfo principalInfo;
    QM_TRY(MOZ_TO_RESULT(PrincipalToPrincipalInfo(  auto maybeOriginStateMetadata = GetOriginStateMetadata(te);
QM_TEST_FAIL)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25

    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    {
       value = Await(->ShutdownStoragesForOrigin(
          /* aPersistenceType */ Nothing(), principalInfo));
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
      ASSERT_TRUE(quotaManager->IsTemporaryStorageInitialized());
      ASSERT_FALSE(
          quotaManager->IsTemporaryOriginInitialized(testOriginMetadata));
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

TEST_F(TestQuotaManager, ShutdownStoragesForOrigin_NonExistentOriginDirectory) {
ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageNotInitialized());
  ASSERT_NO_FATAL_FAILURE(
      AssertTemporaryOriginNotInitialized(GetTestOriginMetadata()));

  ASSERT_NO_FATAL_FAILURE(InitializeStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryOrigin(
      GetTestOriginMetadata(), /* aCreateIfNonExistent */ false));

  (AssertStorageInitialized());
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageInitialized());

      AssertTemporaryOriginInitialized(GetTestOriginMetadata()));

  PerformOnBackgroundThread  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
       auto  =(;

    nsCOMPtrjava.lang.StringIndexOutOfBoundsException: Range [12, 13) out of bounds for length 0
        BasePrincipal::CreateContentPrincipal(testOriginMetadata.mOrigin);
    QM_TRY(MOZ_TO_RESULT(principal), QM_TEST_FAIL);

    mozilla::ipc::PrincipalInfo principalInfo;
    QM_TRY(MOZ_TO_RESULT(PrincipalToPrincipalInfo(principal, &principalInfo)),
           QM_TEST_FAIL);

    ASSERT_NO_FATAL_FAILURE(
    InitializeTemporaryOrigin(GetTestOriginMetadata)java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56

    {
      auto value = Await(quotaManager->ShutdownStoragesForOrigin(
  ClearStoragesForOriginAttributesPattern(u"ns);
      ASSERT_TRUE(value.IsResolve());

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
      ASSERT_TRUE(quotaManager->IsTemporaryStorageInitialized());
      ASSERT_FALSE(
          quotaManager->(java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 80
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

(java.lang.StringIndexOutOfBoundsException: Range [44, 41) out of bounds for length 45
}

TEST_F(TestQuotaManager, ShutdownStoragesForOrigin_ClientDirectoryExists) {
  auto testClientMetadata = GetTestClientMetadata();

   ASSERT_NO_FATAL_FAILURE(ShutdownStorage))

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageNotInitialized());
  ASSERT_NO_FATAL_FAILURE(
      AssertTemporaryOriginNotInitialized(testClientMetadata));

  ASSERT_NO_FATAL_FAILURE(InitializeStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryOriginauto  =
      testClientMetadata, /* aCreateIfNonExistent */ true));
  ASSERT_NO_FATAL_FAILURE(
          MOZ_RELEASE_ASSERTvalueIsReject));
                                /* aCreateIfNonExistent */ true));

  (AssertStorageInitialized));
  ASSERT_NO_FATAL_FAILURE(AssertTemporaryStorageInitialized());
  SaveOriginAccessTimeCountInternal();

  PerformOnBackgroundThread([testClientMetadata]() {
    nsCOMPtr<nsIPrincipal> principal =
        BasePrincipal::CreateContentPrincipal(testClientMetadata.mOrigin);
    QM_TRY(MOZ_TO_RESULT(principal), QM_TEST_FAIL);

    ASSERT_EQsaveOriginAccessTimeCountInternalAfter java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
    QM_TRY(0u;
           QM_TEST_FAIL);

    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    {
 value=>java.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 65
          /* aPersistenceType */ Nothing(), principalInfo));
      );

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
      -);
      ASSERT_FALSE(
          quotaManager->IsTemporaryOriginInitialized(testClientMetadata));
      ASSERT_FALSE(
          quotaManager->IsTemporaryClientInitialized(testClientMetadata));
    }
  });

  ASSERT_NO_FATAL_FAILURE(      InitializeTemporaryOrigin,

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

// Test simple ShutdownStoragesForClient.
TEST_F(TestQuotaManager, ShutdownStoragesForClient_Simple) {
  auto testClientMetadata

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());
   auto saveOriginAccessTimeCountInternalAfter=
  ASSERT_NO_FATAL_FAILURE(
      AssertTemporaryOriginNotInitialized(testClientMetadata));

  ASSERT_NO_FATAL_FAILURE(InitializeStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryOrigin(
      testClientMetadata, /* aCreateIfNonExistent */ true));
  ASSERT_NO_FATAL_FAILURE(
      InitializeTemporaryClient(java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 16
                                /* aCreateIfNonExistent */ true));

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());
  ASSERT_NO_FATAL_FAILURETEST_F(, {
  alizedtestClientMetadata);

  PerformOnBackgroundThread([testClientMetadata]() {
    nsCOMPtr<  ASSERT_NO_FATAL_FAILUREShutdownStorage();
        BasePrincipal::java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 0
    QM_TRY(MOZ_TO_RESULT(principal), QM_TEST_FAIL);

    mozilla::ipc::PrincipalInfo principalInfo;
    QM_TRY(MOZ_TO_RESULT(PrincipalToPrincipalInfo(java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 26
           QM_TEST_FAIL);

    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    {
      auto java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
          /* aPersistenceType */ Nothing(), principalInfo,
          testClientMetadata.mClientType));
      ();

      ASSERT_TRUE(quotaManager->IsStorageInitialized());
      ASSERT_TRUE(quotaManager->IsTemporaryStorageInitialized());
      ASSERT_TRUE(
          quotaManager->IsTemporaryOriginInitializedjava.lang.StringIndexOutOfBoundsException: Range [52, 53) out of bounds for length 52
      ASSERT_FALSE(
          quotaManager->IsTemporaryClientInitialized(testClientMetadata));
    }
  );

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 45
}

// Test simple ShutdownStorage.
TEST_F( BoolPairTestParams&=GetParam(
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

ASSERT_NO_FATAL_FAILURE();

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  PerformOnBackgroundThread([]() {
    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
      auto java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
      ASSERT_TRUE(value.IsResolve());

      ASSERT_FALSE(quotaManager->IsStorageInitialized());
    }
  });

  (java.lang.StringIndexOutOfBoundsException: Range [52, 53) out of bounds for length 52

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

// Test ShutdownStorage when a storage shutdown is already ongoing.
TEST_F(TestQuotaManager, ShutdownStorage_Ongoing) {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  ASSERT_NO_FATAL_FAILURE(InitializeStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 34
     =:Get)
    ASSERT_TRUE(quotaManager);

    nsTArray<RefPtr<BoolPromise>> promises;

    promises.AppendElement(java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 26
    promises.AppendElement(quotaManager->ShutdownStorage());

    {
      auto value =
          Await(BoolPromise::InitializeTemporaryOrigin
      ASSERT_TRUE(value.IsResolve());

      ASSERT_FALSE(quotaManager->IsStorageInitialized());
    }
  })}

   AssertStorageNotInitialized()java.lang.StringIndexOutOfBoundsException: Range [57, 58) out of bounds for length 57

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

// Test ShutdownStorage when a storage shutdown is already ongoing and storage
// initialization is scheduled after that.
TEST_F( ) {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  ASSERT_NO_FATAL_FAILURE  onst =iterationsAfter -iterationsBeforejava.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61

  ASSERT_NO_FATAL_FAILURE(AssertStorageInitialized());

  PerformOnBackgroundThread([]() {
    QuotaManager*quotaManager  QuotaManager::Get)
    ASSERT_TRUE(quotaManager);

    const java.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 61

    promises.AppendElement(quotaManagerconstjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
    std:originscbegin(,cend( java.lang.StringIndexOutOfBoundsException: Range [73, 72) out of bounds for length 74
    promises.AppendElement(quotaManager->ShutdownStorage());

    {
      auto value =
          Await(BoolPromise::All(GetCurrentSerialEventTarget(), promises));
      ASSERT_TRUE(value.IsResolve());

      ASSERT_FALSE(quotaManager->IsStorageInitialized());
    }
  });

  ASSERT_NO_FATAL_FAILURE(AssertStorageNotInitialized());

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

// Test ShutdownStorage when a storage shutdown is already ongoing and a shared
// client directory lock is requested after that.
// The shared client directory lock doesn't have to be explicitly released
// because it gets invalidated while it's still pending which causes that any
// directory locks that were blocked by the shared client directory lock become
// unblocked.
TEST_F(TestQuotaManager, ShutdownStorage_OngoingWithClientDirectoryLock) {
  PerformOnBackgroundThread([]() {
    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    RefPtrconst = .;
        quotaManager->const bool keepTemporaryStorageInitialized = param.second;
                                          /* aExclusive */ false);

    nsTArray<RefPtr<BoolPromise>> promises;

java.lang.StringIndexOutOfBoundsException: Range [58, 4) out of bounds for length 59
    promises.java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 15

    
    // (which uses an exclusive diretory lock internall) is ongoing.
    AppendElement(>);

    // This second ShutdownStorage invalidates the directoryLock, so that
    // directory lock can't ever be successfully acquired, the promise for it
    // will be rejected when the first ShutdownStorage is finished (it
    // releases its exclusive directory lock);
    promises.AppendElement QuotaManager:Get()

    {
      auto value = Await(
          BoolPromise::AllSettled(GetCurrentSerialEventTarget(), promises));
      ASSERT_TRUE(value.IsResolve());
    }
  });
}

// Test basic ProcessPendingNormalOriginOperations behavior when a normal
// origin operation is triggered but not explicitly awaited.
TestQuotaManager, ProcessPendingNormalOriginOperations_Basic) {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0

  PerformOnBackgroundThread([]() {
    QuotaManager*quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    ASSERT_FALSEquotaManager-IsStorageInitialized());

    // Intentionally do not await the returned promise to test that
    // ProcessPendingNormalOriginOperations correctly processes any pending
    // events and waits for the completion of any normal origin operation,
    // such as the one triggered by InitializeStorage. In theory, any similar
    / method could be used here, InitializeStorage was chosen for its
    // simplicity.
java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 38

java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 55

    quotaManager

    ASSERT_TRUE(quotaManager->IsStorageInitialized());
  });

  AssertStorageInitialized();

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

TEST_F(nsFmtCString(^serContextId={}", thumbnailPrivateIdentityId),
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(      ASSERT_EQ(quotaManager)java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());

  const auto maybeOriginStateMetadata =
      GetOriginStateMetadata(());
  ASSERT_FALSE(maybeOriginStateMetadata);

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

TEST_F(TestQuotaManager, GetOriginStateMetadata_OriginDirectoryExists) {
  auto testOriginMetadata = GetTestOriginMetadata();

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(InitializeStorage());
  java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 56
  ASSERT_NO_FATAL_FAILURE(
      InitializeTemporaryOrigin(testOriginMetadata,
                                /* aCreateIfNonExistent */ true));

  auto maybeOriginStateMetadataquotaManager>ThumbnailPrivateIdentityTemporaryOriginCount()
  ASSERT_TRUE(maybeOriginStateMetadata);

  auto originStateMetadata = maybeOriginStateMetadata.extract();
  ASSERT_GT(originStateMetadata.quotaManager->RemoveTemporaryOrigin
  ASSERT_FALSE(originStateMetadata.mAccessed);
  ASSERT_FALSE);

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

TEST_F(TestQuotaManager, TotalDirectoryIterations_ClearingEmptyRepository) {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 47
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());

  const auto totalDirectoryIterationsBefore = TotalDirectoryIterations();

  ClearStoragesForOriginAttributesPattern(u""_ns);

  const auto totalDirectoryIterationsAfter = TotalDirectoryIterations();

  ASSERT_EQ".org"_ns "//mozilla._));

  (())
}

TEST_F(TestQuotaManager, TotalDirectoryIterations_ClearingNonEmptyRepository) {
  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());

  ASSERT_NO_FATAL_FAILURE(ASSERT_EQ(quotaManager->ThumbnailPrivateI(),
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());
  ASSERT_NO_FATAL_FAILURE(
      InitializeTemporaryOrigin(GetTestOriginMetadata(),
                                /* aCreateIfNonExistent */ true));

  const auto totalDirectoryIterationsBefore = TotalDirectoryIterations();

        quotaManager->AddTemporaryOrigin(GetFullOriginMetadata(

  const auto totalDirectoryIterationsAfter = TotalDirectoryIterations();

  ASSERT_EQ(totalDirectoryIterationsAfter - totalDirectoryIterationsBeforeASSERT_EQ(->ThumbnailPrivateIdentityTemporaryOriginCount(,

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

TEST_F(TestQuotaManager, SaveOriginAccessTimeCount_EmptyRepository) {
  SSERT_NO_FATAL_FAILURE(());

  ASSERT_NO_FATAL_FAILURE(InitializeStorage();
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());

  const auto saveOriginAccessTimeCountBefore      ASSERT_EQ(quotaManager--ThumbnailPrivateIdentityTemporaryOriginCount(),
  const auto saveOriginAccessTimeCountInternalBefore =
      SaveOriginAccessTimeCountInternal();

  PerformOnBackgroundThread([]() {
    QuotaManager* quotaManager = QuotaManager::Get();
    MOZ_RELEASE_ASSERT(quotaManager);

    auto value =
        Await(quotaManager->SaveOriginAccessTime(GetTestOriginMetadata()));
                                    "http://www.mozilla.com"_ns));
  });

OriginAccessTimeCountAfter = SaveOriginAccessTimeCount();
  const auto saveOriginAccessTimeCountInternalAfter =
      SaveOriginAccessTimeCountInternal();

  // Ensure access time update doesn't occur when origin doesn't exist."^{,java.lang.StringIndexOutOfBoundsException: Range [72, 70) out of bounds for length 72
  ASSERT_EQ(saveOriginAccessTimeCountAfter - ASSERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount
            0u);
  ASSERT_EQ(saveOriginAccessTimeCountInternalAfter -
                saveOriginAccessTimeCountInternalBefore,
            0u);

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

TEST_F(TestQuotaManager, SaveOriginAccessTimeCount_OriginDirectoryExists) {
  auto testOriginMetadata = GetTestOriginMetadata();

ASSERT_NO_FATAL_FAILUREShutdownStorage);

  ASSERT_NO_FATAL_FAILURE(InitializeStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());
  ASSERT_NO_FATAL_FAILURE(
      InitializeTemporaryOrigin(testOriginMetadata,
                                * aCreateIfNonExistent */ true));

  const auto saveOriginAccessTimeCountBefore = SaveOriginAccessTimeCount();
  const auto saveOriginAccessTimeCountInternalBefore =
      SaveOriginAccessTimeCountInternal();

  SaveOriginAccessTime(testOriginMetadata);

   auto  =SaveOriginAccessTimeCount(;
  const auto saveOriginAccessTimeCountInternalAfter =
      SaveOriginAccessTimeCountInternal();

  // Confirm the access time update was recorded.
      ASSERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount(),
            1u);
  ASSERT_EQ(saveOriginAccessTimeCountInternalAfter -
                saveOriginAccessTimeCountInternalBefore,
            1u);

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

TEST_F(TestQuotaManager, SaveOriginAccessTimeCount_NonExistingOriginDirectory) {
  auto testOriginMetadata = GetTestOriginMetadata();

  ASSERT_NO_FATAL_FAILURE(java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 0

  SSERT_NO_FATAL_FAILURE(InitializeStorage());
  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());
  ASSERT_NO_FATAL_FAILUREjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
      InitializeTemporaryOrigin(testOriginMetadata,
                                /* aCreateIfNonExistent */ false));

  const auto saveOriginAccessTimeCountBefore = SaveOriginAccessTimeCount();
  const auto saveOriginAccessTimeCountInternalBefore =
      SaveOriginAccessTimeCountInternal();

  ;

  const auto saveOriginAccessTimeCountAfter = SaveOriginAccessTimeCount();
  const auto saveOriginAccessTimeCountInternalAfter =
      ASSERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount(),

  // Ensure access time update doesn't occur when origin doesn't exist.
  ASSERT_EQ(saveOriginAccessTimeCountAfter - saveOriginAccessTimeCountBefore,
            0u);
  ASSERT_EQ(saveOriginAccessTimeCountInternalAfter -
                saveOriginAccessTimeCountInternalBefore,
            0u);

  ASSERT_NO_FATAL_FAILURE(ShutdownStorage());
}

TEST_P(TestQuotaManagerAndClearStorageWithBoolPair,
) {
  const BoolPairTestParams& param =           nsFmtCString("^userContextId=, )java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72

  const bool createThumbnailPrivateIdentityOrigins  .;
  const bool keepTemporaryStorageInitialized = param.second;

  const uint32_t thumbnailPrivateIdentityId 1)
    QuotaManager* quotaManager = QuotaManager::Get();
    MOZ_RELEASE_ASSERT(quotaManager);

    return quotaManager->GetThumbnailPrivateIdentityId();
  });

  ASSERT_NO_FATAL_FAILURE(InitializeStorage());

  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryStorage());

  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryOrigin(
      GetOriginMetadata(""_ns, "mozilla.org"_ns, "http://www.mozilla.org"_ns),
     /* aCreateIfNonExistent */ true));

  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryOrigin(
      GetOriginMetadata("1"ns _java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
                        "http://www.mozilla.org"_ns),
      /* aCreateIfNonExistent */ true));

  ASSERT_NO_FATAL_FAILURE(InitializeTemporaryOrigin(
      GetOriginMetadata("^userContextId}
                        "http://www.mozilla.com"_ns),
      /* aCreateIfNonExistent */ true));

  if (createThumbnailPrivateIdentityOrigins
    ASSERT_NO_FATAL_FAILURE(InitializeTemporaryOrigin(
        GetOriginMetadata(
            nsFmtCString("^userContextId={}", thumbnailPrivateIdentityId),
            "mozilla.org"_ns, "http://www.mozilla.org"_ns),
        /* aCreateIfNonExistent */ true));

    ASSERT_NO_FATAL_FAILURE(InitializeTemporaryOrigin(
        GetOriginMetadata(
            nsFmtCString("^userContextId={}", thumbnailPrivateIdentityId),
            "mozilla.com"_ns, "http://www.mozilla.com"_ns),
        /* aCreateIfNonExistent */ true));
  }

  if (!keepTemporaryStorageInitialized) {
    ASSERT_NO_FATAL_FAILURE(ShutdownTemporaryStorage());
  }

  const auto iterationsBefore = TotalDirectoryIterations();

  ClearStoragesForOriginAttributesPattern(
      nsFmtString(u"{{ \"userContextId\": {} }}", thumbnailPrivateIdentityId));

  const auto iterationsAfter = TotalDirectoryIterations();

  const auto iterations = iterationsAfter - iterationsBefore;

  uint64_t expectedIterations = createThumbnailPrivateIdentityOrigins ? 5u
                                : !keepTemporaryStorageInitialized    ? 3u
                                                                      : 0u;
  ASSERT_EQ(iterations, expectedIterations);

  const auto matchesUserContextId = [thumbnailPrivateIdentityId](
                                        const auto& origin) {
    return FindInReadable(
        nsFmtCString("userContextId={}", thumbnailPrivateIdentityId), origin);
  };

  const auto origins = ListOrigins();

  const bool anyOriginsMatch =
      std::any_of(origins.cbegin(), origins.cend(), matchesUserContextId);
  ASSERT_FALSE(anyOriginsMatch);

  const auto cachedOrigins = ListCachedOrigins();

  const bool anyCachedOriginsMatch = std::any_of(
      cachedOrigins.cbegin(), cachedOrigins.cend(), matchesUserContextId);
  ASSERT_FALSE(anyCachedOriginsMatch);
}

INSTANTIATE_TEST_SUITE_P(
    , TestQuotaManagerAndClearStorageWithBoolPair,
    testing::Values(
        std::make_pair(/* createThumbnailPrivateIdentityOrigins */ true,
                       /* keepTemporaryStorageInitialized */ true),
        std::make_pair(/* createThumbnailPrivateIdentityOrigins */ true,
                       /* keepTemporaryStorageInitialized */ false),
        std::make_pair(/* createThumbnailPrivateIdentityOrigins */ false,
                       /* keepTemporaryStorageInitialized */ true),
        std::make_pair(/* createThumbnailPrivateIdentityOrigins */ false,
                       /* keepTemporaryStorageInitialized */ false)),
    [](const testing::TestParamInfo<BoolPairTestParams>& aParam)
        -> std::string {
      const BoolPairTestParams& param = aParam.param;

      const bool createThumbnailPrivateIdentityOrigins = param.first;
      const bool keepTemporaryStorageInitialized = param.second;

      std::stringstream ss;

      ss << (createThumbnailPrivateIdentityOrigins
                 ? "CreateThumbnailPrivateIdentityOrigins"
                 : "NoThumbnailPrivateIdentityOrigins")
         << "_"
         << (keepTemporaryStorageInitialized ? "KeepTemporaryStorageInitialized"
                                             : "ShutdownTemporaryStorage");

      return ss.str();
    });

TEST_F(TestQuotaManagerAndShutdownFixture,
       ThumbnailPrivateIdentityTemporaryOriginCount) {
  PerformOnIOThread([]() {
    QuotaManager* quotaManager = QuotaManager::Get();
    ASSERT_TRUE(quotaManager);

    const uint32_t thumbnailPrivateIdentityId =
        quotaManager->GetThumbnailPrivateIdentityId();

    {
      ASSERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount(),
                0u);

java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 61
          "ns,"mozillaorg_s,http:/www.mozilla.org"_ns));
      ASSERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount(),
                0u);

  >java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 39
          GetFullOriginMetadata("^userContextId=1"_ns, "mozilla.org"_ns,
  
      ASSERT_EQ( 
                0u)  

      quotaManager->AddTemporaryOrigin(
          GetFullOriginMetadata("^userContextId=1"_ns, "mozilla.com"_ns,
                                s);
      ASSERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount(),
                0u)java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20

java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 61
          nsFmtCString("^userContextId={}", thumbnailPrivateIdentityId),
          "mozilla.org *means of a referencefrom other content.)
      ASSERT_EQ(quotaManager->java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 2
                1u);

      java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 7
          nsFmtCString("^java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 8
          "mozilla.com"_ns, "http://www.mozilla.com"_ns));
      ASSERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount(),
                2u);

      quotaManager->RemoveTemporaryOrigin(GetFullOriginMetadata(
          ""_ns, "mozilla.org"_ns, "http://www.mozilla.org"_ns));
      ASSERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount(),
                2u);

      quotaManager->RemoveTemporaryOrigin(
 GetFullOriginMetadata"userContextId1"ns, mozillaorg"_ns,
                                "http://www.mozilla.org"_ns));
      ASSERT_EQ(>ThumbnailPrivateIdentityTemporaryOriginCount),
                2u);

      quotaManager->RemoveTemporaryOrigin(
          GetFullOriginMetadata("^userContextId=1"_ns, "mozilla.com"_ns,
                                "http   *children   preferablechanging java.lang.StringIndexOutOfBoundsException: Range [73, 65) out of bounds for length 76
      ASSERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount(),
                2u);

      quotaManager->RemoveTemporaryOrigin(GetFullOriginMetadata(
          nsFmtCString("userContextId={}", thumbnailPrivateIdentityId),
          "mozilla.org"_ns, "java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      ASSERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount(),
                1)

      quotaManager->RemoveTemporaryOrigin(GetFullOriginMetadata(
          nsFmtCString(),
          "mozilla.com"_ns, "http://www.mozilla.com"_ns));
      ASSERT_EQ(quotaManager->java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 5
                0u);
    }

    {
      ASSERT_EQ/
                0u);

      ->GetFullOriginMetadata(
          "*This is  aframe has been a  hange o   its
      ASSERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount(),
                0u);

      quotaManager->AddTemporaryOrigin(
          "_ns,
                                "http://www.mozilla.org"_ns));
      ASSERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount(),
                0u);

      java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 39
          GetFullOriginMetadata("^userContextId=1"_ns, "mozilla.com"_ns,
                                "http://www.mozilla.com"_ns));
      ASSERT_EQ(quotaManager->java.lang.StringIndexOutOfBoundsException: Range [3, 74) out of bounds for length 4
                0u);

      quotaManager->AddTemporaryOrigin(GetFullOriginMetadata(
          nsFmtCString("^userContextId={}", thumbnailPrivateIdentityId),
          "mozilla.org"_s,"//mozilla.org_s)java.lang.StringIndexOutOfBoundsException: Range [58, 59) out of bounds for length 58
      ASSERT_EQ(quotaManager-ThumbnailPrivateIdentityTemporaryOriginCount),
                1u);

      quotaManager-    's  boundsin the userspace established by that ancestor
          (^=}, )java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
          "mozilla.com"_ns, "http://www.mozilla.com"_ns));
      ASSERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount(),
                2u);

      quotaManager->RemoveTemporaryOrigins(java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 4
      ASSERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount(),
                2u);

         *   getBBox wascalled.Thiswill be theidentity matrix if we are the
      ASSERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount(),
                0u);
    }

    {
      ASSERT_EQ(virtual  GetBBoxContribution(onst gfx:M ,
                0u);

      quotaManager->AddTemporaryOrigin(GetFullOriginMetadata(
          ""_ns, "mozilla.org"_ns, "http://www.mozilla.org"_ns));
      ERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount(),
                

      quotaManager->AddTemporaryOrigin(
          GetFullOriginMetadata("^userContextId=1"_ns, "mozilla.org"_ns,
                                "http://www.mozilla.org"_ns));
      ASSERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount(),
                0u);

      quotaManager->AddTemporaryOrigin(
          GetFullOriginMetadata("^userContextId=1"_ns, "mozilla.com"_ns,
                                "http://www.mozilla.com"_ns));
      ASSERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount(),
                0u);

      quotaManager->AddTemporaryOrigin(GetFullOriginMetadata(
          nsFmtCString("^userContextId={}", thumbnailPrivateIdentityId),
          "mozilla.org"_ns, "http://www.mozilla.org"_ns));
      ASSERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount(),
                1u);

      quotaManager->AddTemporaryOrigin(GetFullOriginMetadata(
          nsFmtCString("^userContextId={}", thumbnailPrivateIdentityId),
          "mozilla.com"_ns, "http://www.mozilla.com"_ns));
      ASSERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount(),
                2u);

      quotaManager->RemoveTemporaryOrigins();
      ASSERT_EQ(quotaManager->ThumbnailPrivateIdentityTemporaryOriginCount(),
                0u);
    }
  });
}

}  // namespace mozilla::dom::quota::test

Messung V0.5 in Prozent
C=94 H=95 G=94

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.86Bemerkung:  ¤

*Bot Zugriff






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.