#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include <inttypes.h>
#include <map>
#include <memory>
#include <optional>
#include <ostream>
#include <set>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>
#include "base/auto_reset.h"
#include "base/barrier_closure.h"
#include "base/check.h"
#include "base/containers/contains.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/memory/scoped_refptr.h"
#include "base/numerics/clamped_math.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/mock_callback.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/test/test_future.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
#include "components/services/storage/indexed_db/locks/partitioned_lock_id.h"
#include "components/services/storage/privileged/cpp/bucket_client_info.h"
#include "components/services/storage/privileged/mojom/indexed_db_control.mojom.h"
#include "components/services/storage/public/cpp/buckets/bucket_id.h"
#include "components/services/storage/public/cpp/buckets/bucket_info.h"
#include "components/services/storage/public/cpp/buckets/bucket_init_params.h"
#include "components/services/storage/public/cpp/buckets/bucket_locator.h"
#include "components/services/storage/public/cpp/buckets/constants.h"
#include "components/services/storage/public/cpp/quota_error_or.h"
#include "components/services/storage/public/mojom/storage_policy_update.mojom.h"
#include "content/browser/indexed_db/indexed_db_backing_store.h"
#include "content/browser/indexed_db/indexed_db_bucket_context.h"
#include "content/browser/indexed_db/indexed_db_bucket_context_handle.h"
#include "content/browser/indexed_db/indexed_db_connection.h"
#include "content/browser/indexed_db/indexed_db_context_impl.h"
#include "content/browser/indexed_db/indexed_db_data_format_version.h"
#include "content/browser/indexed_db/indexed_db_leveldb_coding.h"
#include "content/browser/indexed_db/indexed_db_pre_close_task_queue.h"
#include "content/browser/indexed_db/mock_mojo_indexed_db_database_callbacks.h"
#include "content/browser/indexed_db/mock_mojo_indexed_db_factory_client.h"
#include "content/public/common/content_features.h"
#include "env_chromium.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/struct_ptr.h"
#include "net/base/features.h"
#include "net/base/schemeful_site.h"
#include "storage/browser/test/mock_quota_manager.h"
#include "storage/browser/test/mock_quota_manager_proxy.h"
#include "storage/browser/test/mock_special_storage_policy.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/indexeddb/indexeddb_key.h"
#include "third_party/blink/public/common/indexeddb/indexeddb_key_path.h"
#include "third_party/blink/public/common/indexeddb/indexeddb_metadata.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "third_party/blink/public/mojom/indexeddb/indexeddb.mojom.h"
#include "third_party/blink/public/mojom/quota/quota_types.mojom-shared.h"
#include "third_party/blink/public/mojom/storage_key/ancestor_chain_bit.mojom-shared.h"
#include "url/gurl.h"
#include "url/origin.h"
RunClosure;
IndexedDBDatabaseMetadata;
IndexedDBIndexKeys;
IndexedDBKey;
BucketLocator;
_;
StrictMock;
Origin;
namespace content {
namespace …
class IndexedDBTest
: public testing::Test,
public testing::WithParamInterface<std::tuple<bool, bool>> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(IndexedDBTest, CloseConnectionBeforeUpgrade) { … }
TEST_P(IndexedDBTest, CloseAfterUpgrade) { … }
#if BUILDFLAG(IS_MAC) && !defined(NDEBUG)
#define MAYBE_OpenNewConnectionWhileUpgrading …
#else
#define MAYBE_OpenNewConnectionWhileUpgrading …
#endif
TEST_P(IndexedDBTest, MAYBE_OpenNewConnectionWhileUpgrading) { … }
MATCHER_P(IsCallbackError, error_code, "") { … }
TEST_P(IndexedDBTest, DISABLED_PutWithInvalidBlob) { … }
TEST_P(IndexedDBTest, DISABLED_NotifyIndexedDBListChanged) { … }
MATCHER(IsSuccessKey, "") { … }
TEST_P(IndexedDBTest, DISABLED_NotifyIndexedDBContentChanged) { … }
TEST_P(IndexedDBTest, DISABLED_DatabaseOperationSequencing) { … }
TEST_P(IndexedDBTest, ClearSessionOnlyDatabases) { … }
TEST_P(IndexedDBTest, SetForceKeepSessionState) { … }
IndexedDBTestFirstOrThirdParty;
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(IndexedDBTestFirstOrThirdParty, ForceCloseOpenDatabasesOnDelete) { … }
TEST_P(IndexedDBTestFirstOrThirdParty, ForceCloseOpenDatabasesOnCommitFailure) { … }
TEST_P(IndexedDBTestFirstOrThirdParty,
ForceCloseOpenDatabasesOnDeleteDatabase) { … }
TEST(PartitionedLockManager, TestRangeDifferences) { … }
TEST_P(IndexedDBTest, BasicFactoryCreationAndTearDown) { … }
TEST_P(IndexedDBTest, CloseSequenceStarts) { … }
TEST_P(IndexedDBTest, CloseWithReceiversActive) { … }
TEST_P(IndexedDBTest, CloseWithReceiversInactive) { … }
TEST_P(IndexedDBTest, PreCloseTasksStart) { … }
TEST_P(IndexedDBTest, TombstoneSweeperTiming) { … }
TEST_P(IndexedDBTest, CompactionTaskTiming) { … }
TEST_P(IndexedDBTest, InMemoryFactoriesStay) { … }
TEST_P(IndexedDBTest, TooLongOrigin) { … }
TEST_P(IndexedDBTest, FactoryForceClose) { … }
TEST_P(IndexedDBTest, CloseThenAddReceiver) { … }
TEST_P(IndexedDBTest, ConnectionCloseDuringUpgrade) { … }
TEST_P(IndexedDBTest, DeleteDatabase) { … }
TEST_P(IndexedDBTest, GetDatabaseNames_NoFactory) { … }
TEST_P(IndexedDBTest, QuotaErrorOnDiskFull) { … }
TEST_P(IndexedDBTest, DatabaseFailedOpen) { … }
TEST_P(IndexedDBTest, DataLoss) { … }
}