chromium/components/sessions/core/command_storage_backend_unittest.cc

// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "components/sessions/core/command_storage_backend.h"

#include <stddef.h>

#include <limits>
#include <utility>

#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/scoped_refptr.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/test/bind.h"
#include "base/test/simple_test_clock.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "components/sessions/core/command_storage_manager.h"
#include "components/sessions/core/session_constants.h"
#include "components/sessions/core/session_service_commands.h"
#include "testing/gtest/include/gtest/gtest.h"

MakeRefCounted;

namespace sessions {

size_type;

namespace {

SessionCommands;

struct TestData {};

std::unique_ptr<SessionCommand> CreateCommandFromData(const TestData& data) {}

}  // namespace

class CommandStorageBackendTest : public testing::Test {};

TEST_F(CommandStorageBackendTest, MigrateOther) {}

TEST_F(CommandStorageBackendTest, SimpleReadWriteEncrypted) {}

TEST_F(CommandStorageBackendTest, RandomDataEncrypted) {}

TEST_F(CommandStorageBackendTest, BigDataEncrypted) {}

TEST_F(CommandStorageBackendTest, MarkerOnlyEncrypted) {}

// Writes a command, appends another command with reset to true, then reads
// making sure we only get back the second command.
TEST_F(CommandStorageBackendTest, TruncateEncrypted) {}

std::unique_ptr<SessionCommand> CreateCommandWithMaxSize() {}

TEST_F(CommandStorageBackendTest, MaxSizeTypeEncrypted) {}

TEST_F(CommandStorageBackendTest, MaxSizeType) {}

TEST_F(CommandStorageBackendTest, IsValidFileWithInvalidFiles) {}

TEST_F(CommandStorageBackendTest, IsNotValidFileWithoutMarker) {}

TEST_F(CommandStorageBackendTest, SimpleReadWriteWithRestoreType) {}

TEST_F(CommandStorageBackendTest, RandomDataWithRestoreType) {}

TEST_F(CommandStorageBackendTest, BigDataWithRestoreType) {}

TEST_F(CommandStorageBackendTest, CommandWithRestoreType) {}

// Writes a command, appends another command with reset to true, then reads
// making sure we only get back the second command.
TEST_F(CommandStorageBackendTest, TruncateWithRestoreType) {}

// Test parsing the timestamp of a session from the path.
TEST_F(CommandStorageBackendTest, TimestampFromPathWithRestoreType) {}

// Test serializing a timestamp to string.
TEST_F(CommandStorageBackendTest, FilePathFromTimeWithRestoreType) {}

// Test that the previous session is empty if no session files exist.
TEST_F(CommandStorageBackendTest,
       DeterminePreviousSessionEmptyWithRestoreType) {}

// Test that the previous session is selected correctly when a file is present.
TEST_F(CommandStorageBackendTest,
       DeterminePreviousSessionSingleWithRestoreType) {}

// Test that the previous session is selected correctly when multiple session
// files are present.
TEST_F(CommandStorageBackendTest,
       DeterminePreviousSessionMultipleWithRestoreType) {}

// Test that the a file with an invalid name won't be used.
TEST_F(CommandStorageBackendTest,
       DeterminePreviousSessionInvalidWithRestoreType) {}

// Tests that MoveCurrentSessionToLastSession deletes the last session file.
TEST_F(CommandStorageBackendTest,
       MoveCurrentSessionToLastDeletesLastSessionWithRestoreType) {}

TEST_F(CommandStorageBackendTest, GetSessionFiles) {}

TEST_F(CommandStorageBackendTest, TimestampSeparatorIsAscii) {}

TEST_F(CommandStorageBackendTest, GetSessionFilesAreSortedByReverseTimestamp) {}

TEST_F(CommandStorageBackendTest, UseMarkerWithoutValidMarker) {}

// This test moves a previously written file into the expected location and
// ensures it's read. This is to verify reading hasn't changed in an
// incompatible manner.
TEST_F(CommandStorageBackendTest, ReadPreviouslyWrittenData) {}

TEST_F(CommandStorageBackendTest, NewFileOnTruncate) {}

TEST_F(CommandStorageBackendTest, AppendCommandsCallbackRunOnError) {}

TEST_F(CommandStorageBackendTest, RestoresFileWithMarkerAfterFailure) {}

TEST_F(CommandStorageBackendTest, PathTimeIncreases) {}

}  // namespace sessions