chromium/mojo/public/cpp/base/file_unittest.cc

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

#include <string_view>

#include "base/containers/span.h"
#include "base/files/scoped_temp_dir.h"
#include "base/sync_socket.h"
#include "build/build_config.h"
#include "mojo/buildflags.h"
#include "mojo/public/cpp/base/file_mojom_traits.h"
#include "mojo/public/cpp/base/read_only_file_mojom_traits.h"
#include "mojo/public/cpp/test_support/test_utils.h"
#include "mojo/public/mojom/base/file.mojom.h"
#include "mojo/public/mojom/base/read_only_file.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace mojo_base {
namespace file_unittest {

TEST(FileTest, File) {}

TEST(FileTest, AsyncFile) {}

TEST(FileTest, InvalidFile) {}

TEST(FileTest, ReadOnlyFile) {}

// This dies only if we can interrogate the underlying platform handle.
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_AIX)
TEST(FileTest, ReadOnlyFileDeath) {}
#endif  // !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_AIX)
#endif  // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)

// This should work on all platforms. This check might be relaxed in which case
// this test can be removed. iOS without blink does not build SyncSocket, so do
// not build this when blink isn't used.
#if DCHECK_IS_ON() && (!BUILDFLAG(IS_IOS) || BUILDFLAG(MOJO_USE_APPLE_CHANNEL))
TEST(FileTest, NonPhysicalFileDeath) {}
#endif  // DCHECK_IS_ON()

}  // namespace file_unittest
}  // namespace mojo_base