1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30

ash / components / arc / video_accelerator / arc_video_accelerator_util_unittest.cc [blame]

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

#include "ash/components/arc/video_accelerator/arc_video_accelerator_util.h"

#include "base/files/scoped_file.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace arc {

namespace {
constexpr char kTestData[] = "TEST_DATA";
constexpr size_t kNumFds = 3;
}  // namespace

TEST(ArcVideoAcceleratorUtil, DuplicateFD_OK) {
  base::ScopedFD fd = CreateTempFileForTesting(kTestData);
  auto fds = DuplicateFD(std::move(fd), kNumFds);

  EXPECT_EQ(fds.size(), kNumFds);
}

TEST(ArcVideoAcceleratorUtil, DuplicateFD_Fail) {
  auto fds = DuplicateFD(base::ScopedFD(), kNumFds);

  EXPECT_EQ(fds.size(), 0u);
}

}  // namespace arc