chromium/mojo/public/cpp/system/tests/data_pipe_producer_unittest.cc

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

#include "mojo/public/cpp/system/data_pipe_producer.h"

#include <algorithm>
#include <limits>
#include <memory>
#include <string>

#include "base/containers/span.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/task_environment.h"
#include "mojo/public/cpp/system/data_pipe.h"
#include "mojo/public/cpp/system/file_data_source.h"
#include "mojo/public/cpp/system/filtered_data_source.h"
#include "mojo/public/cpp/system/simple_watcher.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace mojo {
namespace {

// Test helper. Reads a consumer handle, accumulating data into a string. Reads
// until encountering an error (e.g. peer closure), at which point it invokes an
// async callback.
class DataPipeReader {};

class DataPipeProducerTest : public testing::Test {};

struct DataPipeObserverData {};

class TestObserver : public FilteredDataSource::Filter {};

TEST_F(DataPipeProducerTest, WriteFromFile) {}

TEST_F(DataPipeProducerTest, WriteFromFilePartial) {}

TEST_F(DataPipeProducerTest, WriteFromInvalidFile) {}

TEST_F(DataPipeProducerTest, TinyFile) {}

TEST_F(DataPipeProducerTest, HugeFile) {}

// Simulate abnormal situations, such as changing the file size between
// obtaining the file size and actually reading the file
TEST_F(DataPipeProducerTest, WriteLengthGreaterThanFile) {}

}  // namespace
}  // namespace mojo