chromium/base/files/important_file_writer_unittest.cc

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

#include "base/files/important_file_writer.h"

#include <optional>

#include "base/compiler_specific.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/location.h"
#include "base/memory/ptr_util.h"
#include "base/notreached.h"
#include "base/run_loop.h"
#include "base/sequence_checker.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "base/threading/thread.h"
#include "base/time/time.h"
#include "base/timer/mock_timer.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace base {

namespace {

std::string GetFileContent(const FilePath& path) {}

class DataSerializer : public ImportantFileWriter::DataSerializer {};

class FailingDataSerializer : public ImportantFileWriter::DataSerializer {};

class BackgroundDataSerializer
    : public ImportantFileWriter::BackgroundDataSerializer {};

enum WriteCallbackObservationState {};

class WriteCallbacksObserver {};

void WriteCallbacksObserver::ObserveNextWriteCallbacks(
    ImportantFileWriter* writer) {}

WriteCallbackObservationState
WriteCallbacksObserver::GetAndResetObservationState() {}

}  // namespace

class ImportantFileWriterTest : public testing::Test {};

TEST_F(ImportantFileWriterTest, Basic) {}

TEST_F(ImportantFileWriterTest, WriteWithObserver) {}

TEST_F(ImportantFileWriterTest, FailedWriteWithObserver) {}

TEST_F(ImportantFileWriterTest, CallbackRunsOnWriterThread) {}

TEST_F(ImportantFileWriterTest, ScheduleWrite) {}

TEST_F(ImportantFileWriterTest, DoScheduledWrite) {}

TEST_F(ImportantFileWriterTest, BatchingWrites) {}

TEST_F(ImportantFileWriterTest, ScheduleWrite_FailToSerialize) {}

TEST_F(ImportantFileWriterTest, ScheduleWrite_WriteNow) {}

TEST_F(ImportantFileWriterTest, DoScheduledWrite_FailToSerialize) {}

TEST_F(ImportantFileWriterTest, ScheduleWriteWithBackgroundDataSerializer) {}

TEST_F(ImportantFileWriterTest,
       ScheduleWriteWithBackgroundDataSerializer_FailToSerialize) {}

// Test that the chunking to avoid very large writes works.
TEST_F(ImportantFileWriterTest, WriteLargeFile) {}

// Verify that a UMA metric for the serialization duration is recorded.
TEST_F(ImportantFileWriterTest, SerializationDuration) {}

// Verify that a UMA metric for the serialization duration is recorded if the
// ImportantFileWriter has a custom histogram suffix.
TEST_F(ImportantFileWriterTest, SerializationDurationWithCustomSuffix) {}

}  // namespace base